コード例 #1
0
        public void SubtypeTest()
        {
            var expected = new SubtypeClass {
                Field = new SubclassB {
                    SomethingForClassB = 33
                }, Field2 = new SubclassA()
            };
            var actual = Roundtrip(expected);

            Assert.Equal(SubclassType.B, actual.Subtype);
            Assert.IsAssignableFrom <SubclassB>(actual.Field);
        }
コード例 #2
0
        public void SubtypeTest()
        {
            var expected = new SubtypeClass {
                Field = new SubclassB {
                    SomethingForClassB = 33
                }, Field2 = new SubclassA()
            };
            var actual = Roundtrip(expected);

            Assert.AreEqual(SubclassType.B, actual.Subtype);
            Assert.IsTrue(actual.Field is SubclassB);
        }
コード例 #3
0
        public void SubSubtypeTest()
        {
            var expected = new SubtypeClass
            {
                Field = new SubSubclassC(3)
                {
                    SomeSuperStuff     = 1,
                    SomethingForClassB = 2
                },
                Field2 = new SubclassA()
            };
            var actual = Roundtrip(expected);

            Assert.Equal(SubclassType.C, actual.Subtype);
            Assert.IsAssignableFrom <SubSubclassC>(actual.Field);
            Assert.Equal(actual.Field.SomeSuperStuff, expected.Field.SomeSuperStuff);
            Assert.Equal(((SubSubclassC)actual.Field).SomethingForClassB,
                         ((SubSubclassC)expected.Field).SomethingForClassB);
            Assert.Equal(((SubSubclassC)actual.Field).SomethingForClassC,
                         ((SubSubclassC)expected.Field).SomethingForClassC);
        }
コード例 #4
0
        public void SubSubtypeTest()
        {
            var expected = new SubtypeClass
            {
                Field = new SubSubclassC(3)
                {
                    SomeSuperStuff     = 1,
                    SomethingForClassB = 2
                },
                Field2 = new SubclassA()
            };
            var actual = Roundtrip(expected);

            Assert.AreEqual(SubclassType.C, actual.Subtype);
            Assert.IsInstanceOfType(actual.Field, typeof(SubSubclassC));
            Assert.AreEqual(actual.Field.SomeSuperStuff, expected.Field.SomeSuperStuff);
            Assert.AreEqual(((SubSubclassC)actual.Field).SomethingForClassB,
                            ((SubSubclassC)expected.Field).SomethingForClassB);
            Assert.AreEqual(((SubSubclassC)actual.Field).SomethingForClassC,
                            ((SubSubclassC)expected.Field).SomethingForClassC);
        }
コード例 #5
0
        public void SubtypeTest()
        {
            var expected = new SubtypeClass {Field = new SubclassB{SomethingForClassB = 33}};
            var actual = Roundtrip(expected);

            Assert.AreEqual(SubclassType.B, actual.Subtype);
            Assert.IsInstanceOfType(actual.Field, typeof(SubclassB));
        }
コード例 #6
0
        public void SubSubtypeTest()
        {
            var expected = new SubtypeClass
            {
                Field = new SubSubclassC(3)
                {
                    SomeSuperStuff = 1,
                    SomethingForClassB = 2
                }
            };
            var actual = Roundtrip(expected);

            Assert.AreEqual(SubclassType.C, actual.Subtype);
            Assert.IsInstanceOfType(actual.Field, typeof(SubSubclassC));
            Assert.AreEqual(actual.Field.SomeSuperStuff, expected.Field.SomeSuperStuff);
            Assert.AreEqual(((SubSubclassC)actual.Field).SomethingForClassB, ((SubSubclassC)expected.Field).SomethingForClassB);
            Assert.AreEqual(((SubSubclassC)actual.Field).SomethingForClassC, ((SubSubclassC)expected.Field).SomethingForClassC);
        }