public void ReturnNullIfDeserializingNull() { SqlCharSerializer serializer = new SqlCharSerializer(); string actualDeserializedValue = serializer.Deserialize(null); Assert.Null(actualDeserializedValue); }
public void DeserializeTheSameAsSqlServer(string plaintext, int size, int codepage) { Database.Insert(new SqlParameter("@parameter", SqlDbType.Char, size) { Value = plaintext }); byte[] ciphertextBytes = Database.SelectCiphertext(SqlDbType.Char); byte[] plaintextBytes = deterministicEncryptionAlgorithm.Decrypt(ciphertextBytes); SqlCharSerializer serializer = new SqlCharSerializer(size, codepage); string expectedPlaintext = serializer.Deserialize(plaintextBytes); string actualPlaintext = (string)Database.SelectPlaintext(SqlDbType.Char); Assert.Equal(expectedPlaintext, actualPlaintext); }