50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using Sdt.Config;
|
|
using Sdt.Core;
|
|
using Xunit;
|
|
|
|
namespace DevTool.Tests;
|
|
|
|
public sealed class SetupWizardConfigServiceTests
|
|
{
|
|
[Fact]
|
|
public void ApplyRecommendedDefaults_AddsEnvProfilesAndToolingAndDiagnostics()
|
|
{
|
|
var config = new DevToolConfig
|
|
{
|
|
Workflows =
|
|
[
|
|
new WorkflowDefinition
|
|
{
|
|
Id = "build",
|
|
Label = "Build",
|
|
Steps =
|
|
[
|
|
new WorkflowStep
|
|
{
|
|
Id = "s1",
|
|
Label = "S1",
|
|
Action = "dotnet-build"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
Tooling = null,
|
|
EnvProfiles = null,
|
|
Debug = null,
|
|
Env = []
|
|
};
|
|
|
|
var service = new SetupWizardConfigService(new RequirementResolver());
|
|
var result = service.ApplyRecommendedDefaults(config);
|
|
|
|
Assert.NotEmpty(result.Changes);
|
|
Assert.NotNull(result.Config.EnvProfiles);
|
|
Assert.Contains(result.Config.EnvProfiles!.Profiles, p => p.Id == "dev");
|
|
Assert.NotNull(result.Config.Tooling);
|
|
Assert.Contains(result.Config.Tooling!.Tools, t => t.Tool == "dotnet");
|
|
Assert.NotNull(result.Config.Debug);
|
|
Assert.True(result.Config.Debug!.Diagnostics.RedactSensitive);
|
|
Assert.Contains(result.Config.Env, e => e.Key == "SDT_ENV_PROFILE");
|
|
}
|
|
}
|