public void it_should_apply_conventions_to_types_of_properties()
        {
            var src1 = new PersonalInfo() { Age = 3, Name = "mikey" };
            var destination = new ManyDates();
            var dateTime = new DateTime(2009, 8, 1, 0, 0, 0);
            var cfg = new DestinationConfiguration(typeof(ManyDates));
            cfg.From(typeof (PersonalInfo), typeof (Parents))
                .ApplyingConvention(new TypePropertyCriterion(typeof (DateTime)), new StaticValueResolver(dateTime));
            var bindable = bindableFactory.CreateBindableConfiguration(cfg.TakeSnapshot());

            var executable = bindable.CreateExecutableMapping(typeof (PersonalInfo));
            executable.Execute(contextualizer.CreateContext(src1, destination));
            destination.DateTime1.should_be_equal_to(dateTime);
            destination.DateTime2.should_be_equal_to(dateTime);
            destination.Name.should_be_equal_to("mikey");
        }
Example #2
0
        public void it_should_apply_conventions_to_types_of_properties()
        {
            var src1 = new PersonalInfo()
            {
                Age = 3, Name = "mikey"
            };
            var destination = new ManyDates();
            var dateTime    = new DateTime(2009, 8, 1, 0, 0, 0);
            var cfg         = new DestinationConfiguration(typeof(ManyDates));

            cfg.From(typeof(PersonalInfo), typeof(Parents))
            .ApplyingConvention(new TypePropertyCriterion(typeof(DateTime)), new StaticValueResolver(dateTime));
            var bindable = bindableFactory.CreateBindableConfiguration(cfg.TakeSnapshot());

            var executable = bindable.CreateExecutableMapping(typeof(PersonalInfo));

            executable.Execute(contextualizer.CreateContext(src1, destination));
            destination.DateTime1.should_be_equal_to(dateTime);
            destination.DateTime2.should_be_equal_to(dateTime);
            destination.Name.should_be_equal_to("mikey");
        }