public void ReturnNullIfSerializingNull() { Serializer <decimal?> serializer = new SqlNullableMoneySerializer(); byte[] actualSerializedValue = serializer.Serialize(null); Assert.Null(actualSerializedValue); }
public void SerializeTheSameAsSqlServer(decimal?plaintext) { Serializer <decimal?> serializer = new SqlNullableMoneySerializer(); byte[] serializedPlaintext = serializer.Serialize(plaintext); byte[] expectedCiphertext = deterministicEncryptionAlgorithm.Encrypt(serializedPlaintext); Database.Insert(new SqlParameter("@parameter", SqlDbType.Money) { Value = plaintext }); byte[] actualCiphertext = Database.SelectCiphertext(SqlDbType.Money); Assert.Equal(expectedCiphertext, actualCiphertext); }
public void ThrowWhenValueOutOfRange(decimal?plaintext) { Serializer <decimal?> serializer = new SqlNullableMoneySerializer(); Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Serialize(plaintext)); }