コード例 #1
0
        public void Flattening()
        {
            var unflat = new Foo
            {
                Name = "foo",
                Foo1 = new Foo
                {
                    Name = "abc",
                    Foo2 = new Foo {
                        Foo1 = new Foo {
                            Name = "inner"
                        }
                    }
                },
                Foo2 = new Foo {
                    Name = "123", NameZype = "aaa"
                },
            };

            var flat = new FlatFoo();

            flat.InjectFrom <FlatLoopInjection>(unflat);

            flat.Foo2NameZype.IsEqualTo("aaa");
        }
コード例 #2
0
        public void GenericFlatTest()
        {
            var foo = new Foo { Foo1 = new Foo { Age = 18 } };
            var flat = new FlatFoo();

            flat.InjectFrom<IntToStringFlat>(foo);
            flat.Foo1Age.IsEqualTo("18");
        }
コード例 #3
0
        public void GenericFlatTest()
        {
            var foo = new Foo {
                Foo1 = new Foo {
                    Age = 18
                }
            };
            var flat = new FlatFoo();

            flat.InjectFrom <IntToStringFlat>(foo);
            flat.Foo1Age.IsEqualTo("18");
        }
コード例 #4
0
        public void ObjectFlatTest()
        {
            var unflat = (object)new
            {
                Parent = (object)new Foo
                {
                    b    = true,
                    Name = "v"
                }
            };

            var flat = new FlatFoo();

            flat.InjectFrom <FlatBoolToString>(unflat);
            flat.Parentb.IsEqualTo("True");
            flat.Bool.IsEqualTo(null);
        }
コード例 #5
0
        public void Flattening()
        {
            var unflat = new Foo
                             {
                                 Name = "foo",
                                 Foo1 = new Foo
                                            {
                                                Name = "abc",
                                                Foo2 = new Foo { Foo1 = new Foo { Name = "inner" } }
                                            },
                                 Foo2 = new Foo { Name = "123", NameZype = "aaa" },
                             };

            var flat = new FlatFoo();

            flat.InjectFrom<FlatLoopInjection>(unflat);

            flat.Foo2NameZype.IsEqualTo("aaa");
        }
コード例 #6
0
        public void GenericFlatTest()
        {
            var unflat = new Foo
            {
                Parent = new Foo
                {
                    _a   = "aaa",
                    a    = 23,
                    b    = true,
                    Name = "v"
                }
            };

            var flat = new FlatFoo();

            flat.InjectFrom <FlatBoolToString>(unflat);
            flat.Parentb.IsEqualTo("True");
            flat.Bool.IsEqualTo(null);
        }
コード例 #7
0
        public void FlatteningTest()
        {
            var unflat = new Foo
            {
                Parent = new Foo
                {
                    _a   = "aaa",
                    a    = 23,
                    b    = true,
                    Name = "v"
                }
            };

            var flat = new FlatFoo();

            flat.InjectFrom <FlatLoopInjection>(unflat);
            flat.Parent_a.IsEqualTo(unflat.Parent._a);
            flat.Parenta.IsEqualTo(unflat.Parent.a);
            flat.Parentb.IsEqualTo(null);
            flat.ParentName.IsEqualTo(unflat.Parent.Name);
            flat.ParentParentName.IsEqualTo(null);
            flat.oO.IsEqualTo(null);
            flat.d.IsEqualTo(null);
        }