Skip to content

Commit f1f6f24

Browse files
committed
Break up GetIsActivated test cases for clarity
1 parent a6dc196 commit f1f6f24

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/System.CommandLine.Subsystems.Tests/ErrorReportingSubsystemTests.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ public void Report_when_no_errors_writes_nothing_to_console_hack()
4949
}
5050

5151
[Theory]
52-
[InlineData("-v", false)]
53-
[InlineData("-x", true)]
54-
[InlineData("", false)]
55-
public void GetIsActivated_tests(string input, bool result)
52+
[InlineData("-x")]
53+
[InlineData("-non_existant_option")]
54+
public void GetIsActivated_GivenInvalidInput_SubsystemIsActive(string input)
5655
{
5756
var rootCommand = new CliRootCommand {new CliOption<bool>("-v")};
5857
var configuration = new CliConfiguration(rootCommand);
@@ -63,6 +62,23 @@ public void GetIsActivated_tests(string input, bool result)
6362
var parseResult = CliParser.Parse(rootCommand, input, configuration);
6463
var isActive = Subsystem.GetIsActivated(errorSubsystem, parseResult);
6564

66-
isActive.Should().Be(result);
65+
isActive.Should().BeTrue();
66+
}
67+
68+
[Theory]
69+
[InlineData("-v")]
70+
[InlineData("")]
71+
public void GetIsActivated_GivenValidInput_SubsystemShouldNotBeActive(string input)
72+
{
73+
var rootCommand = new CliRootCommand { new CliOption<bool>("-v") };
74+
var configuration = new CliConfiguration(rootCommand);
75+
var errorSubsystem = new ErrorReportingSubsystem();
76+
IReadOnlyList<string> args = [""];
77+
Subsystem.Initialize(errorSubsystem, configuration, args);
78+
79+
var parseResult = CliParser.Parse(rootCommand, input, configuration);
80+
var isActive = Subsystem.GetIsActivated(errorSubsystem, parseResult);
81+
82+
isActive.Should().BeFalse();
6783
}
6884
}

0 commit comments

Comments
 (0)