Пример #1
0
        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);
        }
Пример #2
0
        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);
        }