Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions GitHubActionsTestLogger.Tests/InitializationSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string?>());

// Assert
logger.Context.Should().NotBeNull();
logger.Context?.Options.Should().BeEquivalentTo(TestLoggerOptions.Default);
}

[Fact]
Expand All @@ -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
Expand All @@ -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();
}
}
2 changes: 1 addition & 1 deletion GitHubActionsTestLogger/TestLoggerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public static TestLoggerOptions Resolve(IReadOnlyDictionary<string, string?> par
?? Default.SummaryIncludeSkippedTests,
SummaryIncludeNotFoundTests =
parameters.GetValueOrDefault("summary.includeNotFoundTests")?.Pipe(bool.Parse)
?? Default.SummaryIncludeSkippedTests
?? Default.SummaryIncludeNotFoundTests
};
}
26 changes: 8 additions & 18 deletions GitHubActionsTestLogger/TestRunStatistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}