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);
            SqlNumericSerializer serializer = new SqlNumericSerializer(precision, scale);
            decimal expectedPlaintext       = serializer.Deserialize(plaintextBytes);
            decimal actualPlaintext         = (decimal)Database.SelectPlaintext(SqlDbType.Decimal);

            Assert.Equal(expectedPlaintext, actualPlaintext);
        }
        public void ShouldThrowIfDeserializingLessThanSeventeenBytes(byte[] data)
        {
            SqlNumericSerializer serializer = new SqlNumericSerializer();

            Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Deserialize(data));
        }
        public void ShouldThrowIfDeserializingNull()
        {
            SqlNumericSerializer serializer = new SqlNumericSerializer();

            Assert.Throws <ArgumentNullException>(() => serializer.Deserialize(null));
        }