Exemplo n.º 1
0
        public void it_can_map_to_instance()
        {
            var src = new OnlyCollectionSource()
            {
                List = new List <string> {
                    "blah", "goo"
                }
            };
            var cfg = new DestinationConfiguration(typeof(MultiDestination));

            cfg.From(typeof(OnlyCollectionSource));
            var executable = cfg.ToExecutable(src.GetType());
            var mapper     = new DefaultMapCommand(executable, new TestContextualizer());
            var dest       = new MultiDestination()
            {
                Name = "ignore"
            };

            var output = (MultiDestination)mapper.From(src, dest);

            output.Name.should_be_equal_to("ignore");
            output.List.Count.should_be_equal_to(2);
            output.List[0].should_be_equal_to("blah");
            output.List[1].should_be_equal_to("goo");
        }
Exemplo n.º 2
0
        public void it_can_map_to_instance()
        {
            var src = new OnlyCollectionSource() { List = new List<string> { "blah", "goo" } };
            var cfg = new DestinationConfiguration(typeof(MultiDestination));
            cfg.From(typeof (OnlyCollectionSource));
            var executable = cfg.ToExecutable(src.GetType());
            var mapper = new DefaultMapCommand(executable, new TestContextualizer());
            var dest = new MultiDestination(){Name = "ignore"};

            var output = (MultiDestination)mapper.From(src, dest);
            output.Name.should_be_equal_to("ignore");
            output.List.Count.should_be_equal_to(2);
            output.List[0].should_be_equal_to("blah");
            output.List[1].should_be_equal_to("goo");
        }