Ejemplo n.º 1
0
        public void ReturnNullIfDeserializingNull()
        {
            Serializer <string> serializer = new SqlNcharSerializer();
            string actualDeserializedValue = serializer.Deserialize(null);

            Assert.Null(actualDeserializedValue);
        }
Ejemplo n.º 2
0
        public void DeserializeTheSameAsSqlServer(string plaintext, int size)
        {
            Database.Insert(new SqlParameter("@parameter", SqlDbType.NChar, size)
            {
                Value = plaintext
            });
            byte[] ciphertextBytes         = Database.SelectCiphertext(SqlDbType.NChar);
            byte[] plaintextBytes          = deterministicEncryptionAlgorithm.Decrypt(ciphertextBytes);
            Serializer <string> serializer = new SqlNcharSerializer(size);
            string expectedPlaintext       = serializer.Deserialize(plaintextBytes);
            string actualPlaintext         = (string)Database.SelectPlaintext(SqlDbType.NChar);

            Assert.Equal(expectedPlaintext, actualPlaintext);
        }