public void ReturnNullIfSerializingNull()
        {
            Serializer <decimal?> serializer = new SqlNullableDecimalSerializer();

            byte[] actualSerializedValue = serializer.Serialize(null);

            Assert.Null(actualSerializedValue);
        }
        public void SerializeTheSameAsSqlServer(decimal?plaintext, byte precision, byte scale)
        {
            Serializer <decimal?> serializer = new SqlNullableDecimalSerializer(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)
        {
            Serializer <decimal?> serializer = new SqlNullableDecimalSerializer(precision, scale);

            Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Serialize(plaintext));
        }