public void Initialize() { relativeFilePath = S3TestUtils.GetFileHelper("PutObjectFile.txt"); using (StreamWriter writer = File.CreateText(relativeFilePath)) { writer.Write("This is some sample text.!!"); writer.Close(); } bucketName = "unity-test-bucket" + DateTime.Now.Ticks; AutoResetEvent ars = new AutoResetEvent(false); Exception exception = null; Client.PutBucketAsync(bucketName, (result) => { if (result.Exception != null) { exception = result.Exception; } ars.Set(); }); ars.WaitOne(); if (exception != null) { throw exception; } }
public void SimplePathPostObjectTest() { AutoResetEvent ars = new AutoResetEvent(false); Exception responseException = new Exception(); string fileName = string.Format(FileNameFormat, DateTime.Now.Ticks); string filePath = S3TestUtils.GetFileHelper(fileName); Client.PostObjectAsync(new PostObjectRequest() { Key = fileName, Bucket = BucketName, Path = filePath, CannedACL = S3CannedACL.Private }, (response) => { responseException = response.Exception; ars.Set(); }, new AsyncOptions { ExecuteCallbackOnMainThread = true }); ars.WaitOne(); Assert.IsNull(responseException); }