public void DeserializeTheSameAsSqlServer(TimeSpan plaintext, byte scale)
        {
            Database.Insert(new SqlParameter("@parameter", SqlDbType.Time)
            {
                Value = plaintext, Scale = scale
            });
            byte[]            ciphertextBytes   = Database.SelectCiphertext(SqlDbType.Time);
            byte[]            plaintextBytes    = deterministicEncryptionAlgorithm.Decrypt(ciphertextBytes);
            SqlTimeSerializer serializer        = new SqlTimeSerializer(scale);
            TimeSpan          expectedPlaintext = serializer.Deserialize(plaintextBytes);
            TimeSpan          actualPlaintext   = (TimeSpan)Database.SelectPlaintext(SqlDbType.Time);

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

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

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