public void it_should_give_priority_to_manually_configured_mappings() { var src1 = new PersonalInfo() { Age = 3, Name = "mikey" }; var destination = new SystemPerson() { MothersName = "ignoremeplease" }; Guid systemId = Guid.NewGuid(); Guid myManualSystemId = new Guid("EE99B786-B3A2-426A-BA46-53B990383DA1"); var cfg = new DestinationConfiguration <SystemPerson>(new TestConfigurationFactory()); cfg.From(typeof(PersonalInfo), typeof(Parents)); cfg.ApplyingConvention(new StaticValueResolver(systemId), m => m.SystemId); cfg.UsingValue <PersonalInfo>(myManualSystemId, on => on.SystemId); var bindable = bindableFactory.CreateBindableConfiguration(cfg.TakeSnapshot()); var executable = bindable.CreateExecutableMapping(typeof(PersonalInfo)); executable.Execute(contextualizer.CreateContext(src1, destination)); destination.SystemId.should_not_be_equal_to(systemId); destination.SystemId.should_be_equal_to(myManualSystemId); }
public void it_should_apply_convention_during_mapping() { var src1 = new PersonalInfo() { Age = 3, Name = "mikey" }; var destination = new SystemPerson() { MothersName = "ignoremeplease" }; Guid systemId = Guid.NewGuid(); var cfg = new DestinationConfiguration <SystemPerson>(new TestConfigurationFactory()); cfg.From(typeof(PersonalInfo), typeof(Parents)) .ApplyingConvention(new StaticValueResolver(systemId), m => m.SystemId); var bindable = bindableFactory.CreateBindableConfiguration(cfg.TakeSnapshot()); var executable = bindable.CreateExecutableMapping(typeof(PersonalInfo)); executable.Execute(contextualizer.CreateContext(src1, destination)); destination.Age.should_be_equal_to(3); destination.MothersName.should_be_equal_to("ignoremeplease"); destination.SystemId.should_be_equal_to(systemId); destination.Name.should_be_equal_to("mikey"); }
public void it_should_give_priority_to_manually_configured_mappings() { var src1 = new PersonalInfo() { Age = 3, Name = "mikey" }; var destination = new SystemPerson() { MothersName = "ignoremeplease" }; Guid systemId = Guid.NewGuid(); Guid myManualSystemId = new Guid("EE99B786-B3A2-426A-BA46-53B990383DA1"); var cfg = new DestinationConfiguration<SystemPerson>(new TestConfigurationFactory()); cfg.From(typeof(PersonalInfo), typeof(Parents)); cfg.ApplyingConvention(new StaticValueResolver(systemId), m => m.SystemId); cfg.UsingValue<PersonalInfo>(myManualSystemId, on => on.SystemId); var bindable = bindableFactory.CreateBindableConfiguration(cfg.TakeSnapshot()); var executable = bindable.CreateExecutableMapping(typeof(PersonalInfo)); executable.Execute(contextualizer.CreateContext(src1, destination)); destination.SystemId.should_not_be_equal_to(systemId); destination.SystemId.should_be_equal_to(myManualSystemId); }
public void it_should_apply_convention_during_mapping() { var src1 = new PersonalInfo() { Age = 3, Name = "mikey" }; var destination = new SystemPerson(){MothersName = "ignoremeplease"}; Guid systemId=Guid.NewGuid(); var cfg = new DestinationConfiguration<SystemPerson>(new TestConfigurationFactory()); cfg.From(typeof(PersonalInfo), typeof(Parents)) .ApplyingConvention(new StaticValueResolver(systemId), m=>m.SystemId); var bindable = bindableFactory.CreateBindableConfiguration(cfg.TakeSnapshot()); var executable = bindable.CreateExecutableMapping(typeof (PersonalInfo)); executable.Execute(contextualizer.CreateContext(src1,destination)); destination.Age.should_be_equal_to(3); destination.MothersName.should_be_equal_to("ignoremeplease"); destination.SystemId.should_be_equal_to(systemId); destination.Name.should_be_equal_to("mikey"); }