35 instantiations of CommandViewModel
Aspire.Dashboard (1)
ServiceClient\Partials.cs (1)
135
.Select(c => new
CommandViewModel
(c.Name, MapState(c.State), c.DisplayName, c.DisplayDescription, c.ConfirmationMessage, c.ArgumentInputs.ToImmutableArray(), c.IsHighlighted, c.IconName, MapIconVariant(c.IconVariant)))
Aspire.Dashboard.Components.Tests (24)
Controls\MissingParametersPanelTests.cs (1)
141
new
(CommandViewModel.SetParameterCommand, CommandViewModelState.Enabled, "Set", string.Empty, string.Empty, [input], isHighlighted: false, iconName: string.Empty, iconVariant: Microsoft.FluentUI.AspNetCore.Components.IconVariant.Regular);
Controls\ResourceDetailsTests.cs (3)
797
var setCommand = new
CommandViewModel
(
843
var setCommand = new
CommandViewModel
(
889
var setCommand = new
CommandViewModel
(
Controls\TerminalDisconnectedBannerTests.cs (1)
206
new
(name, state, name, string.Empty, string.Empty, [], false, "ArrowClockwise", IconVariant.Regular);
Controls\TerminalViewTests.cs (1)
624
commands: [new
CommandViewModel
(CommandViewModel.StartCommand, CommandViewModelState.Enabled,
Layout\ResourcesLayoutTests.cs (13)
636
static CommandViewModel Command(string name, CommandViewModelState state) =>
new
(name, state, name, "",
1544
var command = new
CommandViewModel
("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: iconName, iconVariant: IconVariant.Filled);
1586
var stop = new
CommandViewModel
("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
1587
var other = new
CommandViewModel
("custom", CommandViewModelState.Enabled, "Custom command", "", confirmationMessage: "", argumentInputs: [], isHighlighted: false, iconName: string.Empty, iconVariant: IconVariant.Regular);
1617
new
(CommandViewModel.StopCommand, state, "Stop", "", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "", iconVariant: IconVariant.Regular);
1626
new
CommandViewModel
(CommandViewModel.SetParameterCommand, CommandViewModelState.Enabled, "Set parameter", "",
1673
var command = new
CommandViewModel
("refresh", CommandViewModelState.Enabled, "Refresh", "",
1712
var stop = new
CommandViewModel
("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
1747
new
(name, state, name, "", confirmationMessage: "", argumentInputs: [], isHighlighted: highlighted, iconName: "", iconVariant: IconVariant.Regular);
1784
new
(name, state, name, "", confirmationMessage: "", argumentInputs: [], isHighlighted: highlighted, iconName: "", iconVariant: IconVariant.Regular);
1835
new
(name, state, displayName, "", confirmationMessage: "", argumentInputs: [], isHighlighted: highlighted, iconName: "Key", iconVariant: IconVariant.Regular);
1891
new
(name, state, name, "", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "", iconVariant: IconVariant.Regular);
2012
var stop = new
CommandViewModel
("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
Model\DashboardCommandExecutorTests.cs (1)
79
var command = new
CommandViewModel
(
Pages\ConsoleLogsTests.cs (3)
839
commands: [new
CommandViewModel
("test-name", CommandViewModelState.Enabled, "test-displayname", "test-displaydescription", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: string.Empty, iconVariant: IconVariant.Regular)]);
904
new
CommandViewModel
(
948
commands: [new
CommandViewModel
("test-name", CommandViewModelState.Enabled, "test-displayname", "test-displaydescription", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: string.Empty, iconVariant: IconVariant.Regular)]);
Pages\ResourcesTests.cs (1)
275
new
CommandViewModel
(
Aspire.Dashboard.Playwright.Tests (2)
Integration\Playwright\ResourcePaneResponsiveTests.cs (2)
264
commands: [
new
("inspect", CommandViewModelState.Enabled, "Inspect", "", "", [],
2847
new
(name, CommandViewModelState.Enabled, name, "", confirmationMessage: "", argumentInputs: [],
Aspire.Dashboard.Tests (8)
Model\DashboardClientTests.cs (1)
1509
return new
CommandViewModel
(
Model\DashboardCommandExecutorTests.cs (1)
431
return new
CommandViewModel
(
Model\ResourceMenuBuilderTests.cs (6)
161
new
(name, state, name, "", "", [], false, "", IconVariant.Regular);
409
var startCommand = new
CommandViewModel
(
419
var stopCommand = new
CommandViewModel
(
457
var command = new
CommandViewModel
(
502
var command = new
CommandViewModel
(
545
var command = new
CommandViewModel
(
213 references to CommandViewModel
Aspire.Dashboard (90)
Components\Controls\ApplicationSummary.razor.cs (2)
623
private Task ExecuteCommandAsync(ResourceViewModel resource,
CommandViewModel
command) =>
651
EventCallback.Factory.Create<
CommandViewModel
>(this, command => ExecuteCommandAsync(resource, command)),
Components\Controls\MissingParametersPanel.razor.cs (7)
51
public required Func<ResourceViewModel,
CommandViewModel
, Task> OnExecuteCommandAsync { get; set; }
54
public required Func<ResourceViewModel,
CommandViewModel
, ExecuteResourceCommandOptions, Task> OnExecuteCommandWithOptionsAsync { get; set; }
57
public required Func<ResourceViewModel,
CommandViewModel
, bool> IsCommandExecuting { get; set; }
117
private static
CommandViewModel
? GetSetParameterCommand(ResourceViewModel parameter) =>
119
string.Equals(command.Name,
CommandViewModel
.SetParameterCommand, StringComparisons.CommandName) &&
135
var
command = GetSetParameterCommand(parameter);
367
CommandViewModel
Command,
Components\Controls\ParameterOverview.razor.cs (7)
38
public required Func<ResourceViewModel,
CommandViewModel
, Task> OnExecuteCommandAsync { get; set; }
41
public required Func<ResourceViewModel,
CommandViewModel
, ExecuteResourceCommandOptions, Task> OnExecuteCommandWithOptionsAsync { get; set; }
44
public required Func<ResourceViewModel,
CommandViewModel
, bool> IsCommandExecuting { get; set; }
49
private
CommandViewModel
? SetCommand { get; set; }
50
private
CommandViewModel
? DeleteCommand { get; set; }
83
string.Equals(command.Name,
CommandViewModel
.SetParameterCommand, StringComparisons.CommandName) &&
87
string.Equals(command.Name,
CommandViewModel
.DeleteParameterCommand, StringComparisons.CommandName) &&
Components\Controls\ResourceActions.razor.cs (3)
29
public required EventCallback<
CommandViewModel
> CommandSelected { get; set; }
32
public required Func<ResourceViewModel,
CommandViewModel
, bool> IsCommandExecuting { get; set; }
49
private readonly List<
CommandViewModel
> _highlightedCommands = new();
Components\Controls\ResourceDetails.razor.cs (4)
41
public required EventCallback<
CommandViewModel
> CommandSelected { get; set; }
44
public required Func<ResourceViewModel,
CommandViewModel
, bool> IsCommandExecuting { get; set; }
221
["OnExecuteCommandAsync"] = (Func<ResourceViewModel,
CommandViewModel
, Task>)ExecuteResourceCommandAsync,
311
private async Task ExecuteResourceCommandAsync(ResourceViewModel resource,
CommandViewModel
command)
Components\Controls\TerminalDisconnectedBanner.razor.cs (4)
82
private
CommandViewModel
? RestartCommand
94
c.Name is
CommandViewModel
.RestartCommand or
CommandViewModel
.StartCommand);
96
.ThenBy(c => c.Name !=
CommandViewModel
.RestartCommand).FirstOrDefault();
Components\Layout\ResourcesLayout.razor.cs (15)
1865
private static IEnumerable<
CommandViewModel
> GetHighlightedCommands(ResourceViewModel resource) => resource.Commands
1869
private static IEnumerable<
CommandViewModel
> GetFullPageRowCommands(ResourceViewModel resource) =>
1872
string.Equals(c.Name,
CommandViewModel
.SetParameterCommand, StringComparisons.CommandName) &&
1876
private static IEnumerable<
CommandViewModel
> GetResourceRowCommands(ResourceViewModel resource)
1880
KnownResourceState.Running => [
CommandViewModel
.StopCommand,
CommandViewModel
.RestartCommand],
1882
[
CommandViewModel
.StartCommand],
1892
private static IEnumerable<
CommandViewModel
> GetSidebarCommands(ResourceViewModel resource)
1898
c.Name is not (
CommandViewModel
.StartCommand or
CommandViewModel
.StopCommand or
CommandViewModel
.RestartCommand))
1958
private bool IsCommandDisabled(ResourceViewModel resource,
CommandViewModel
command) =>
1989
EventCallback.Factory.Create<
CommandViewModel
>(this, command => ExecuteResourceCommandAsync(resource, command)),
2049
private Task ExecuteResourceCommandAsync(ResourceViewModel resource,
CommandViewModel
command)
2052
string.Equals(command.Name,
CommandViewModel
.SetParameterCommand, StringComparisons.CommandName))
Components\Legacy\Pages\ConsoleLogs.razor.cs (3)
165
private readonly List<
CommandViewModel
> _highlightedCommands = new();
585
EventCallback.Factory.Create<
CommandViewModel
>(this, ExecuteResourceCommandAsync),
626
private async Task ExecuteResourceCommandAsync(
CommandViewModel
command)
Components\Legacy\Pages\Resources.razor.cs (3)
628
foreach (
var
command in resource.Commands)
722
EventCallback.Factory.Create<
CommandViewModel
>(this, (command) => ExecuteResourceCommandAsync(resource, command)),
856
private async Task ExecuteResourceCommandAsync(ResourceViewModel resource,
CommandViewModel
command)
Components\Legacy\Pages\Terminals.razor.cs (3)
24
private readonly List<
CommandViewModel
> _highlightedCommands = [];
264
EventCallback.Factory.Create<
CommandViewModel
>(this, ExecuteResourceCommandAsync),
270
private Task ExecuteResourceCommandAsync(
CommandViewModel
command)
Components\Pages\ConsoleLogs.razor.cs (3)
187
private readonly List<
CommandViewModel
> _highlightedCommands = new();
689
EventCallback.Factory.Create<
CommandViewModel
>(this, ExecuteResourceCommandAsync),
730
private async Task ExecuteResourceCommandAsync(
CommandViewModel
command)
Components\Pages\ResourceOverview.Details.cs (2)
124
["OnExecuteCommandAsync"] = (Func<ResourceViewModel,
CommandViewModel
, Task>)ExecuteResourceCommandAsync,
125
["IsCommandExecuting"] = (Func<ResourceViewModel,
CommandViewModel
, bool>)((r, command) => DashboardCommandExecutor.IsExecuting(r.Name, command.Name)),
Components\Pages\ResourceOverview.razor.cs (2)
724
private Task ExecuteResourceCommandAsync(ResourceViewModel resource,
CommandViewModel
command)
727
private Task ExecuteResourceCommandAsync(ResourceViewModel resource,
CommandViewModel
command, ExecuteResourceCommandOptions options)
Components\Pages\Resources.razor.cs (3)
653
foreach (
var
command in resource.Commands)
778
EventCallback.Factory.Create<
CommandViewModel
>(this, (command) => ExecuteResourceCommandAsync(resource, command)),
919
private async Task ExecuteResourceCommandAsync(ResourceViewModel resource,
CommandViewModel
command)
Components\Pages\Terminals.razor.cs (3)
24
private readonly List<
CommandViewModel
> _highlightedCommands = [];
294
EventCallback.Factory.Create<
CommandViewModel
>(this, ExecuteResourceCommandAsync),
300
private Task ExecuteResourceCommandAsync(
CommandViewModel
command)
Model\DashboardCommandExecutor.cs (7)
54
if (dashboardClient.IsReadOnly || commandName is not (
CommandViewModel
.StopCommand or
CommandViewModel
.StartCommand))
61
var
command = resource.Commands.FirstOrDefault(c => string.Equals(c.Name, commandName, StringComparisons.CommandName));
76
CommandViewModel
command,
130
CommandViewModel
command,
386
private static NotificationAction CreateViewResponseNotificationAction(IStringLocalizer<Dashboard.Resources.Resources> loc,
CommandViewModel
command, ResourceCommandResponseViewModel response)
401
private static async Task OpenViewResponseDialogAsync(DashboardDialogService dialogService,
CommandViewModel
command, ResourceCommandResponseViewModel response)
Model\ResourceMenuBuilder.cs (13)
72
EventCallback<
CommandViewModel
> commandSelected,
73
Func<ResourceViewModel,
CommandViewModel
, bool> isCommandExecuting,
295
Func<ResourceViewModel,
CommandViewModel
, bool> isCommandExecuting,
296
Func<ResourceViewModel,
CommandViewModel
, Task> executeCommand)
340
bool CanExecute(ResourceViewModel resource,
CommandViewModel
command) =>
348
var
command = resource.Commands.FirstOrDefault(c => string.Equals(c.Name, commandName, StringComparisons.CommandName));
357
private void AddCommandMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, EventCallback<
CommandViewModel
> commandSelected, Func<ResourceViewModel,
CommandViewModel
, bool> isCommandExecuting)
374
foreach (
var
highlightedCommand in highlightedMenuCommands)
385
foreach (
var
command in otherMenuCommands)
400
foreach (
var
command in otherMenuCommands)
406
MenuButtonItem CreateMenuItem(
CommandViewModel
command) => CreateCommandMenuItem(
412
private MenuButtonItem CreateCommandMenuItem(
CommandViewModel
command, Func<Task> onClick, bool isDisabled) => new()
Model\ResourceViewModel.cs (1)
47
public required ImmutableArray<
CommandViewModel
> Commands { get; init; }
ServiceClient\DashboardClient.cs (1)
1091
public async Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
ServiceClient\IDashboardClient.cs (1)
75
Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken);
ServiceClient\Partials.cs (1)
132
ImmutableArray<
CommandViewModel
> GetCommands()
ServiceClient\SelectedDashboardClient.cs (1)
66
public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
Telemetry\TelemetryPropertyValues.cs (1)
15
return
CommandViewModel
.IsKnownCommand(commandName)
Aspire.Dashboard.Components.Tests (67)
Controls\MissingParametersPanelTests.cs (7)
52
var
command = CreateSetCommand(input);
54
CommandViewModel
? executed = null;
140
private static
CommandViewModel
CreateSetCommand(InteractionInput input) =>
141
new(
CommandViewModel
.SetParameterCommand, CommandViewModelState.Enabled, "Set", string.Empty, string.Empty, [input], isHighlighted: false, iconName: string.Empty, iconVariant: Microsoft.FluentUI.AspNetCore.Components.IconVariant.Regular);
143
private static ResourceViewModel CreateParameter(
CommandViewModel
command) =>
146
private IRenderedComponent<MissingParametersPanel> RenderPanel(ResourceViewModel parameter, bool isReadOnly, Func<ResourceViewModel,
CommandViewModel
, Task>? executeCommand = null) =>
149
private IRenderedComponent<MissingParametersPanel> RenderPanel(ResourceViewModel[] parameters, bool isReadOnly, Func<ResourceViewModel,
CommandViewModel
, Task>? executeCommand = null)
Controls\ResourceActionsTests.cs (1)
142
.Add(component => component.CommandSelected, EventCallback<
CommandViewModel
>.Empty)
Controls\ResourceDetailsTests.cs (14)
797
var
setCommand = new CommandViewModel(
798
CommandViewModel
.SetParameterCommand,
820
CommandViewModel
? capturedCommand = null;
825
builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<
CommandViewModel
>(this, c => capturedCommand = c));
835
Assert.Equal(
CommandViewModel
.SetParameterCommand, capturedCommand!.Name);
843
var
setCommand = new CommandViewModel(
844
CommandViewModel
.SetParameterCommand,
866
CommandViewModel
? capturedCommand = null;
871
builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<
CommandViewModel
>(this, c => capturedCommand = c));
873
currentResource.Name == resource.Name && command.Name ==
CommandViewModel
.SetParameterCommand);
889
var
setCommand = new CommandViewModel(
890
CommandViewModel
.SetParameterCommand,
916
builder.Add(p => p.CommandSelected, EventCallback.Factory.Create<
CommandViewModel
>(this, _ => Task.CompletedTask));
983
ImmutableArray<
CommandViewModel
>? commands = null)
Controls\TerminalDisconnectedBannerTests.cs (13)
56
[InlineData(
CommandViewModel
.StartCommand, ResourceCommandResponseKind.Succeeded)]
57
[InlineData(
CommandViewModel
.RestartCommand, ResourceCommandResponseKind.Succeeded)]
58
[InlineData(
CommandViewModel
.StartCommand, ResourceCommandResponseKind.Failed)]
59
[InlineData(
CommandViewModel
.RestartCommand, ResourceCommandResponseKind.Cancelled)]
107
displayName: "shell", commands: [CreateCommand(
CommandViewModel
.RestartCommand)]);
119
commands: [CreateCommand(
CommandViewModel
.RestartCommand)], state: KnownResourceState.Finished, properties: new()
134
toasts.WaitForAssertion(() => Assert.Equal($"shell \"{
CommandViewModel
.RestartCommand}\" succeeded",
145
commands: [CreateCommand(
CommandViewModel
.RestartCommand)]);
161
[CreateCommand(
CommandViewModel
.RestartCommand, CommandViewModelState.Hidden)]);
169
commands: [CreateCommand(
CommandViewModel
.RestartCommand, CommandViewModelState.Disabled)]))]);
173
commands: [CreateCommand(
CommandViewModel
.RestartCommand, CommandViewModelState.Disabled),
174
CreateCommand(
CommandViewModel
.StartCommand)]))]);
205
private static
CommandViewModel
CreateCommand(string name, CommandViewModelState state = CommandViewModelState.Enabled) =>
Controls\TerminalViewTests.cs (1)
624
commands: [new CommandViewModel(
CommandViewModel
.StartCommand, CommandViewModelState.Enabled,
Layout\ResourcesLayoutTests.cs (24)
636
static
CommandViewModel
Command(string name, CommandViewModelState state) => new(name, state, name, "",
1544
var
command = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: iconName, iconVariant: IconVariant.Filled);
1564
.Add(component => component.CommandSelected, EventCallback<
CommandViewModel
>.Empty)
1586
var
stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
1587
var
other = new CommandViewModel("custom", CommandViewModelState.Enabled, "Custom command", "", confirmationMessage: "", argumentInputs: [], isHighlighted: false, iconName: string.Empty, iconVariant: IconVariant.Regular);
1616
static
CommandViewModel
Stop(CommandViewModelState state) =>
1617
new(
CommandViewModel
.StopCommand, state, "Stop", "", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "", iconVariant: IconVariant.Regular);
1618
var
enabled = Stop(CommandViewModelState.Enabled);
1626
new CommandViewModel(
CommandViewModel
.SetParameterCommand, CommandViewModelState.Enabled, "Set parameter", "",
1673
var
command = new CommandViewModel("refresh", CommandViewModelState.Enabled, "Refresh", "",
1712
var
stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
1746
static
CommandViewModel
Command(string name, CommandViewModelState state, bool highlighted) =>
1751
Command(
CommandViewModel
.StartCommand, CommandViewModelState.Hidden, false),
1752
Command(
CommandViewModel
.StopCommand, CommandViewModelState.Enabled, true),
1753
Command(
CommandViewModel
.RestartCommand, CommandViewModelState.Enabled, false)
1783
static
CommandViewModel
Command(string name, CommandViewModelState state, bool highlighted) =>
1790
Command(
CommandViewModel
.StopCommand, CommandViewModelState.Enabled, false),
1834
static
CommandViewModel
Command(string name, string displayName, CommandViewModelState state, bool highlighted) =>
1836
var commands = new List<
CommandViewModel
>
1839
Command(
CommandViewModel
.DeleteParameterCommand, "Delete parameter", CommandViewModelState.Enabled, true)
1843
commands.Add(Command(
CommandViewModel
.SetParameterCommand, "Set parameter", state, highlighted));
1890
static
CommandViewModel
Command(string name, CommandViewModelState state) =>
1895
Command(
CommandViewModel
.StopCommand, CommandViewModelState.Enabled),
2012
var
stop = new CommandViewModel("resource-stop", CommandViewModelState.Enabled, "Stop", "Stop resource", confirmationMessage: "", argumentInputs: [], isHighlighted: true, iconName: "Stop", iconVariant: IconVariant.Filled);
Model\DashboardCommandExecutorTests.cs (1)
79
var
command = new CommandViewModel(
Pages\ResourcesTests.cs (2)
296
builder.Add(component => component.CommandSelected, EventCallback.Factory.Create<
CommandViewModel
>(this, _ => Task.CompletedTask));
297
builder.Add(component => component.IsCommandExecuting, (ResourceViewModel _,
CommandViewModel
_) => false);
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24
ImmutableArray<
CommandViewModel
>? commands = null,
tests\Shared\TestDashboardClient.cs (3)
25
private readonly Func<string, string,
CommandViewModel
, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? _executeResourceCommand;
65
Func<string, string,
CommandViewModel
, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? executeResourceCommand = null,
103
public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
Aspire.Dashboard.Playwright.Tests (7)
Integration\Playwright\ResourcePaneResponsiveTests.cs (2)
2841
name == "service-key" ? [Command(
CommandViewModel
.SetParameterCommand)] : [],
2846
private static
CommandViewModel
Command(string name) =>
tests\Aspire.Dashboard.Tests\Shared\MockDashboardClient.cs (1)
62
public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24
ImmutableArray<
CommandViewModel
>? commands = null,
tests\Shared\TestDashboardClient.cs (3)
25
private readonly Func<string, string,
CommandViewModel
, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? _executeResourceCommand;
65
Func<string, string,
CommandViewModel
, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? executeResourceCommand = null,
103
public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)
Aspire.Dashboard.Tests (49)
Model\DashboardClientTests.cs (1)
1507
private static
CommandViewModel
CreateCommand()
Model\DashboardCommandExecutorTests.cs (20)
37
var
command = CreateCommand();
45
[InlineData(
CommandViewModel
.StopCommand, true)]
46
[InlineData(
CommandViewModel
.StartCommand, true)]
47
[InlineData(
CommandViewModel
.RestartCommand, false)]
73
var resource = ModelTestHelpers.CreateResource(resourceName: "api", commands: [CreateCommand(
CommandViewModel
.StopCommand)]);
75
Assert.False(await executor.ExecuteGraphGameCommandAsync(resource,
CommandViewModel
.StopCommand, r => r.DisplayName));
84
var resource = ModelTestHelpers.CreateResource(resourceName: "api", commands: [CreateCommand(
CommandViewModel
.StopCommand)]);
86
Assert.False(await executor.ExecuteGraphGameCommandAsync(resource,
CommandViewModel
.StopCommand, r => r.DisplayName));
103
var resource = ModelTestHelpers.CreateResource(resourceName: "api", commands: [CreateCommand(
CommandViewModel
.StopCommand, state, confirmationMessage)]);
105
Assert.Null(await executor.ExecuteGraphGameCommandAsync(resource,
CommandViewModel
.StopCommand, r => r.DisplayName));
123
var resource = ModelTestHelpers.CreateResource(resourceName: "api", commands: [CreateCommand(
CommandViewModel
.StopCommand)]);
125
Assert.Null(await executor.ExecuteGraphGameCommandAsync(resource,
CommandViewModel
.StopCommand, r => r.DisplayName));
136
Assert.Null(await executor.ExecuteGraphGameCommandAsync(resource,
CommandViewModel
.StopCommand, r => r.DisplayName));
145
var
command = CreateCommand();
173
var
command = CreateCommand();
225
var
command = CreateCommand();
269
var
command = CreateCommand();
309
var
command = CreateCommand();
353
var
command = CreateCommand();
429
private static
CommandViewModel
CreateCommand(string name = "test-command", CommandViewModelState state = CommandViewModelState.Enabled, string confirmationMessage = "")
Model\ResourceMenuBuilderTests.cs (20)
103
var executed = new List<(string ResourceName,
CommandViewModel
Command)>();
160
private static
CommandViewModel
CreateCommand(string name, CommandViewModelState state) =>
179
EventCallback<
CommandViewModel
>.Empty,
231
EventCallback<
CommandViewModel
>.Empty,
266
EventCallback<
CommandViewModel
>.Empty,
319
EventCallback<
CommandViewModel
>.Empty,
357
EventCallback<
CommandViewModel
>.Empty,
392
EventCallback<
CommandViewModel
>.Empty,
409
var
startCommand = new CommandViewModel(
410
CommandViewModel
.StartCommand,
419
var
stopCommand = new CommandViewModel(
420
CommandViewModel
.StopCommand,
440
EventCallback<
CommandViewModel
>.Empty,
457
var
command = new CommandViewModel(
458
CommandViewModel
.StartCommand,
480
EventCallback<
CommandViewModel
>.Empty,
502
var
command = new CommandViewModel(
523
EventCallback<
CommandViewModel
>.Empty,
545
var
command = new CommandViewModel(
566
EventCallback<
CommandViewModel
>.Empty,
Model\SqliteResourceRepositoryTests.cs (1)
483
var
command = Assert.Single(actual.Commands);
ResourceOutgoingPeerResolverTests.cs (1)
696
public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
Shared\MockDashboardClient.cs (1)
62
public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
Terminal\DefaultTerminalConnectionResolverTests.cs (1)
196
public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken) => throw new NotImplementedException();
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
24
ImmutableArray<
CommandViewModel
>? commands = null,
tests\Shared\TestDashboardClient.cs (3)
25
private readonly Func<string, string,
CommandViewModel
, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? _executeResourceCommand;
65
Func<string, string,
CommandViewModel
, ExecuteResourceCommandOptions, CancellationToken, Task<ResourceCommandResponseViewModel>>? executeResourceCommand = null,
103
public Task<ResourceCommandResponseViewModel> ExecuteResourceCommandAsync(string resourceName, string resourceType,
CommandViewModel
command, ExecuteResourceCommandOptions options, CancellationToken cancellationToken)