コード例 #1
0
        public void WhenSerializingNullObjectShouldReturnAnEmptyByteArray()
        {
            FakePoco fake = null;

            byte[] expected = new byte[] { };
            var    actual   = _protoBufferSerializer.Serialize(fake);

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void WhenSerializingValidObjectShouldDeserializeWithSuccessToTheSameTypeObject()
        {
            var expected = new FakePoco()
            {
                FakeString = "fake", FakeInt = 10
            };
            var serializedObject = _protoBufferSerializer.Serialize(expected);
            var actual           = _protoBufferSerializer.Deserialize <FakePoco>(serializedObject);

            Assert.IsType <FakePoco>(actual);
            Assert.Equal(expected.FakeString, actual.FakeString);
            Assert.Equal(expected.FakeInt, actual.FakeInt);
        }