MockerTestBase<(Of <(<'TComponent>)>)> Class
Mock Test Base with Automatic Mocking using Mocker. This class contains the Mocks property to create and track all Mocks from creation of the component.
Namespace:
FastMoqAssembly: FastMoq.Core (in FastMoq.Core.dll)
Syntax
public abstract class MockerTestBase<TComponent>
Public MustInherit Class MockerTestBase(Of TComponent)
generic<typename TComponent> public ref class MockerTestBase abstract
Type Parameters
- TComponent
- The type of the t component.
Examples
C#
public class CarTest : MockerTestBase<Car> { public void TestCar() { Component.CarService.Should().NotBeNull(); } }
C#
public partial class Car { public Car(ICarService carService) => CarService = carService; }
C#
protected override Action<Mocker> SetupMocksAction => mocker => mocker.AddType(_ => mocker.GetMockDbContext<ApplicationDbContext>().Object);