Example #1
0
        public void OpenGenericWithInterfaceTypeSerializes()
        {
            OpenGenericStayingOpenContainer x = new OpenGenericStayingOpenContainer()
            {
                ClosedGenericInterface = new OpenGeneric <IExampleChild>()
                {
                    MyT = new ExampleChild()
                    {
                        MyShort = 45
                    }
                }
            };
            var c = x.CloneLazinatorTyped();

            ((ExampleChild)c.ClosedGenericInterface.MyT).MyShort.Should().Be(45);

            x = new OpenGenericStayingOpenContainer()
            {
                ClosedGenericInterface = new OpenGeneric <IExampleChild>()
                {
                    MyT = new ExampleChildInherited()
                    {
                        MyShort = 45, MyInt = -75
                    }
                }
            };
            c = x.CloneLazinatorTyped();
            ((ExampleChildInherited)c.ClosedGenericInterface.MyT).MyShort.Should().Be(45);
            ((ExampleChildInherited)c.ClosedGenericInterface.MyT).MyInt.Should().Be(-75);
        }
Example #2
0
        public void OpenGenericWithConcreteTypeSerializes()
        {
            OpenGenericStayingOpenContainer x = new OpenGenericStayingOpenContainer()
            {
                ClosedGenericFloat = new OpenGeneric <WFloat>()
                {
                    MyT = new WFloat(3.4F)
                }
            };
            var c = x.CloneLazinatorTyped();

            c.ClosedGenericFloat.MyT.WrappedValue.Should().Be(3.4F);
        }
Example #3
0
        public void OpenGenericWithNonexclusiveInterfaceTypeSerializes()
        {
            OpenGenericStayingOpenContainer x = new OpenGenericStayingOpenContainer()
            {
                ClosedGenericNonexclusiveInterface = new OpenGeneric <IExampleNonexclusiveInterface>()
                {
                    MyT = new ExampleNonexclusiveInterfaceImplementer()
                    {
                        MyInt = 45
                    }
                }
            };
            var c = x.CloneLazinatorTyped();

            ((IExampleNonexclusiveInterface)c.ClosedGenericNonexclusiveInterface.MyT).MyInt.Should().Be(45);
            ((ExampleNonexclusiveInterfaceImplementer)c.ClosedGenericNonexclusiveInterface.MyT).MyInt.Should().Be(45);
        }
Example #4
0
        public void BuffersUpdateInTandem_OpenGeneric_Struct()
        {
            OpenGenericStayingOpenContainer e = new OpenGenericStayingOpenContainer();

            e.ClosedGenericFloat = new OpenGeneric <WFloat>()
            {
                MyT = 3.45F
            };
            e.ClosedGenericInterface = new OpenGeneric <IExampleChild>()
            {
                MyT = GetExampleChild(1)
            };
            e = e.CloneLazinatorTyped();
            ConfirmBuffersUpdateInTandem(e);
            e.ClosedGenericInterface.MyT.MyLong = 29; // make it dirty but leave child struct clean
            ConfirmBuffersUpdateInTandem(e);
        }
Example #5
0
        public void OpenGenericWithBaseTypeSerializes()
        {
            OpenGenericStayingOpenContainer x = new OpenGenericStayingOpenContainer()
            {
                ClosedGenericBase = new OpenGeneric <Base>()
                {
                    MyT = new Base()
                },
                ClosedGenericFromBaseWithBase = new GenericFromBase <Base>()
                {
                    MyT = new Base()
                }
            };
            var c = x.CloneLazinatorTyped();

            c.ClosedGenericBase.MyT.Should().NotBeNull();
            c.ClosedGenericFromBaseWithBase.MyT.Should().NotBeNull();
        }