Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Extend PartsOf to mock non-virtual methods implementing an i… #700

Merged
merged 1 commit into from
Aug 11, 2024

Commits on Aug 7, 2024

  1. Feature: Enable call forwarding and substitution for non virtual meth…

    …ods or sealed classes implementing an interface.
    
    How to use:
    var substitute = Substitute.ForTypeForwardingTo <ISomeInterface,SomeImplementation>(argsList);
    
    In this case, it doesn't matter if methods are virtual or not; it will intercept all calls since we will be working with an interface all the time.
    For
    Limitations:
    
    Overriding virtual methods effectively replaces its implementation both for internal and external calls. With this implementation Nsubstitute will only intercept calls made by client classes using the interface. Calls made from inside the object itself to it's own method, will hit the actual implementation.
    marcoregueira committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    eed5290 View commit details
    Browse the repository at this point in the history