public void MappingFailsWithNullTargetObject() { var mappingSet = new CustomMappingSet(); var context = new MappingContext { Source = "" }; Assert.False(mappingSet.Run(context)); }
public void MappingRunsWhenSourceObjectHasNoPropertyName() { var source = new SourceInvalid1(); var target = new TargetValid(); var context = new MappingContext { Source = source, Target = target }; var mappingSet = new CustomMappingSet(); Assert.True(mappingSet.Run(context)); Assert.Equal(1, context.RunFail.Count); Assert.Equal("Mapping1", context.RunFail.First().Identifier); Assert.Equal(1, context.RunSuccess.Count); Assert.Equal("Mapping2", context.RunSuccess.First().Identifier); Assert.Equal(DateTime.Now.Date, target.LastUpdated); }
public void MappingRunsWhenTargetObjectHasNoPropertyDescription() { var source = new SourceValid { Name = "aaa" }; var target = new TargetInvalid1(); var context = new MappingContext { Source = source, Target = target }; var mappingSet = new CustomMappingSet(); Assert.True(mappingSet.Run(context)); Assert.Equal(1, context.RunSuccess.Count); Assert.Equal("Mapping1", context.RunSuccess.First().Identifier); Assert.Equal(source.Name, target.Description); Assert.Equal(1, context.RunFail.Count); Assert.Equal("Mapping2", context.RunFail.First().Identifier); }
public void MappingRunsProperly() { var source = new SourceValid { Name = "aaa" }; var target = new TargetValid(); var context = new MappingContext { Source = source, Target = target }; var mappingSet = new CustomMappingSet(); Assert.True(mappingSet.Run(context)); Assert.Equal(2, context.RunSuccess.Count); Assert.Contains("Mapping1", context.RunSuccess.Select(m => m.Identifier)); Assert.Contains("Mapping2", context.RunSuccess.Select(m => m.Identifier)); Assert.Equal(source.Name, target.Description); Assert.Equal(DateTime.Now.Date, target.LastUpdated); }
public void MappingFailsWithNullMappingContext() { var mappingSet = new CustomMappingSet(); Assert.False(mappingSet.Run(null)); }