Example #1
0
        public void TestPackedIntArrayLayout()
        {
            EntityWithPackedInts item = new EntityWithPackedInts
            {
                ItemArray = new int[] { 1, 2, 3, 4, 5, 1000 }
            };

            item.ClearList();
            Assert.IsTrue(Program.CheckBytes(item, 0x1A, 07, 01, 02, 03, 04, 05, 0xE8, 07));

            var clone = Serializer.DeepClone(item);

            Assert.AreNotSame(item.ItemArray, clone.ItemArray);
            Assert.IsTrue(item.ItemArray.SequenceEqual(clone.ItemArray));
        }
Example #2
0
        public void TestPackedIntCustomLayout()
        {
            EntityWithPackedInts item = new EntityWithPackedInts
            {
                Custom = new CustomEnumerable {
                    1, 2, 3, 4, 5, 1000
                }
            };

            item.ClearList();
            Assert.IsTrue(Program.CheckBytes(item, 0x22, 07, 01, 02, 03, 04, 05, 0xE8, 07));

            var clone = Serializer.DeepClone(item);

            Assert.AreNotSame(item.Custom, clone.Custom);
            Assert.IsTrue(item.Custom.SequenceEqual(clone.Custom));
        }
Example #3
0
        public void TestPackedIntCustomLayout()
        {
            EntityWithPackedInts item = new EntityWithPackedInts
            {
                Custom = new CustomEnumerable {
                    1, 2, 3, 4, 5, 1000
                }
            };

            item.ClearList();
            RuntimeTypeModel.Default.Add <CustomEnumerable>();
            Program.CheckBytes(item, "22-07-01-02-03-04-05-E8-07");

            var clone = Serializer.DeepClone(item);

            Assert.NotSame(item.Custom, clone.Custom);
            Assert.True(item.Custom.SequenceEqual(clone.Custom));
        }