Skip to content

Commit

Permalink
Tyrrrz#13 - Fix tests - add stubs for FileSystem.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricel committed Mar 30, 2021
1 parent 3ffd059 commit 465726b
Show file tree
Hide file tree
Showing 18 changed files with 158 additions and 4 deletions.
7 changes: 5 additions & 2 deletions CliFx.Tests/ApplicationSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public async Task Application_can_be_created_with_minimal_configuration()
var app = new CliApplicationBuilder()
.AddCommandsFromThisAssembly()
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

var exitCode = await app.RunAsync(
Expand All @@ -40,8 +41,8 @@ public async Task Application_can_be_created_with_a_fully_customized_configurati
var app = new CliApplicationBuilder()
.AddCommand<NoOpCommand>()
.AddCommandsFrom(typeof(NoOpCommand).Assembly)
.AddCommands(new[] {typeof(NoOpCommand)})
.AddCommandsFrom(new[] {typeof(NoOpCommand).Assembly})
.AddCommands(new[] { typeof(NoOpCommand) })
.AddCommandsFrom(new[] { typeof(NoOpCommand).Assembly })
.AddCommandsFromThisAssembly()
.AllowDebugMode()
.AllowPreviewMode()
Expand All @@ -50,6 +51,7 @@ public async Task Application_can_be_created_with_a_fully_customized_configurati
.SetVersion("test")
.SetDescription("test")
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.UseTypeActivator(Activator.CreateInstance!)
.Build();

Expand All @@ -69,6 +71,7 @@ public async Task Application_configuration_fails_if_an_invalid_command_is_regis
var app = new CliApplicationBuilder()
.AddCommand(typeof(ApplicationSpecs))
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

var exitCode = await app.RunAsync(
Expand Down
1 change: 1 addition & 0 deletions CliFx.Tests/CancellationSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public async ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down
2 changes: 2 additions & 0 deletions CliFx.Tests/ConsoleSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -117,6 +118,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down
22 changes: 22 additions & 0 deletions CliFx.Tests/ConversionSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -76,6 +77,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -119,6 +121,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -160,6 +163,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -198,6 +202,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -236,6 +241,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -274,6 +280,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -312,6 +319,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -352,6 +360,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -395,6 +404,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -443,6 +453,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -491,6 +502,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -554,6 +566,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -601,6 +614,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -641,6 +655,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -685,6 +700,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -729,6 +745,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -773,6 +790,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -811,6 +829,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -847,6 +866,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -888,6 +908,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -932,6 +953,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down
1 change: 1 addition & 0 deletions CliFx.Tests/DirectivesSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.AllowPreviewMode()
.Build();

Expand Down
5 changes: 5 additions & 0 deletions CliFx.Tests/EnvironmentSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -85,6 +86,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -129,6 +131,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -174,6 +177,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -216,6 +220,7 @@ public ValueTask ExecuteAsync(IConsole console)
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down
5 changes: 5 additions & 0 deletions CliFx.Tests/ErrorReportingSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -72,6 +73,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -111,6 +113,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -146,6 +149,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.Build();

// Act
Expand Down Expand Up @@ -184,6 +188,7 @@ public class Command : ICommand
var application = new CliApplicationBuilder()
.AddCommand(commandType)
.UseConsole(FakeConsole)
.UseFileSystem(NullFileSystem)
.SetDescription("This will be in help text")
.Build();

Expand Down
Loading

0 comments on commit 465726b

Please sign in to comment.