Example #1
0
        public void ReturnNullIfSerializingNull()
        {
            Serializer <byte?> serializer = new SqlNullableTinyintSerializer();

            byte[] actualSerializedValue = serializer.Serialize(null);

            Assert.Null(actualSerializedValue);
        }
Example #2
0
        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);
        }