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); }
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); }
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); }
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); }
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)); }
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); }