Tests.WorkAsyncTest.WorkWithImageFileExternalTestAsync C# (CSharp) Method

WorkWithImageFileExternalTestAsync() private method

private WorkWithImageFileExternalTestAsync ( ) : Task
return Task
		public async Task WorkWithImageFileExternalTestAsync()
		{
			var progressEncrypt = new Progress<StreamCryptorTaskAsyncProgress>();
			var progressDecrypt = new Progress<StreamCryptorTaskAsyncProgress>();
			progressEncrypt.ProgressChanged +=
				(s, e) => { Console.WriteLine("Encrypting: " + e.ProgressPercentage + "%\n"); };
			progressDecrypt.ProgressChanged +=
				(s, e) => { Console.WriteLine("Decrypting: " + e.ProgressPercentage + "%\n"); };
			var rawFile = Path.Combine(TestContext.CurrentContext.TestDirectory, "Testfiles", "MyAwesomeChipmunkKiller.jpg");
			var outputDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "Testfiles", "decrypted");

			const string privateKeyRecipient = "31d9040b00a170532929b37db0afcb989e4175f96e5f9667ee8cbf5706679a71";
			const string publicKeyRecipient = "6d0deec730700f9f60687a4e6e8755157ca22ea2f3815b9bf14b1fe9ae6a0b4d";

			const string privateKeySender = "da9e790389c2d94d165d60369e0945e3fe50451a55989b80b576ce69f08a24f1";
			const string publicKeySender = "385bb72a7e4ca582b4eb59a364516d885659e753d4b2230c2f03f2e495b21c42";

			Console.Write("Encrypting testfile . . .\n");
			var encryptedFile = await Cryptor.EncryptFileWithStreamAsync(
				Utilities.HexToBinary(privateKeySender),
				Utilities.HexToBinary(publicKeySender),
				Utilities.HexToBinary(publicKeyRecipient),
				rawFile, progressEncrypt, outputDirectory, ".whatever", true);

			Console.Write("Decrypting testfile (" + encryptedFile + ") . . .\n");
			var decryptedFile = await Cryptor.DecryptFileWithStreamAsync(
				Utilities.HexToBinary(privateKeyRecipient),
				Path.Combine(TestContext.CurrentContext.TestDirectory, outputDirectory, encryptedFile),
				outputDirectory, progressDecrypt);

			Console.Write("Get checksum of testfiles . . .\n");
			Assert.AreEqual(Utils.GetChecksum(rawFile),
				Utils.GetChecksum(Path.Combine(TestContext.CurrentContext.TestDirectory, outputDirectory, decryptedFile)));
			//clear garbage 
			File.Delete(Path.Combine(TestContext.CurrentContext.TestDirectory, outputDirectory, encryptedFile));
			File.Delete(Path.Combine(TestContext.CurrentContext.TestDirectory, outputDirectory, decryptedFile));
		}