public void Should_successfully_receive_transfer_amounts_when_passing_a_stream() { operationCompleted = false; gotProgress = false; try { var file = new FileInfo(Constants.StorageItemNamePdf); connection.CreateContainer(Constants.CONTAINER_NAME); var progressCallback = new Connection.ProgressCallback(callback); var operationCompleteCallback = new Connection.OperationCompleteCallback(operationCompletePDF); ((Connection)connection).OperationComplete += operationCompleteCallback; ((Connection)connection).AddProgressWatcher(progressCallback); connection.PutStorageItemAsync(Constants.CONTAINER_NAME, file.Open(FileMode.Open), file.Name); //Sleep to make sure we receive the message Thread.Sleep(3000); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); //Make sure to always clean up connection.DeleteStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemNamePdf); connection.DeleteContainer(Constants.CONTAINER_NAME); } }
/// <summary> /// Sets the content from a stream into the request. /// </summary> /// <param name="stream">The stream of content.</param> /// <param name="progress">The progress callback to report on the amount of data that's been uploaded.</param> public void SetContent(Stream stream, Connection.ProgressCallback progress) { this.ContentStream = stream; this.ContentLength = stream.Length; this.Progress = progress; this.ETag = StringifyMD5(new MD5CryptoServiceProvider().ComputeHash(ContentStream)); ContentStream.Seek(0, 0); }
public void Should_receive_progress_events_when_the_transfer_is_successful() { try { var progressCallback = new Connection.ProgressCallback(callback); var operationCompleteCallback = new Connection.OperationCompleteCallback(operationComplete); ((Connection)connection).OperationComplete += operationCompleteCallback; ((Connection)connection).AddProgressWatcher(progressCallback); connection.CreateContainer(Constants.CONTAINER_NAME); connection.PutStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName); connection.GetStorageItemAsync(Constants.CONTAINER_NAME, Constants.StorageItemName, Constants.StorageItemName); Thread.Sleep(3000); } catch (Exception) { connection.DeleteStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName); connection.DeleteContainer(Constants.CONTAINER_NAME); } }
public void Should_successfully_receive_transfer_amounts() { operationCompleted = false; gotProgress = false; try { connection.CreateContainer(Constants.CONTAINER_NAME); var progressCallback = new Connection.ProgressCallback(callback); var operationCompleteCallback = new Connection.OperationCompleteCallback(operationComplete); ((Connection)connection).OperationComplete += operationCompleteCallback; ((Connection)connection).AddProgressWatcher(progressCallback); connection.PutStorageItemAsync(Constants.CONTAINER_NAME, Constants.StorageItemName); //Sleep to make sure we receive the message Thread.Sleep(5000); } catch (Exception) { connection.DeleteStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName); connection.DeleteContainer(Constants.CONTAINER_NAME); } }
public void Should_successfully_receive_transfer_amounts_when_passing_a_stream() { operationCompleted = false; gotProgress = false; try { var file = new FileInfo(Constants.StorageItemNamePdf); connection.CreateContainer(Constants.CONTAINER_NAME); var progressCallback = new Connection.ProgressCallback(callback); var operationCompleteCallback = new Connection.OperationCompleteCallback(operationCompletePDF); ((Connection)connection).OperationComplete += operationCompleteCallback; ((Connection)connection).AddProgressWatcher(progressCallback); connection.PutStorageItemAsync(Constants.CONTAINER_NAME, file.Open(FileMode.Open), file.Name); //Sleep to make sure we receive the message Thread.Sleep(3000); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); //Make sure to always clean up connection.DeleteStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemNamePdf); connection.DeleteContainer(Constants.CONTAINER_NAME); } }
public void Should_successfully_receive_transfer_amounts() { operationCompleted = false; gotProgress = false; try { connection.CreateContainer(Constants.CONTAINER_NAME); var progressCallback = new Connection.ProgressCallback(callback); var operationCompleteCallback = new Connection.OperationCompleteCallback(operationComplete); ((Connection) connection).OperationComplete += operationCompleteCallback; ((Connection) connection).AddProgressWatcher(progressCallback); connection.PutStorageItemAsync(Constants.CONTAINER_NAME, Constants.StorageItemName); //Sleep to make sure we receive the message Thread.Sleep(5000); } catch (Exception) { connection.DeleteStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName); connection.DeleteContainer(Constants.CONTAINER_NAME); } }
public void Should_receive_progress_events_when_the_transfer_is_successful() { try { var progressCallback = new Connection.ProgressCallback(callback); var operationCompleteCallback = new Connection.OperationCompleteCallback(operationComplete); ((Connection)connection).OperationComplete += operationCompleteCallback; ((Connection)connection).AddProgressWatcher(progressCallback); connection.CreateContainer(Constants.CONTAINER_NAME); connection.PutStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName); connection.GetStorageItemAsync(Constants.CONTAINER_NAME, Constants.StorageItemName, Constants.StorageItemName); Thread.Sleep(3000); } catch (Exception) { connection.DeleteStorageItem(Constants.CONTAINER_NAME, Constants.StorageItemName); connection.DeleteContainer(Constants.CONTAINER_NAME); } }