Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubch1 committed Jun 22, 2020
1 parent e635ec5 commit 303cee8
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,18 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProperlySendProgressEven
new AttachmentSet(new Uri(uri2), "uri2_output")
};

var innerTaskCompletionSource = new TaskCompletionSource<object>();

int counter = 0;
mockEventsHandler.Setup(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny<MultiTestRunFinalizationProgressEventArgs>())).Callback(() =>
{
counter++;
if(counter == 6)
{
innerTaskCompletionSource.TrySetResult(null);
}
});

mockAttachmentHandler1.Setup(h => h.HandleDataCollectionAttachmentSets(It.IsAny<ICollection<AttachmentSet>>(), It.IsAny<IProgress<int>>(), It.IsAny<IMessageLogger>(), It.IsAny<CancellationToken>())).Returns((ICollection<AttachmentSet> i1, IProgress<int> progress, IMessageLogger logger, CancellationToken cancellation) =>
{
progress.Report(25);
Expand All @@ -555,6 +567,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProperlySendProgressEven
await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, CancellationToken.None);

// assert
await innerTaskCompletionSource.Task;
VerifyCompleteEvent(false, false, outputAttachments1[0], outputAttachments2[0]);
mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny<MultiTestRunFinalizationProgressEventArgs>()), Times.Exactly(6));
mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is<MultiTestRunFinalizationProgressEventArgs>(a => VerifyProgressArgsForTwoHandlers(a, 1, 25, uri1))));
Expand Down

0 comments on commit 303cee8

Please sign in to comment.