コード例 #1
0
        public void GZipSerializer_Deserialize_Null_Value_Returns_Null()
        {
            GZipSerializer sut = new GZipSerializer();

            object result = sut.Deserialize<object>(null);

            Assert.IsNull(result);
        }
コード例 #2
0
        public void GZipSerializer_Serialize_Deserialize_Returns_Same_Object()
        {
            SerializeTestClass serializeTestClass = new SerializeTestClass
            {
                IntProp = 5,
                StringProp = "Test",
                DateTimeProp = DateTime.Today
            };

            GZipSerializer sut = new GZipSerializer();

            byte[] serializedClass = sut.Serialize(serializeTestClass);
            SerializeTestClass result = sut.Deserialize<SerializeTestClass>(serializedClass);

            Assert.IsNotNull(serializedClass);
            Assert.IsNotNull(result);
            Assert.AreEqual(serializeTestClass.DateTimeProp, result.DateTimeProp);
            Assert.AreEqual(serializeTestClass.IntProp, result.IntProp);
            Assert.AreEqual(serializeTestClass.StringProp, result.StringProp);
        }