public void ReturnNullIfDeserializingNull() { Serializer <double?> serializer = new SqlNullableFloatSerializer(); double?actualDeserializedValue = serializer.Deserialize(null); Assert.Null(actualDeserializedValue); }
public void DeserializeTheSameAsSqlServer(double?plaintext) { Database.Insert(new SqlParameter("@parameter", SqlDbType.Float) { Value = plaintext }); byte[] ciphertextBytes = Database.SelectCiphertext(SqlDbType.Float); byte[] plaintextBytes = deterministicEncryptionAlgorithm.Decrypt(ciphertextBytes); Serializer <double?> serializer = new SqlNullableFloatSerializer(); double?expectedPlaintext = serializer.Deserialize(plaintextBytes); double?actualPlaintext = (double?)Database.SelectPlaintext(SqlDbType.Float); Assert.Equal(expectedPlaintext, actualPlaintext); }
public void ShouldThrowIfDeserializingLessThanEightBytes(byte[] data) { Serializer <double?> serializer = new SqlNullableFloatSerializer(); Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Deserialize(data)); }