diff --git a/GitHubActionsTestLogger.Tests/InitializationSpecs.cs b/GitHubActionsTestLogger.Tests/InitializationSpecs.cs index dc5591d..9f5f05e 100644 --- a/GitHubActionsTestLogger.Tests/InitializationSpecs.cs +++ b/GitHubActionsTestLogger.Tests/InitializationSpecs.cs @@ -20,7 +20,22 @@ public void I_can_use_the_logger_with_the_default_configuration() // Assert logger.Context.Should().NotBeNull(); - logger.Context?.Options.Should().Be(TestLoggerOptions.Default); + logger.Context?.Options.Should().BeEquivalentTo(TestLoggerOptions.Default); + } + + [Fact] + public void I_can_use_the_logger_with_an_empty_configuration() + { + // Arrange + var logger = new TestLogger(); + var events = new FakeTestLoggerEvents(); + + // Act + logger.Initialize(events, new Dictionary()); + + // Assert + logger.Context.Should().NotBeNull(); + logger.Context?.Options.Should().BeEquivalentTo(TestLoggerOptions.Default); } [Fact] @@ -35,7 +50,8 @@ public void I_can_use_the_logger_with_a_custom_configuration() ["annotations.titleFormat"] = "TitleFormat", ["annotations.messageFormat"] = "MessageFormat", ["summary.includePassedTests"] = "true", - ["summary.includeSkippedTests"] = "true" + ["summary.includeSkippedTests"] = "true", + ["summary.includeNotFoundTests"] = "true" }; // Act @@ -47,5 +63,6 @@ public void I_can_use_the_logger_with_a_custom_configuration() logger.Context?.Options.AnnotationMessageFormat.Should().Be("MessageFormat"); logger.Context?.Options.SummaryIncludePassedTests.Should().BeTrue(); logger.Context?.Options.SummaryIncludeSkippedTests.Should().BeTrue(); + logger.Context?.Options.SummaryIncludeNotFoundTests.Should().BeTrue(); } } diff --git a/GitHubActionsTestLogger/TestLoggerOptions.cs b/GitHubActionsTestLogger/TestLoggerOptions.cs index 2758afd..f2b4f79 100644 --- a/GitHubActionsTestLogger/TestLoggerOptions.cs +++ b/GitHubActionsTestLogger/TestLoggerOptions.cs @@ -37,6 +37,6 @@ public static TestLoggerOptions Resolve(IReadOnlyDictionary par ?? Default.SummaryIncludeSkippedTests, SummaryIncludeNotFoundTests = parameters.GetValueOrDefault("summary.includeNotFoundTests")?.Pipe(bool.Parse) - ?? Default.SummaryIncludeSkippedTests + ?? Default.SummaryIncludeNotFoundTests }; } diff --git a/GitHubActionsTestLogger/TestRunStatistics.cs b/GitHubActionsTestLogger/TestRunStatistics.cs index 8c9fcd2..df408c1 100644 --- a/GitHubActionsTestLogger/TestRunStatistics.cs +++ b/GitHubActionsTestLogger/TestRunStatistics.cs @@ -11,23 +11,13 @@ internal record TestRunStatistics( TimeSpan OverallDuration ) { - public TestOutcome OverallOutcome - { - get + public TestOutcome OverallOutcome { get; } = + true switch { - if (FailedTestCount > 0) - return TestOutcome.Failed; - - if (PassedTestCount > 0) - return TestOutcome.Passed; - - if (SkippedTestCount > 0) - return TestOutcome.Skipped; - - if (TotalTestCount == 0) - return TestOutcome.NotFound; - - return TestOutcome.None; - } - } + _ when FailedTestCount > 0 => TestOutcome.Failed, + _ when PassedTestCount > 0 => TestOutcome.Passed, + _ when SkippedTestCount > 0 => TestOutcome.Skipped, + _ when TotalTestCount == 0 => TestOutcome.NotFound, + _ => TestOutcome.None + }; }