コード例 #1
0
        public void ReturnNullIfDeserializingNull()
        {
            Serializer <int?> serializer = new NullableInt32Serializer();
            int?actualDeserializedValue  = serializer.Deserialize(null);

            Assert.Null(actualDeserializedValue);
        }
コード例 #2
0
        public void SerializeAndDeserializeToTheSameObject(int?originalValue)
        {
            Serializer <int?> serializer = new NullableInt32Serializer();

            byte[] serializedValue   = serializer.Serialize(originalValue);
            int?   deserializedValue = serializer.Deserialize(serializedValue);

            Assert.Equal(originalValue, deserializedValue);
        }
コード例 #3
0
        public void ThrowIfDeserializingLessThanFourBytes(byte[] data)
        {
            Serializer <int?> serializer = new NullableInt32Serializer();

            Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Deserialize(data));
        }