Answers for "unittest servicector automapper"

C#
0

unittest servicector automapper

public TestsCtor()
{
    _fixture = new Fixture().Customize(new AutoMoqCustomization());
    var converterLogger = _fixture.Freeze<Mock<ILogger<MyTypeConverter>>>();
    var automapperServiceCtor = _fixture.Freeze<Mock<Func<Type, object>>>();
    automapperServiceCtor.Setup(x => x.Invoke(typeof(ILogger<MyTypeConverter>))).Returns(converterLogger.Object);
    var mapperConfig = new MapperConfiguration(cfg => {
        cfg.ConstructServicesUsing(automapperServiceCtor.Object);
        cfg.AddProfile<AutoMapperConfig>(); 
    });
    _mapper = new Mapper(mapperConfig);
}
Posted by: Guest on July-08-2021

C# Answers by Framework

Browse Popular Code Answers by Language