public void ThrowExceptionOnSomePropertyNotConfiguredOrMapped() { var configuration = new MapperConfiguration { Scanner = { Enabled = false } }; var setupMap = new Mapper.SetupMapping(configuration); configuration.AddConvention <SameNameIgnoreCaseConvention>(); setupMap.FromTo <ValidatorTest1, ValidatorTest1Model>(); configuration.Initialize(); Assert.Throws <SomePropertiesNotMappedException>(() => configuration.AssertAllPropertiesMappedOnDestinationObjects()); }
public void NotThrowExceptionOnAllPropertiesConfigured() { var configuration = new MapperConfiguration { Scanner = { Enabled = false } }; var setupMap = new Mapper.SetupMapping(configuration); configuration.AddConvention <SameNameIgnoreCaseConvention>(); setupMap.FromTo <ValidatorTest1, ValidatorTest1Model>().Ignore(x => x.OtherProperty); configuration.Initialize(); configuration.AssertAllPropertiesMappedOnDestinationObjects(); }
public void ThrowExceptionOnInitializeForMissingTypeMapWithAutomapDisabled() { var configuration = new MapperConfiguration { Scanner = { Enabled = false }, CreateMissingMapsAutomatically = false }; var setupMap = new Mapper.SetupMapping(configuration); configuration.AddConvention <SameNameIgnoreCaseConvention>(); setupMap.FromTo <ValidatorTest1, ValidatorTest1Model>().SetManually((s, d) => { d.OtherProperty = "Hejsan"; }, x => x.OtherProperty); Assert.Throws <MapNotConfiguredException>(() => configuration.Initialize()); Assert.Throws <MapperException>(() => configuration.AssertAllPropertiesMappedOnDestinationObjects()); }
public void NotThrowExceptionWhenManualSetHasBeenSpecified() { var configuration = new MapperConfiguration { Scanner = { Enabled = false } }; var setupMap = new Mapper.SetupMapping(configuration); configuration.AddConvention <SameNameIgnoreCaseConvention>(); setupMap.FromTo <ValidatorTest1, ValidatorTest1Model>().SetManually((s, d) => { d.OtherProperty = "Hejsan"; }, x => x.OtherProperty); configuration.Initialize(); configuration.AssertAllPropertiesMappedOnDestinationObjects(); }