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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.