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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Commits on May 13, 2024

  1. Feature: Extend PartsOf to mock non-virtual methods implementing an i…

    …nterface.
    
    How to use:
    var substitute = Substitute.ForPartsOf<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.
    
    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 May 13, 2024
    Configuration menu
    Copy the full SHA
    e58685a View commit details
    Browse the repository at this point in the history
  2. 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 May 13, 2024
    Configuration menu
    Copy the full SHA
    05cb82c View commit details
    Browse the repository at this point in the history

Commits on May 20, 2024

  1. Configuration menu
    Copy the full SHA
    7940897 View commit details
    Browse the repository at this point in the history
  2. Fix merge

    marcoregueira committed May 20, 2024
    Configuration menu
    Copy the full SHA
    266ace9 View commit details
    Browse the repository at this point in the history