CallBase

CallBase, when initialized during a mock construction, is used to specify whether the base class virtual implementation will be invoked for mocked dependencies if no setup is matched. The default value is false. This is useful when mocking HTML/web controls of the System.Web namespace:

loanRepository= new Mock<ILoanRepository>{CallBase=true};

Get C# and .NET Core Test Driven Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.