public void ReturnNullIfDeserializingNull() { Serializer <int?> serializer = new NullableInt32Serializer(); int?actualDeserializedValue = serializer.Deserialize(null); Assert.Null(actualDeserializedValue); }
public void SerializeAndDeserializeToTheSameObject(int?originalValue) { Serializer <int?> serializer = new NullableInt32Serializer(); byte[] serializedValue = serializer.Serialize(originalValue); int? deserializedValue = serializer.Deserialize(serializedValue); Assert.Equal(originalValue, deserializedValue); }
public void ThrowIfDeserializingLessThanFourBytes(byte[] data) { Serializer <int?> serializer = new NullableInt32Serializer(); Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Deserialize(data)); }