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

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

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

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