Пример #1
0
        public void SerializeTheSameAsSqlServer(DateTime plaintext)
        {
            SqlSmalldatetimeSerializer serializer = new SqlSmalldatetimeSerializer();

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

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

            Assert.Equal(expectedCiphertext, actualCiphertext);
        }
Пример #2
0
        public void ThrowWhenValueOutOfRange(DateTime plaintext)
        {
            SqlSmalldatetimeSerializer serializer = new SqlSmalldatetimeSerializer();

            Assert.Throws <ArgumentOutOfRangeException>(() => serializer.Serialize(plaintext));
        }