private static void TestGet2(string key, string uploadedFile, AmazonS3EncryptionClient s3EncryptionClient) { GetObjectRequest getObjectRequest = new GetObjectRequest { BucketName = bucketName, Key = key }; var destinationFile = fileName + ".downloaded"; using (GetObjectResponse getObjectResponse = s3EncryptionClient.GetObject(getObjectRequest)) { getObjectResponse.WriteResponseStreamToFile(destinationFile); } var originalMd5 = HashFile(uploadedFile); var downloadedMd5 = HashFile(destinationFile); Assert.AreEqual(originalMd5, downloadedMd5); }
private static void TestGet(string key, string uploadedData, AmazonS3EncryptionClient s3EncryptionClient) { GetObjectRequest getObjectRequest = new GetObjectRequest { BucketName = bucketName, Key = key }; using (GetObjectResponse getObjectResponse = s3EncryptionClient.GetObject(getObjectRequest)) { using (var stream = getObjectResponse.ResponseStream) using (var reader = new StreamReader(stream)) { string data = reader.ReadToEnd(); Assert.AreEqual(uploadedData, data); } } }