public void TriggerSendTestResultShouldDeleteTheAttachmentsFromCache() { this.mockDataCollectionTestCaseEventManager.Raise(x => x.TestResult += null, new TestResultEventArgs(this.testResult)); this.testResult = new VisualStudio.TestPlatform.ObjectModel.TestResult(this.testcase); this.mockDataCollectionTestCaseEventManager.Raise(x => x.TestResult += null, new TestResultEventArgs(this.testResult)); Assert.AreEqual(0, testResult.Attachments.Count); }
public void RaiseTestResultShouldNotFlushIfTestCaseEndWasNotCalledBefore() { var testResult = new VisualStudio.TestPlatform.ObjectModel.TestResult(this.testCase); this.dataCollectionTestCaseEventManager.RaiseTestResult(new TestResultEventArgs(testResult)); var allowFlush = testResult.GetPropertyValue <bool>(DataCollectionTestCaseEventManager.FlushResultTestResultPoperty, true); Assert.IsFalse(allowFlush, "TestResult must not be flushed"); }
public ProxyOutOfProcDataCollectionManagerTests() { this.mockDataCollectionTestCaseEventManager = new Mock <IDataCollectionTestCaseEventManager>(); this.mockDataCollectionTestCaseEventSender = new Mock <IDataCollectionTestCaseEventSender>(); this.proxyOutOfProcDataCollectionManager = new ProxyOutOfProcDataCollectionManager(this.mockDataCollectionTestCaseEventSender.Object, this.mockDataCollectionTestCaseEventManager.Object); var attachmentSet = new AttachmentSet(new Uri("my://datacollector"), "mydatacollector"); attachmentSet.Attachments.Add(new UriDataAttachment(new Uri("my://attachment.txt"), string.Empty)); this.attachmentSets = new Collection <AttachmentSet>(); attachmentSets.Add(attachmentSet); this.testcase = new TestCase(); testcase.Id = Guid.NewGuid(); this.mockDataCollectionTestCaseEventSender.Setup(x => x.SendTestCaseEnd(It.IsAny <TestCaseEndEventArgs>())).Returns(attachmentSets); this.mockDataCollectionTestCaseEventManager.Raise(x => x.TestCaseEnd += null, new TestCaseEndEventArgs(testcase, TestOutcome.Passed)); this.testResult = new VisualStudio.TestPlatform.ObjectModel.TestResult(testcase); }