Example #1
0
        public async Task TestRunManager_PublishMultipleRuns()
        {
            var logger     = new Mock <ITraceLogger>();
            var publisher  = new Mock <ITestRunPublisher>();
            var runManager = new TestRunManager(publisher.Object, logger.Object);
            var fakeRun    = new TestRun("mocha/1", 1)
            {
                TestRunSummary = new TestRunSummary
                {
                    TotalTests = 7
                }
            };

            publisher.SetupSequence(x => x.PublishAsync(It.IsAny <TestRun>())).Returns(Task.CompletedTask).Returns(Task.CompletedTask);

            RunTasks(runManager, fakeRun);
            await runManager.FinalizeAsync();

            publisher.Verify(x => x.PublishAsync(It.IsAny <TestRun>()), Times.Exactly(2));
        }
Example #2
0
        public async Task TestRunManager_PublishMultipleRuns()
        {
            var logger     = new Mock <ITraceLogger>();
            var publisher  = new Mock <ITestRunPublisher>();
            var telemetry  = new Mock <ITelemetryDataCollector>();
            var runManager = new TestRunManager(publisher.Object, logger.Object, telemetry.Object);
            var fakeRun    = new TestRun("mocha/1", "somename", 1)
            {
                TestRunSummary = new TestRunSummary
                {
                    TotalTests = 7
                }
            };

            publisher.SetupSequence(x => x.PublishAsync(It.IsAny <TestRun>())).Returns(Task.FromResult(GetFakePipelineTestRun(fakeRun, 1))).Returns(Task.FromResult(GetFakePipelineTestRun(fakeRun, 2)));

            RunTasks(runManager, fakeRun);
            await runManager.FinalizeAsync();

            publisher.Verify(x => x.PublishAsync(It.IsAny <TestRun>()), Times.Exactly(2));
        }