/// <summary> /// Verifies that calling <see cref="CliCommand.Parse"/> and <see cref="CliCommand.Execute"/> causes a specific result. /// </summary> /// <param name="expectedOutput">The expected string for a <see cref="ITaskHandler.Output"/> call; <c>null</c> if none.</param> /// <param name="expectedExitCode">The expected exit status code returned by <see cref="CliCommand.Execute"/>.</param> /// <param name="expectedSelections">The expected value passed to <see cref="ICommandHandler.ShowSelections"/>.</param> /// <param name="args">The arguments to pass to <see cref="CliCommand.Parse"/>.</param> protected void RunAndAssert(string?expectedOutput, ExitCode expectedExitCode, Selections?expectedSelections, params string[] args) { RunAndAssert(expectedOutput, expectedExitCode, args); var selections = Handler.LastSelections; if (expectedSelections == null) { selections.Should().BeNull(); } else { selections !.InterfaceUri.Should().Be(expectedSelections.InterfaceUri); selections.Command.Should().Be(expectedSelections.Command); selections.Implementations.Should().Equal(expectedSelections.Implementations); } }