Esempio n. 1
0
        public void DeserializeTheSameAsSqlServer(long plaintext)
        {
            Database.Insert(new SqlParameter("@parameter", SqlDbType.BigInt)
            {
                Value = plaintext
            });
            byte[] ciphertextBytes         = Database.SelectCiphertext(SqlDbType.BigInt);
            byte[] plaintextBytes          = deterministicEncryptionAlgorithm.Decrypt(ciphertextBytes);
            SqlBigintSerializer serializer = new SqlBigintSerializer();
            long expectedPlaintext         = serializer.Deserialize(plaintextBytes);
            long actualPlaintext           = (long)Database.SelectPlaintext(SqlDbType.BigInt);

            Assert.Equal(expectedPlaintext, actualPlaintext);
        }
Esempio n. 2
0
        public void ShouldThrowIfDeserializingLessThanEightBytes(byte[] data)
        {
            SqlBigintSerializer serializer = new SqlBigintSerializer();

            Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Deserialize(data));
        }
Esempio n. 3
0
        public void ShouldThrowIfDeserializingNull()
        {
            SqlBigintSerializer serializer = new SqlBigintSerializer();

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