Exemple #1
0
        public void ReturnNullIfSerializingNull()
        {
            SqlCharSerializer serializer = new SqlCharSerializer();

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

            Assert.Null(actualSerializedValue);
        }
Exemple #2
0
        public void SerializeTheSameAsSqlServer(string plaintext, int size, int codepage)
        {
            SqlCharSerializer serializer = new SqlCharSerializer(size, codepage);

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

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

            Assert.Equal(expectedCiphertext, actualCiphertext);
        }