Exemplo n.º 1
0
        public void RoundTripEncryptNullGenericStringTest()
        {
            ICipherAsync target   = GetCipher();
            string       testText = null;

            var cryptoResult = target.Encrypt <string>(testText);

            Assert.IsNull(cryptoResult);

            target = GetCipher();

            var textResult = target.Decrypt <string>(cryptoResult);

            Assert.AreEqual(testText, textResult);
        }
Exemplo n.º 2
0
        public void RoundTripEncryptNullTypedStringTest()
        {
            ICipherAsync target   = GetCipher();
            string       testText = null;

            var cryptoResult = target.Encrypt(testText, typeof(string));

            Assert.IsNull(cryptoResult);

            target = GetCipher();

            var textResult = target.Decrypt(cryptoResult, typeof(string));

            Assert.AreEqual(testText, textResult);
        }
Exemplo n.º 3
0
        public void RoundTripEncryptStringTest()
        {
            ICipherAsync target   = GetCipher();
            var          testText = "test text";

            var cryptoResult = target.Encrypt(testText);

            Assert.IsNotNull(cryptoResult);
            Assert.IsTrue(cryptoResult.Length > testText.Length * 2);

            target = GetCipher();

            var textResult = target.DecryptString(cryptoResult);

            Assert.AreEqual(testText, textResult);
        }
Exemplo n.º 4
0
        public void RoundTripEncryptGenericEmptyStringTest()
        {
            ICipherAsync target   = GetCipher();
            var          testText = string.Empty;

            var cryptoResult = target.Encrypt <string>(testText);

            Assert.IsNotNull(cryptoResult);
            Assert.IsTrue(cryptoResult.Length > testText.Length * 2);

            target = GetCipher();

            var textResult = target.Decrypt <string>(cryptoResult);

            Assert.AreEqual(testText, textResult);
        }