コード例 #1
0
        public void CompressTest()
        {
            var model = new TestModel();
            model.AddCustomer("Homer");
            model.AddCustomer("Bart");
            model.AddCustomer("Beavis");

            byte[] expected = new BinaryFormatter().ToByteArray(model);
            byte[] compressed = expected.Compress();
            Console.WriteLine("Bytes before: " + expected.Length + ", after: " + compressed.Length);
            byte[] actual = compressed.Decompress();
            Assert.IsTrue(expected.EqualsEx(actual));
        }