public void TestEnumerableBinary() { EnumParentStandardWrapper obj = new EnumParentStandardWrapper(); Assert.True(Program.CheckBytes(obj, 0x0A, 0x0A, // field 1: obj, 10 bytes 0x08, 0x01, // field 1: variant, 1 0x08, 0x02, // field 1: variant, 2 0x08, 0x03, // field 1: variant, 3 0x08, 0x04, // field 1: variant, 4 0x08, 0x05)); // field 1: variant, 5 }
public void TestEnumerableStandard() { EnumParentStandardWrapper obj = new EnumParentStandardWrapper(); EnumParentStandardWrapper clone = Serializer.DeepClone(obj); // old: the source object should have been read twice // old: once to get the length-prefix, and once for the data // update: once only with buffering Assert.AreEqual(1, obj.Wrapper.SubData.IteratorCount, "obj IteratorCount"); Assert.AreEqual(0, obj.Wrapper.SubData.Count, "obj Count"); Assert.AreEqual(0, obj.Wrapper.SubData.Sum, "obj Sum"); // the destination object should never have been read, but should have // had 5 values added Assert.AreEqual(0, clone.Wrapper.SubData.IteratorCount, "clone IteratorCount"); Assert.AreEqual(5, clone.Wrapper.SubData.Count, "clone Count"); Assert.AreEqual(1 + 2 + 3 + 4 + 5, clone.Wrapper.SubData.Sum, "clone Sum"); }