-
-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
4,312 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"src" | ||
], | ||
"sdk": { | ||
"version": "6.0.202", | ||
"version": "6.0.402", | ||
"rollForward": "latestFeature" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/Cake.Common.Tests/Fixtures/Tools/Command/CommandRunnerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using Cake.Common.Tools.Command; | ||
using Cake.Core.IO; | ||
using Cake.Testing.Fixtures; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.Command | ||
{ | ||
internal class CommandRunnerFixture : ToolFixture<CommandSettings> | ||
{ | ||
public ProcessArgumentBuilder Arguments { get; set; } | ||
|
||
public string ToolName | ||
{ | ||
get => Settings.ToolName; | ||
set => Settings.ToolName = value; | ||
} | ||
|
||
public ICollection<string> ToolExecutableNames | ||
{ | ||
get => Settings.ToolExecutableNames; | ||
set => Settings.ToolExecutableNames = value; | ||
} | ||
|
||
public CommandRunnerFixture() | ||
: base("dotnet.exe") | ||
{ | ||
Arguments = new ProcessArgumentBuilder(); | ||
Settings.ToolName = "dotnet"; | ||
Settings.ToolExecutableNames = new[] { "dotnet.exe", "dotnet" }; | ||
} | ||
|
||
protected override void RunTool() | ||
{ | ||
GetRunner().RunCommand(Arguments); | ||
} | ||
|
||
protected CommandRunner GetRunner() | ||
=> new CommandRunner( | ||
Settings, | ||
FileSystem, | ||
Environment, | ||
ProcessRunner, | ||
Tools); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Cake.Common.Tests/Fixtures/Tools/Command/CommandRunnerStandardErrorFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.Command | ||
{ | ||
internal class CommandRunnerStandardErrorFixture : CommandRunnerStandardOutputFixture | ||
{ | ||
public string StandardError { get; private set; } | ||
|
||
protected override void RunTool() | ||
{ | ||
ExitCode = GetRunner().RunCommand(Arguments, out var standardOutput, out var standardError); | ||
StandardOutput = standardOutput; | ||
StandardError = standardError; | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Cake.Common.Tests/Fixtures/Tools/Command/CommandRunnerStandardOutFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.Command | ||
{ | ||
internal class CommandRunnerStandardOutputFixture : CommandRunnerFixture | ||
{ | ||
public int ExitCode { get; protected set; } | ||
public string StandardOutput { get; protected set; } | ||
|
||
protected override void RunTool() | ||
{ | ||
ExitCode = GetRunner().RunCommand(Arguments, out var standardOutput); | ||
StandardOutput = standardOutput; | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/Cake.Common.Tests/Fixtures/Tools/Command/CommandRunnerStandardOutputFixtureExtentions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.Command | ||
{ | ||
internal static class CommandRunnerStandardOutputFixtureExtentions | ||
{ | ||
public static T GivenStandardOutput<T>(this T fixture, params string[] standardOutput) | ||
where T : CommandRunnerStandardOutputFixture | ||
{ | ||
fixture.ProcessRunner.Process.SetStandardOutput(standardOutput); | ||
return fixture; | ||
} | ||
|
||
public static T GivenStandardError<T>(this T fixture, params string[] standardError) | ||
where T : CommandRunnerStandardOutputFixture | ||
{ | ||
fixture.ProcessRunner.Process.SetStandardError(standardError); | ||
return fixture; | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ake.Common.Tests/Fixtures/Tools/DotNet/Workload/Install/DotNetWorkloadInstallerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using Cake.Common.Tools.DotNet.Workload.Install; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Workload.Install | ||
{ | ||
internal sealed class DotNetWorkloadInstallerFixture : DotNetFixture<DotNetWorkloadInstallSettings> | ||
{ | ||
public IEnumerable<string> WorkloadIds { get; set; } | ||
|
||
protected override void RunTool() | ||
{ | ||
var tool = new DotNetWorkloadInstaller(FileSystem, Environment, ProcessRunner, Tools); | ||
tool.Install(WorkloadIds, Settings); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Cake.Common.Tests/Fixtures/Tools/DotNet/Workload/List/DotNetWorkloadListerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using Cake.Common.Tools.DotNet.Workload.List; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Workload.List | ||
{ | ||
internal sealed class DotNetWorkloadListerFixture : DotNetFixture<DotNetWorkloadListSettings> | ||
{ | ||
public IEnumerable<DotNetWorkloadListItem> Workloads { get; set; } | ||
|
||
public void GivenInstalledWorkloadsResult() | ||
{ | ||
ProcessRunner.Process.SetStandardOutput(new string[] | ||
{ | ||
"Installed Workload Ids Manifest Version Installation Source", | ||
"--------------------------------------------------------------------------------------", | ||
"maui-ios 6.0.312/6.0.300 VS 17.3.32804.467, VS 17.4.32804.182", | ||
"maui-windows 6.0.312/6.0.300 VS 17.3.32804.467, VS 17.4.32804.182", | ||
"android 32.0.301/6.0.300 VS 17.3.32804.467, VS 17.4.32804.182", | ||
"", | ||
"Use `dotnet workload search` to find additional workloads to install." | ||
}); | ||
} | ||
|
||
public void GivenEmptyInstalledWorkloadsResult() | ||
{ | ||
ProcessRunner.Process.SetStandardOutput(new string[] | ||
{ | ||
"Installed Workload Ids Manifest Version Installation Source", | ||
"---------------------------------------------------------------------", | ||
"", | ||
"Use `dotnet workload search` to find additional workloads to install." | ||
}); | ||
} | ||
|
||
protected override void RunTool() | ||
{ | ||
var tool = new DotNetWorkloadLister(FileSystem, Environment, ProcessRunner, Tools); | ||
Workloads = tool.List(Settings); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Cake.Common.Tests/Fixtures/Tools/DotNet/Workload/Repair/DotNetWorkloadRepairerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Cake.Common.Tools.DotNet.Workload.Repair; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Workload.Repair | ||
{ | ||
internal sealed class DotNetWorkloadRepairerFixture : DotNetFixture<DotNetWorkloadRepairSettings> | ||
{ | ||
protected override void RunTool() | ||
{ | ||
var tool = new DotNetWorkloadRepairer(FileSystem, Environment, ProcessRunner, Tools); | ||
tool.Repair(Settings); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...Cake.Common.Tests/Fixtures/Tools/DotNet/Workload/Restore/DotNetWorkloadRestorerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Cake.Common.Tools.DotNet.Workload.Restore; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Workload.Restore | ||
{ | ||
internal sealed class DotNetWorkloadRestorerFixture : DotNetFixture<DotNetWorkloadRestoreSettings> | ||
{ | ||
public string Project { get; set; } | ||
|
||
protected override void RunTool() | ||
{ | ||
var tool = new DotNetWorkloadRestorer(FileSystem, Environment, ProcessRunner, Tools); | ||
tool.Restore(Project, Settings); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...Common.Tests/Fixtures/Tools/DotNet/Workload/Uninstall/DotNetWorkloadUninstallerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using Cake.Common.Tools.DotNet.Workload.Uninstall; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Workload.Uninstall | ||
{ | ||
internal sealed class DotNetWorkloadUninstallerFixture : DotNetFixture<DotNetWorkloadUninstallSettings> | ||
{ | ||
public IEnumerable<string> WorkloadIds { get; set; } | ||
|
||
protected override void RunTool() | ||
{ | ||
var tool = new DotNetWorkloadUninstaller(FileSystem, Environment, ProcessRunner, Tools); | ||
tool.Uninstall(WorkloadIds); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Cake.Common.Tests/Fixtures/Tools/DotNet/Workload/Update/DotNetWorkloadUpdaterFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Cake.Common.Tools.DotNet.Workload.Update; | ||
|
||
namespace Cake.Common.Tests.Fixtures.Tools.DotNet.Workload.Update | ||
{ | ||
internal sealed class DotNetWorkloadUpdaterFixture : DotNetFixture<DotNetWorkloadUpdateSettings> | ||
{ | ||
protected override void RunTool() | ||
{ | ||
var tool = new DotNetWorkloadUpdater(FileSystem, Environment, ProcessRunner, Tools); | ||
tool.Update(Settings); | ||
} | ||
} | ||
} |
Oops, something went wrong.