I'd like to ask you a question about AutoMapper. We are unit testing our mapping like that:
var dtoFiltrePersonne = new DtoFiltrePersonne { Prop1 = "Test", Prop2 = 1234 };
Mapper.CreateMap<FiltrePersonne, DtoFiltrePersonne>();
var filtrePersonne = DtoAutoMappeur<DtoFiltrePersonne, FiltrePersonne>.Instance.MapFromDtoToEntity(dtoFiltrePersonne);
Assert.AreEqual(dtoFiltrePersonne.Prop1, filtrePersonne.Prop1);
Assert.AreEqual(dtoFiltrePersonne.Prop2, filtrePersonne.Prop2);
I'd like to know if this unit test provides the same coverage?
Mapper.CreateMap<FiltrePersonne, DtoFiltrePersonne>();
AutoMapper.AssertConfigurationIsValid()
I looked into the AutoMapper Configuration documentation and it's not pretty clear for me. Do I need to unit test each mapping or just use the AssertConfigurationIsValid
method?