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