コード例 #1
0
        public void RoundTripEncryptNullGenericStringTest()
        {
            ICipherTasks 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);
        }
コード例 #2
0
        public void RoundTripEncryptNullTypedStringTest()
        {
            ICipherTasks 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);
        }
コード例 #3
0
        public void RoundTripEncryptStringTest()
        {
            ICipherTasks 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);
        }
コード例 #4
0
        public void RoundTripEncryptGenericEmptyStringTest()
        {
            ICipherTasks 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);
        }