public void ReturnNullIfDeserializingNull()
        {
            Serializer <decimal?> serializer = new SqlNullableDecimalSerializer();
            decimal?actualDeserializedValue  = serializer.Deserialize(null);

            Assert.Null(actualDeserializedValue);
        }
        public void DeserializeTheSameAsSqlServer(decimal?plaintext, byte precision, byte scale)
        {
            Database.Insert(new SqlParameter("@parameter", SqlDbType.Decimal)
            {
                Value = plaintext, Precision = precision, Scale = scale
            });
            byte[] ciphertextBytes           = Database.SelectCiphertext(SqlDbType.Decimal);
            byte[] plaintextBytes            = deterministicEncryptionAlgorithm.Decrypt(ciphertextBytes);
            Serializer <decimal?> serializer = new SqlNullableDecimalSerializer(precision, scale);
            decimal?expectedPlaintext        = serializer.Deserialize(plaintextBytes);
            decimal?actualPlaintext          = (decimal?)Database.SelectPlaintext(SqlDbType.Decimal);

            Assert.Equal(expectedPlaintext, actualPlaintext);
        }
        public void ShouldThrowIfDeserializingLessThanSeventeenBytes(byte[] data)
        {
            Serializer <decimal?> serializer = new SqlNullableDecimalSerializer();

            Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Deserialize(data));
        }