public void ReturnNullIfSerializingNull() { Serializer <byte[]> serializer = new SqlBinarySerializer(); byte[] actualSerializedValue = serializer.Serialize(null); Assert.Null(actualSerializedValue); }
public void SerializeTheSameAsSqlServer(byte[] plaintext, int length) { Serializer <byte[]> serializer = new SqlBinarySerializer(length); byte[] serializedPlaintext = serializer.Serialize(plaintext); byte[] expectedCiphertext = deterministicEncryptionAlgorithm.Encrypt(serializedPlaintext); Database.Insert(new SqlParameter("@parameter", SqlDbType.Binary, length) { Value = plaintext }); byte[] actualCiphertext = Database.SelectCiphertext(SqlDbType.Binary); Assert.Equal(expectedCiphertext, actualCiphertext); }