Esempio n. 1
0
 public void PGPDecrypt_DecryptFile_EmptyKeyInStream_ThrowsException()
 {
     try
     {
         using (Stream input = PSS_PGPEncrypt.StringToStream("TEST"), keyIn = null)
         {
             PSS_PGPDecrypt.DecryptFileAndOutputToFile(input, keyIn, string.Empty);
         }
     }
     catch (Exception e)
     {
         Assert.IsTrue(e is ArgumentNullException);
     }
 }
Esempio n. 2
0
        public void PGPEncrypt_StringToStream_StreamToStream_Works()
        {
            var       testString = "Did I live?";
            const int numRuns    = 30;

            var listOResults = new List <string>();

            for (var i = 0; i < numRuns; i++)
            {
                using (var streamTest = PSS_PGPEncrypt.StringToStream(i > 0?listOResults[i - 1]:testString))
                {
                    listOResults.Add(PSS_PGPEncrypt.StreamToString(streamTest));

                    Assert.IsTrue(testString.Equals(listOResults[i]),
                                  "String to Stream Should have produced the same string as the starting one and did not!!!");
                }
            }

            Assert.AreEqual(numRuns, listOResults.Count, "The number of successful executions should match the number of runs and did not!!!");
        }