dotnet / dotnet/command-line-api

Dry run mode so that tests can verify that the entry point hasn't been broken

Open
#1,670 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Updating from `beta1.20574.7` to `beta2.21617.1` caused the app to stop working because I hadn't seen https://github.com/dotnet/command-line-api/issues/1537:

```
Unhandled exception: System.ArgumentException: Service not found for type System.Uri.
```

I'd like to be able to write a unit test that passes a set of arguments to the app entry point and verifies that no such issue is incurred, but without actually invoking the handler. I thought of a `[dryrun]` directive. Maybe even cooler would be if this was possible in the test code:

```cs
object?[] handlerArguments = Handler.Verify(() => Program.Main(new[] { "arg1", "arg2" }));
// Assert that the arguments are as expected
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.