Mocker Class
Initializes the mocking helper object. This class creates and manages the automatic mocking and custom mocking.
Namespace:
FastMoqAssembly: FastMoq.Core (in FastMoq.Core.dll)
Remarks
Examples
C#
// Arrange var id = 1234; var blogsTestData = new List<Blog> { new Blog { Id = id } }; // Create a mock DbContext var mocker = new Mocker(); // Create a new mocker only if not already using MockerTestBase; otherwise use Mocks included in the base class. var dbContextMock = mocker.GetMockDbContext<ApplicationDbContext>(); var dbContext = dbContextMock.Object; dbContext.Blogs.Add(blogsTestData); // Can also be dbContext.Set<Blog>().Add(blogsTestData) var validator = new BtnValidator(dbContext); // Act var result = validator.IsValid(id); // Assert Assert.True(result);