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

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

            Assert.Null(actualSerializedValue);
        }
Ejemplo n.º 2
0
        public void SerializeTheSameAsSqlServer(string plaintext, int size)
        {
            Serializer <string> serializer = new SqlNcharSerializer(size);

            byte[] serializedPlaintext = serializer.Serialize(plaintext);
            byte[] expectedCiphertext  = deterministicEncryptionAlgorithm.Encrypt(serializedPlaintext);

            Database.Insert(new SqlParameter("@parameter", SqlDbType.NChar, size)
            {
                Value = plaintext
            });
            byte[] actualCiphertext = Database.SelectCiphertext(SqlDbType.NChar);

            Assert.Equal(expectedCiphertext, actualCiphertext);
        }