SDT/tests/DevTool.Tests/CliParserTests.cs
stan44 d5a74be368 Add guided CLI workflows and config commands
- introduce `sdt` subcommands for run, debug, setup, env, favorite, and explain
- add project/workspace discovery plus config bootstrap and migration helpers
- expand tests for CLI parsing, project role detection, and headless flows
2026-03-29 22:22:48 -05:00

32 lines
1.0 KiB
C#

using Sdt.Cli;
using Xunit;
namespace DevTool.Tests;
public sealed class CliParserTests
{
[Fact]
public void Parse_SetupApply_RecognizesSubcommandAndFlags()
{
var invocation = CliParser.Parse(["setup", "apply", "--safe", "--json", "--project-root", "C:\\repo"]);
Assert.Equal("setup", invocation.Command);
Assert.Equal("apply", invocation.Subcommand);
Assert.True(invocation.HasOption("--safe"));
Assert.True(invocation.HasOption("--json"));
Assert.Equal("C:\\repo", invocation.GetOption("--project-root"));
}
[Fact]
public void Parse_Run_PreservesPositionalWorkflowSelector()
{
var invocation = CliParser.Parse(["run", "build-app", "--env-profile", "release"]);
Assert.Equal("run", invocation.Command);
Assert.Null(invocation.Subcommand);
Assert.Single(invocation.Positionals);
Assert.Equal("build-app", invocation.Positionals[0]);
Assert.Equal("release", invocation.GetOption("--env-profile"));
}
}