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
74 changes: 37 additions & 37 deletions NetTools.Tests/Commands/RemoveCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public void Constructor_AddsRequiredOptions()
_command.Options.Count.ShouldBe(4);

var optionNames = _command.Options.Select(static o => o.Name).ToList();
optionNames.ShouldContain("clean");
optionNames.ShouldContain("restore");
optionNames.ShouldContain("build");
optionNames.ShouldContain("verbose");
optionNames.ShouldContain("--clean");
optionNames.ShouldContain("--restore");
optionNames.ShouldContain("--build");
optionNames.ShouldContain("--verbose");
}

[Fact]
Expand All @@ -76,12 +76,12 @@ public async Task Invoke_ValidPackageAndSolution_RemovesPackageFromSelectedProje
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -109,11 +109,11 @@ public async Task Invoke_NoProjectsSelected_DoesNotRemovePackages()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync([
var result = await rootCommand.Parse([
"rm",
PACKAGE_ID,
SOLUTION_FILE
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -146,12 +146,12 @@ public async Task Invoke_MultipleProjects_RemovesPackageFromAllSelected()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -182,13 +182,13 @@ public async Task Invoke_WithCleanOption_RunsDotnetCommandsWithClean()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE,
"--clean"
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -225,13 +225,13 @@ public async Task Invoke_WithRestoreOption_RunsDotnetCommandsWithRestore()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE,
"--restore"
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -268,13 +268,13 @@ public async Task Invoke_WithBuildOption_RunsDotnetCommandsWithBuild()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE,
"--build"
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -311,13 +311,13 @@ public async Task Invoke_WithVerboseOption_RunsDotnetCommandsWithVerbose()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE,
"--verbose"
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -354,16 +354,16 @@ public async Task Invoke_WithAllOptions_RunsDotnetCommandsWithAllFlags()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE,
"--clean",
"--restore",
"--build",
"--verbose"
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -400,13 +400,13 @@ public async Task Invoke_WithShortOptions_RunsDotnetCommandsCorrectly()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE,
"-c", "-r", "-b", "-v"
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -443,10 +443,10 @@ public async Task Invoke_WithNullSolutionFile_UsesPromptedSolution()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync([
var result = await rootCommand.Parse([
"rm",
PACKAGE_ID
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -484,12 +484,12 @@ public async Task Invoke_ChangesCurrentDirectoryToSolutionDirectory()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync
([
var result = await rootCommand.Parse(
[
"rm",
PACKAGE_ID,
SOLUTION_FILE
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -522,11 +522,11 @@ public async Task Invoke_UsesPredicateToFilterProjectsWithPackage()
var rootCommand = new RootCommand { _command };

// Act
var result = await rootCommand.InvokeAsync([
var result = await rootCommand.Parse([
"rm",
PACKAGE_ID,
SOLUTION_FILE
]);
]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down
30 changes: 15 additions & 15 deletions NetTools.Tests/Commands/StandardizeCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public StandardizeCommandTests()
_environment
);

_rootCommand.AddCommand(_command);
_rootCommand.Subcommands.Add(_command);
}

[Fact]
Expand All @@ -58,10 +58,10 @@ public void Constructor_AddsRequiredOptions()
_command.Options.Count.ShouldBe(4);

var optionNames = _command.Options.Select(static o => o.Name).ToList();
optionNames.ShouldContain("clean");
optionNames.ShouldContain("restore");
optionNames.ShouldContain("build");
optionNames.ShouldContain("verbose");
optionNames.ShouldContain("--clean");
optionNames.ShouldContain("--restore");
optionNames.ShouldContain("--build");
optionNames.ShouldContain("--verbose");
}

[Fact]
Expand All @@ -82,7 +82,7 @@ public async Task HandleAsync_NoProjectsSelected_DoNothing()
.Returns([]);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -110,7 +110,7 @@ public async Task HandleAsync_WithProjectsSelected_CallsStandardizer()
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -147,7 +147,7 @@ public async Task HandleAsync_WithCleanOption_PassesCleanToStandardizer()
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE, "--clean"]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE, "--clean"]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -184,7 +184,7 @@ public async Task HandleAsync_WithRestoreOption_PassesRestoreToStandardizer()
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE, "--restore"]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE, "--restore"]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -221,7 +221,7 @@ public async Task HandleAsync_WithBuildOption_PassesBuildToStandardizer()
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE, "--build"]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE, "--build"]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -258,7 +258,7 @@ public async Task HandleAsync_WithVerboseOption_PassesVerboseToStandardizer()
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE, "--verbose"]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE, "--verbose"]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -295,7 +295,7 @@ public async Task HandleAsync_WithAllOptions_PassesAllParametersCorrectly()
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE, "--clean", "--restore", "--build", "--verbose"]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE, "--clean", "--restore", "--build", "--verbose"]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -332,7 +332,7 @@ public async Task HandleAsync_WithShortOptions_PassesAllParametersCorrectly()
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE, "-c", "-r", "-b", "-v"]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE, "-c", "-r", "-b", "-v"]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -369,7 +369,7 @@ public async Task HandleAsync_WithNullSolutionFile_CallsGetOrPromptSolutionFile(
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st"]);
int result = await _rootCommand.Parse(["st"]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down Expand Up @@ -397,7 +397,7 @@ public async Task HandleAsync_MultipleProjects_PassesAllProjectsToStandardizer()
.Returns(projects);

// Act
int result = await _rootCommand.InvokeAsync(["st", SOLUTION_FILE]);
int result = await _rootCommand.Parse(["st", SOLUTION_FILE]).InvokeAsync();

// Assert
result.ShouldBe(0);
Expand Down
Loading