Exemple #1
0
        public void ReturnNullIfDeserializingNull()
        {
            Serializer <byte[]> serializer = new SqlVarbinarySerializer();

            byte[] actualDeserializedValue = serializer.Deserialize(null);

            Assert.Null(actualDeserializedValue);
        }
Exemple #2
0
        public void DeserializeTheSameAsSqlServer(byte[] plaintext, int size)
        {
            Database.Insert(new SqlParameter("@parameter", SqlDbType.VarBinary, size)
            {
                Value = plaintext
            });
            byte[] ciphertextBytes            = Database.SelectCiphertext(SqlDbType.VarBinary);
            byte[] plaintextBytes             = deterministicEncryptionAlgorithm.Decrypt(ciphertextBytes);
            SqlVarbinarySerializer serializer = new SqlVarbinarySerializer(size);

            byte[] expectedPlaintext = serializer.Deserialize(plaintextBytes);
            byte[] actualPlaintext   = (byte[])Database.SelectPlaintext(SqlDbType.VarBinary);

            Assert.Equal(expectedPlaintext, actualPlaintext);
        }