public void SendFileAsyncShouldInvokeSendFileCompletedIfRegistered() { var filename = Path.Combine(AppContext.BaseDirectory, "filename.txt"); File.WriteAllText(filename, string.Empty); var guid = Guid.NewGuid(); var sessionId = new SessionId(guid); var context = new DataCollectionContext(sessionId); var fileTransferInfo = new FileTransferInformation(context, filename, false); var attachmentManager = new DataCollectionAttachmentManager(); attachmentManager.Initialize(sessionId, AppContext.BaseDirectory, new Mock <IMessageSink>().Object); this.dataCollectionSink = new TestPlatformDataCollectionSink(attachmentManager, this.dataCollectorConfig); this.dataCollectionSink.SendFileCompleted += SendFileCompleted_Handler; this.dataCollectionSink.SendFileAsync(fileTransferInfo); var result = attachmentManager.GetAttachments(context); Assert.IsNotNull(result); Assert.IsTrue(this.isEventHandlerInvoked); }
public DataCollectionAttachmentManagerTests() { this.attachmentManager = new DataCollectionAttachmentManager(); this.messageSink = new Mock <IMessageSink>(); var guid = Guid.NewGuid(); this.sessionId = new SessionId(guid); }