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