public void SerializeTheSameAsSqlServer(decimal plaintext, byte precision, byte scale) { SqlNumericSerializer serializer = new SqlNumericSerializer(precision, scale); byte[] serializedPlaintext = serializer.Serialize(plaintext); byte[] expectedCiphertext = deterministicEncryptionAlgorithm.Encrypt(serializedPlaintext); Database.Insert(new SqlParameter("@parameter", SqlDbType.Decimal) { Value = plaintext, Precision = precision, Scale = scale }); byte[] actualCiphertext = Database.SelectCiphertext(SqlDbType.Decimal); Assert.Equal(expectedCiphertext, actualCiphertext); }
public void ThrowWhenValueOutOfRange(decimal plaintext, byte precision, byte scale) { SqlNumericSerializer serializer = new SqlNumericSerializer(precision, scale); Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Serialize(plaintext)); }