Beispiel #1
0
        public void it_should_resolve_from_array_to_list()
        {
            var resolver = new ListResolver(MappableProperty.For <SourceWithCollections>(s => s.ArrayOfIntegerComponents), integerComponentElementConfig, new Fasterflection());
            var source   = new SourceWithCollections()
            {
                ArrayOfIntegerComponents =
                    new[] { new IntegerSource {
                                AnInt = 1
                            }, new IntegerSource()
                            {
                                AnInt = 4
                            } }
            };


            var destination = new DestWithCollections();
            var result      = resolver.TryResolve(contextualizer.CreateContext(source, destination), MappableProperty.For <DestWithCollections>(its => its.ListOfIntegerComponents));

            result.Value.should_be_a_type_of <List <IntegerDest> >();
            ((List <IntegerDest>)result.Value)[0].AnInt.should_be_equal_to(1);
            ((List <IntegerDest>)result.Value)[1].AnInt.should_be_equal_to(4);
        }
 public ListResolverTest()
 {
     _testInstance = new TestListResolver(TEST_NAME, source => source.Int);
 }