Exemple #1
0
        public void ReturnNullIfDeserializingNull()
        {
            Serializer <string> serializer = new SqlNvarcharSerializer();
            string actualDeserializedValue = serializer.Deserialize(null);

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

            Assert.Equal(expectedPlaintext, actualPlaintext);
        }