Skip to content

Commit 1aca674

Browse files
committed
Test that TestContainerDiscoverer logs coverage starting with run number
1 parent e2a8eb3 commit 1aca674

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

FineCodeCoverageTests/TestContainerDiscovery_Tests.cs

+37-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
using Microsoft.VisualStudio.TestWindow.Extensibility;
1414
using Moq;
1515
using NUnit.Framework;
16-
using FineCodeCoverage.Output;
1716

1817
namespace Test
1918
{
20-
2119
internal class TestOperationStateInvocationManager_Tests
2220
{
2321
private AutoMoqer mocker;
@@ -428,5 +426,42 @@ public void Should_MsCodeCoverageRunSettingsService_TestExecutionNotFinishedAsyn
428426
mockMsCodeCoverageRunSettingsService.Verify(msCodeCoverageRunSettingsService => msCodeCoverageRunSettingsService.TestExecutionNotFinishedAsync(mockTestOperation.Object));
429427

430428
}
429+
430+
[Test]
431+
public void Should_Log_Coverage_Starting_With_Run_Number_When_TestExecutionStartingAsync_And_Coverage_Not_Disabled()
432+
{
433+
SetUpOptions(mockAppOptions =>
434+
{
435+
mockAppOptions.Setup(o => o.Enabled).Returns(true);
436+
});
437+
438+
var operation = new Mock<IOperation>().Object;
439+
RaiseTestExecutionStarting(operation);
440+
441+
mocker.Verify<FineCodeCoverage.Output.ILogger>(
442+
logger => logger.Log("================================== COVERAGE STARTING - 1 =================================="));
443+
444+
RaiseTestExecutionStarting(operation);
445+
446+
mocker.Verify<FineCodeCoverage.Output.ILogger>(
447+
logger => logger.Log("================================== COVERAGE STARTING - 2 =================================="));
448+
}
449+
450+
[Test]
451+
public void Should_Not_Log_Coverage_Starting_When_Coverage_Disabled()
452+
{
453+
SetUpOptions(mockAppOptions =>
454+
{
455+
mockAppOptions.Setup(o => o.Enabled).Returns(false);
456+
mockAppOptions.Setup(o => o.DisabledNoCoverage).Returns(true);
457+
});
458+
459+
var operation = new Mock<IOperation>().Object;
460+
RaiseTestExecutionStarting(operation);
461+
462+
mocker.Verify<FineCodeCoverage.Output.ILogger>(
463+
logger => logger.Log("================================== COVERAGE STARTING - 1 =================================="), Times.Never());
464+
465+
}
431466
}
432467
}

0 commit comments

Comments
 (0)