Skip to content

Commit bdcab5e

Browse files
Fixed some places Create should have been CreateEmpty
1 parent fd917c8 commit bdcab5e

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ namespace System.CommandLine.Subsystems.Tests
1010
public class PipelineTests
1111
{
1212
private static Pipeline GetTestPipeline(VersionSubsystem versionSubsystem)
13-
=> Pipeline.Create(version: versionSubsystem);
13+
{
14+
var pipeline = Pipeline.CreateEmpty();
15+
pipeline.Version = versionSubsystem;
16+
return pipeline;
17+
}
18+
1419
private static CliConfiguration GetNewTestConfiguration()
1520
=> new(new CliRootCommand { new CliOption<bool>("-x") }); // Add option expected by test data
1621

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class VersionFunctionalTests
1919
public void When_the_version_option_is_specified_then_the_version_is_written_to_standard_out()
2020
{
2121
var configuration = new CliConfiguration(new CliRootCommand());
22-
var pipeline = Pipeline.Create();
22+
var pipeline = Pipeline.CreateEmpty();
2323
var consoleHack = new ConsoleHack().RedirectToBuffer(true);
2424
pipeline.Version = new VersionSubsystem();
2525

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public void When_version_subsystem_is_used_the_version_option_is_added_to_the_ro
1717
new CliOption<bool>("-x") // add option that is expected for the test data used here
1818
};
1919
var configuration = new CliConfiguration(rootCommand);
20-
var pipeline = Pipeline.Create(version: new VersionSubsystem());
20+
var pipeline = Pipeline.CreateEmpty();
21+
pipeline.Version = new VersionSubsystem();
2122

2223
// Parse is used because directly calling Initialize would be unusual
2324
var result = pipeline.Parse(configuration, "");
@@ -95,7 +96,8 @@ public void Console_output_can_be_tested()
9596
public void Custom_version_subsystem_can_be_used()
9697
{
9798
var consoleHack = new ConsoleHack().RedirectToBuffer(true);
98-
var pipeline = Pipeline.Create(version: new AlternateSubsystems.AlternateVersion());
99+
var pipeline = Pipeline.CreateEmpty();
100+
pipeline.Version = new AlternateSubsystems.AlternateVersion();
99101

100102
pipeline.Execute(new CliConfiguration(new CliRootCommand()), "-v", consoleHack);
101103
consoleHack.GetBuffer().Trim().Should().Be($"***{Constants.version}***");
@@ -105,7 +107,8 @@ public void Custom_version_subsystem_can_be_used()
105107
public void Custom_version_subsystem_can_replace_standard()
106108
{
107109
var consoleHack = new ConsoleHack().RedirectToBuffer(true);
108-
var pipeline = Pipeline.Create(version: new AlternateSubsystems.AlternateVersion());
110+
var pipeline = Pipeline.CreateEmpty();
111+
pipeline.Version = new AlternateSubsystems.AlternateVersion();
109112

110113
pipeline.Execute(new CliConfiguration(new CliRootCommand()), "-v", consoleHack);
111114
consoleHack.GetBuffer().Trim().Should().Be($"***{Constants.version}***");

src/System.CommandLine.Subsystems/Subsystems/PipelineContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class PipelineContext(ParseResult? parseResult, string rawInput, Pipeline
77
{
88
public ParseResult? ParseResult { get; } = parseResult;
99
public string RawInput { get; } = rawInput;
10-
public Pipeline Pipeline { get; } = pipeline ?? Pipeline.Create();
10+
public Pipeline Pipeline { get; } = pipeline ?? Pipeline.CreateEmpty();
1111
public ConsoleHack ConsoleHack { get; } = consoleHack ?? new ConsoleHack();
1212

1313
public bool AlreadyHandled { get; set; }

0 commit comments

Comments
 (0)