285 references to ResourceCommandState
Aspire.Hosting (30)
ApplicationModel\CommandOptions.cs (1)
95public Func<UpdateCommandStateContext, ResourceCommandState>? UpdateState { get; set; }
ApplicationModel\CommandsConfigurationExtensions.cs (10)
41return ResourceCommandState.Disabled; 45return ResourceCommandState.Enabled; 49return ResourceCommandState.Hidden; 74return ResourceCommandState.Disabled; 78return ResourceCommandState.Enabled; 82return ResourceCommandState.Hidden; 115return ResourceCommandState.Disabled; 119return ResourceCommandState.Enabled; 168? ResourceCommandState.Enabled 169: ResourceCommandState.Disabled;
ApplicationModel\CustomResourceSnapshot.cs (1)
466public sealed record ResourceCommandSnapshot(string Name, ResourceCommandState State, string DisplayName, string? DisplayDescription, [property: Obsolete("Use Arguments to describe invocation arguments.")] object? Parameter, string? ConfirmationMessage, string? IconName, IconVariant? IconVariant, bool IsHighlighted)
ApplicationModel\ResourceCommandAnnotation.cs (4)
22Func<UpdateCommandStateContext, ResourceCommandState> updateState, 40Func<UpdateCommandStateContext, ResourceCommandState> updateState, 57Func<UpdateCommandStateContext, ResourceCommandState> updateState, 107public Func<UpdateCommandStateContext, ResourceCommandState> UpdateState { get; }
ApplicationModel\ResourceNotificationService.cs (2)
1149var newState = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, Services = _serviceProvider }); 1192var state = annotation.UpdateState(new UpdateCommandStateContext { ResourceSnapshot = previousState, Services = serviceProvider });
Dashboard\proto\Partials.cs (4)
170private static ResourceCommandState MapCommandState(Hosting.ApplicationModel.ResourceCommandState state) 174Hosting.ApplicationModel.ResourceCommandState.Enabled => ResourceCommandState.Enabled, 175Hosting.ApplicationModel.ResourceCommandState.Disabled => ResourceCommandState.Disabled, 176Hosting.ApplicationModel.ResourceCommandState.Hidden => ResourceCommandState.Hidden,
Orchestrator\ParameterProcessor.cs (3)
375updateState: _ => ResourceCommandState.Enabled, 411updateState: _ => HasParameterValue(parameterResource) ? ResourceCommandState.Enabled : ResourceCommandState.Hidden,
ResourceBuilderExtensions.cs (5)
3306return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, commandOptions.UpdateState ?? (c => ResourceCommandState.Enabled), executeCommand, commandOptions.Description, commandOptions.Parameter, commandOptions.Arguments, commandOptions.ConfirmationMessage, commandOptions.IconName, commandOptions.IconVariant, commandOptions.IsHighlighted, commandOptions.Visibility, commandOptions.ValidateArguments, commandOptions.Progress)); 3352Func<UpdateCommandStateContext, ResourceCommandState>? updateState = null, 3372return builder.WithAnnotation(new ResourceCommandAnnotation(name, displayName, updateState ?? (c => ResourceCommandState.Enabled), executeCommand, displayDescription, parameter, confirmationMessage, iconName, iconVariant, isHighlighted)); 4075return targetRunning ? ResourceCommandState.Enabled : ResourceCommandState.Disabled;
Aspire.Hosting.Azure (16)
AzureProvisioningController.cs (15)
950internal ResourceCommandState GetEnvironmentCommandState() 957return _state.Status.CurrentIntent is null ? ResourceCommandState.Enabled : ResourceCommandState.Disabled; 970internal ResourceCommandState GetResourceCommandState(string resourceName, AzureResourceCommand command, UpdateCommandStateContext context) 979return ResourceCommandState.Hidden; 985return ResourceCommandState.Hidden; 998return ResourceCommandState.Enabled; 1009return ResourceCommandState.Hidden; 1014return ResourceCommandState.Hidden; 1017return activeOperation!.CancellationRequested ? ResourceCommandState.Disabled : ResourceCommandState.Enabled; 1021? ResourceCommandState.Disabled 1022: ResourceCommandState.Enabled; 1028AzureResourceCommand.Cancel when !IsCancelableDeploymentState(context.ResourceSnapshot) => ResourceCommandState.Hidden, 1029_ => ResourceCommandState.Enabled
AzureResourcePreparer.cs (1)
169commandOptions.UpdateState ?? (_ => ResourceCommandState.Enabled),
Aspire.Hosting.Azure.Kusto (8)
AzureKustoBuilderExtensions.cs (8)
357static ResourceCommandState UpdateStateDesktop(UpdateCommandStateContext context) 362return ResourceCommandState.Hidden; 365return context.ResourceSnapshot.State?.Text == KnownResourceStates.Running ? ResourceCommandState.Enabled : ResourceCommandState.Disabled; 368static ResourceCommandState UpdateStateWeb(IResourceBuilder<AzureKustoClusterResource> resourceBuilder, UpdateCommandStateContext context) 373return ResourceCommandState.Hidden; 376return context.ResourceSnapshot.State?.Text == KnownResourceStates.Running ? ResourceCommandState.Enabled : ResourceCommandState.Disabled;
Aspire.Hosting.Azure.Tests (40)
AzureEnvironmentResourceExtensionsTests.cs (40)
170Assert.Equal(ResourceCommandState.Enabled, delete.UpdateState(new UpdateCommandStateContext 678Assert.All(environmentEvent.Snapshot.Commands, command => Assert.Equal(ResourceCommandState.Enabled, command.State)); 1027AssertCommandState(keyVaultEvent.Snapshot, AzureProvisioningController.ChangeResourceLocationCommandName, ResourceCommandState.Hidden); 1028AssertCommandState(keyVaultEvent.Snapshot, AzureProvisioningController.GetAzureResourceCommandName, ResourceCommandState.Enabled); 1029AssertCommandState(keyVaultEvent.Snapshot, AzureProvisioningController.CancelCommandName, ResourceCommandState.Hidden); 1030AssertCommandState(keyVaultEvent.Snapshot, AzureProvisioningController.DeleteAzureResourceCommandName, ResourceCommandState.Enabled); 1031AssertCommandState(keyVaultEvent.Snapshot, AzureProvisioningController.ForgetStateCommandName, ResourceCommandState.Enabled); 1032AssertCommandState(keyVaultEvent.Snapshot, AzureProvisioningController.ReprovisionResourceCommandName, ResourceCommandState.Enabled); 1062AssertCommandState(postgresEvent.Snapshot, AzureProvisioningController.ChangeResourceLocationCommandName, ResourceCommandState.Enabled); 1740AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.ChangeResourceLocationCommandName, ResourceCommandState.Disabled); 1741AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.GetAzureResourceCommandName, ResourceCommandState.Enabled); 1742AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.CancelCommandName, ResourceCommandState.Enabled); 1743AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.DeleteAzureResourceCommandName, ResourceCommandState.Disabled); 1744AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.ForgetStateCommandName, ResourceCommandState.Disabled); 1745AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.ReprovisionResourceCommandName, ResourceCommandState.Disabled); 1817AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.CancelCommandName, ResourceCommandState.Enabled); 1988Assert.Equal(ResourceCommandState.Hidden, cancelCommand.State); 2290Assert.All(environmentEvent.Snapshot.Commands, command => Assert.Equal(ResourceCommandState.Disabled, command.State)); 2565Assert.All(environmentEvent.Snapshot.Commands, command => Assert.Equal(ResourceCommandState.Disabled, command.State)); 2579Assert.All(environmentEvent.Snapshot.Commands, command => Assert.Equal(ResourceCommandState.Enabled, command.State)); 2625Assert.All(environmentEvent.Snapshot.Commands, command => Assert.Equal(ResourceCommandState.Disabled, command.State)); 2637Assert.All(environmentEvent.Snapshot.Commands, command => Assert.Equal(ResourceCommandState.Enabled, command.State)); 2661Assert.Equal(ResourceCommandState.Enabled, controller.GetEnvironmentCommandState()); 2779AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.CancelCommandName, ResourceCommandState.Enabled); 2797AssertCommandState(storageEvent.Snapshot, AzureProvisioningController.CancelCommandName, ResourceCommandState.Disabled); 2858AssertCommandState(runningStorage2Event.Snapshot, AzureProvisioningController.CancelCommandName, ResourceCommandState.Hidden); 3045Assert.All(environmentEvent.Snapshot.Commands, command => Assert.Equal(ResourceCommandState.Disabled, command.State)); 5364AssertCommandState(snapshot, AzureProvisioningController.ChangeResourceLocationCommandName, ResourceCommandState.Disabled); 5365AssertCommandState(snapshot, AzureProvisioningController.GetAzureResourceCommandName, ResourceCommandState.Enabled); 5366AssertCommandState(snapshot, AzureProvisioningController.CancelCommandName, ResourceCommandState.Enabled); 5367AssertCommandState(snapshot, AzureProvisioningController.DeleteAzureResourceCommandName, ResourceCommandState.Disabled); 5368AssertCommandState(snapshot, AzureProvisioningController.ForgetStateCommandName, ResourceCommandState.Disabled); 5369AssertCommandState(snapshot, AzureProvisioningController.ReprovisionResourceCommandName, ResourceCommandState.Disabled); 5374AssertCommandState(snapshot, AzureProvisioningController.ChangeResourceLocationCommandName, ResourceCommandState.Enabled); 5375AssertCommandState(snapshot, AzureProvisioningController.GetAzureResourceCommandName, ResourceCommandState.Enabled); 5376AssertCommandState(snapshot, AzureProvisioningController.CancelCommandName, ResourceCommandState.Hidden); 5377AssertCommandState(snapshot, AzureProvisioningController.DeleteAzureResourceCommandName, ResourceCommandState.Enabled); 5378AssertCommandState(snapshot, AzureProvisioningController.ForgetStateCommandName, ResourceCommandState.Enabled); 5379AssertCommandState(snapshot, AzureProvisioningController.ReprovisionResourceCommandName, ResourceCommandState.Enabled); 5382private static void AssertCommandState(CustomResourceSnapshot snapshot, string commandName, ResourceCommandState expectedState)
Aspire.Hosting.Blazor (6)
BrowserDebuggerHelper.cs (6)
212return ResourceCommandState.Hidden; 217return ResourceCommandState.Hidden; 222? ResourceCommandState.Enabled 223: ResourceCommandState.Disabled; 271return ResourceCommandState.Hidden; 274return ResourceCommandState.Enabled;
Aspire.Hosting.Blazor.Tests (13)
BlazorHostedExtensionsTests.cs (3)
230Assert.Equal(ResourceCommandState.Enabled, debugCommand.UpdateState(CreateRunningCommandStateContext())); 266Assert.Equal(ResourceCommandState.Hidden, debugCommand.UpdateState(CreateRunningCommandStateContext())); 300Assert.Equal(ResourceCommandState.Hidden, debugCommand.UpdateState(CreateRunningCommandStateContext()));
WithBlazorAppTests.cs (10)
237[InlineData("Running", ResourceCommandState.Enabled)] 238[InlineData("Starting", ResourceCommandState.Disabled)] 239[InlineData("Exited", ResourceCommandState.Disabled)] 240public void WithClient_DebuggerCommandsHaveExpectedInitialState(string resourceState, ResourceCommandState expectedDebugState) 263Assert.Equal(ResourceCommandState.Hidden, commands["stop-browser-debug"].UpdateState(context)); 267[InlineData(false, null, ResourceCommandState.Disabled)] 268[InlineData(true, null, ResourceCommandState.Disabled)] 269[InlineData(true, false, ResourceCommandState.Disabled)] 270[InlineData(true, true, ResourceCommandState.Enabled)] 274ResourceCommandState expectedState)
Aspire.Hosting.Browsers (7)
BrowserLogsBuilderExtensions.cs (7)
182return ResourceCommandState.Disabled; 191return ResourceCommandState.Enabled; 195return ResourceCommandState.Disabled; 228? ResourceCommandState.Enabled 229: ResourceCommandState.Disabled; 280? ResourceCommandState.Enabled 281: ResourceCommandState.Disabled;
Aspire.Hosting.Browsers.Tests (11)
BrowserLogsBuilderExtensionsTests.cs (4)
1348command.State == ResourceCommandState.Disabled)).DefaultTimeout(); 1350Assert.Equal(ResourceCommandState.Disabled, initialEvent.Snapshot.Commands.Single(command => command.Name == BrowserLogsBuilderExtensions.OpenTrackedBrowserCommandName).State); 1364command.State == ResourceCommandState.Enabled)).DefaultTimeout(); 1366Assert.Equal(ResourceCommandState.Enabled, enabledEvent.Snapshot.Commands.Single(command => command.Name == BrowserLogsBuilderExtensions.OpenTrackedBrowserCommandName).State);
src\Aspire.Hosting.Browsers\BrowserLogsBuilderExtensions.cs (7)
182return ResourceCommandState.Disabled; 191return ResourceCommandState.Enabled; 195return ResourceCommandState.Disabled; 228? ResourceCommandState.Enabled 229: ResourceCommandState.Disabled; 280? ResourceCommandState.Enabled 281: ResourceCommandState.Disabled;
Aspire.Hosting.DevTunnels (2)
DevTunnelResourceBuilderExtensions.cs (2)
652? ResourceCommandState.Enabled 653: ResourceCommandState.Disabled;
Aspire.Hosting.DevTunnels.Tests (6)
DevTunnelResourceBuilderExtensionsTests.cs (6)
576var enabledState = command.UpdateState(new UpdateCommandStateContext 586var stoppedState = command.UpdateState(new UpdateCommandStateContext 597var unavailableState = command.UpdateState(new UpdateCommandStateContext 622Assert.Equal(ResourceCommandState.Enabled, enabledState); 623Assert.Equal(ResourceCommandState.Disabled, stoppedState); 624Assert.Equal(ResourceCommandState.Disabled, unavailableState);
Aspire.Hosting.EntityFrameworkCore (3)
EFResourceBuilderExtensions.cs (3)
870private static ResourceCommandState GetCommandState(UpdateCommandStateContext _, EFMigrationResource migrationResource) 874return ResourceCommandState.Disabled; 877return ResourceCommandState.Enabled;
Aspire.Hosting.EntityFrameworkCore.Tests (10)
EFCoreOperationExecutorTests.cs (1)
220_ => ResourceCommandState.Enabled,
EFMigrationCommandsTests.cs (8)
209var state = command.UpdateState(new UpdateCommandStateContext 214Assert.Equal(ResourceCommandState.Enabled, state); 239var state = command.UpdateState(new UpdateCommandStateContext 244Assert.Equal(ResourceCommandState.Disabled, state); 270var state = command.UpdateState(new UpdateCommandStateContext 275Assert.Equal(ResourceCommandState.Disabled, state); 290var state = command.UpdateState(new UpdateCommandStateContext 295Assert.Equal(ResourceCommandState.Enabled, state);
TestServices\TestEfTool.cs (1)
25_ => ResourceCommandState.Enabled,
Aspire.Hosting.Maui (1)
Lifecycle\MauiBuildQueueEventSubscriber.cs (1)
530return ResourceCommandState.Enabled;
Aspire.Hosting.Maui.Tests (3)
MauiBuildQueueTests.cs (3)
571Assert.Equal(ResourceCommandState.Enabled, stopCommand.UpdateState(CreateUpdateStateContext(env, "Building"))); 604Assert.Equal(ResourceCommandState.Enabled, stopCommand.UpdateState(CreateUpdateStateContext(env, KnownResourceStates.Running))); 1124updateState: _ => ResourceCommandState.Enabled,
Aspire.Hosting.MongoDB (2)
src\Shared\ContainerReplCommand.cs (2)
62? ResourceCommandState.Enabled 63: ResourceCommandState.Disabled
Aspire.Hosting.MongoDB.Tests (8)
tests\Shared\ContainerReplCommandTestBase.cs (8)
40[InlineData(nameof(KnownResourceStates.Running), "container-id", ResourceCommandState.Enabled)] 41[InlineData(nameof(KnownResourceStates.Running), null, ResourceCommandState.Disabled)] 42[InlineData(nameof(KnownResourceStates.Running), "", ResourceCommandState.Disabled)] 43[InlineData(nameof(KnownResourceStates.Starting), "container-id", ResourceCommandState.Disabled)] 44[InlineData(nameof(KnownResourceStates.Exited), "container-id", ResourceCommandState.Disabled)] 45[InlineData(null, null, ResourceCommandState.Disabled)] 46public void ReplCommandRequiresRunningContainer(string? state, string? containerId, ResourceCommandState expected) 53var result = command.UpdateState(new UpdateCommandStateContext
Aspire.Hosting.MySql (2)
src\Shared\ContainerReplCommand.cs (2)
62? ResourceCommandState.Enabled 63: ResourceCommandState.Disabled
Aspire.Hosting.MySql.Tests (8)
tests\Shared\ContainerReplCommandTestBase.cs (8)
40[InlineData(nameof(KnownResourceStates.Running), "container-id", ResourceCommandState.Enabled)] 41[InlineData(nameof(KnownResourceStates.Running), null, ResourceCommandState.Disabled)] 42[InlineData(nameof(KnownResourceStates.Running), "", ResourceCommandState.Disabled)] 43[InlineData(nameof(KnownResourceStates.Starting), "container-id", ResourceCommandState.Disabled)] 44[InlineData(nameof(KnownResourceStates.Exited), "container-id", ResourceCommandState.Disabled)] 45[InlineData(null, null, ResourceCommandState.Disabled)] 46public void ReplCommandRequiresRunningContainer(string? state, string? containerId, ResourceCommandState expected) 53var result = command.UpdateState(new UpdateCommandStateContext
Aspire.Hosting.PostgreSQL (2)
src\Shared\ContainerReplCommand.cs (2)
62? ResourceCommandState.Enabled 63: ResourceCommandState.Disabled
Aspire.Hosting.PostgreSQL.Tests (8)
tests\Shared\ContainerReplCommandTestBase.cs (8)
40[InlineData(nameof(KnownResourceStates.Running), "container-id", ResourceCommandState.Enabled)] 41[InlineData(nameof(KnownResourceStates.Running), null, ResourceCommandState.Disabled)] 42[InlineData(nameof(KnownResourceStates.Running), "", ResourceCommandState.Disabled)] 43[InlineData(nameof(KnownResourceStates.Starting), "container-id", ResourceCommandState.Disabled)] 44[InlineData(nameof(KnownResourceStates.Exited), "container-id", ResourceCommandState.Disabled)] 45[InlineData(null, null, ResourceCommandState.Disabled)] 46public void ReplCommandRequiresRunningContainer(string? state, string? containerId, ResourceCommandState expected) 53var result = command.UpdateState(new UpdateCommandStateContext
Aspire.Hosting.Redis (2)
src\Shared\ContainerReplCommand.cs (2)
62? ResourceCommandState.Enabled 63: ResourceCommandState.Disabled
Aspire.Hosting.Redis.Tests (8)
tests\Shared\ContainerReplCommandTestBase.cs (8)
40[InlineData(nameof(KnownResourceStates.Running), "container-id", ResourceCommandState.Enabled)] 41[InlineData(nameof(KnownResourceStates.Running), null, ResourceCommandState.Disabled)] 42[InlineData(nameof(KnownResourceStates.Running), "", ResourceCommandState.Disabled)] 43[InlineData(nameof(KnownResourceStates.Starting), "container-id", ResourceCommandState.Disabled)] 44[InlineData(nameof(KnownResourceStates.Exited), "container-id", ResourceCommandState.Disabled)] 45[InlineData(null, null, ResourceCommandState.Disabled)] 46public void ReplCommandRequiresRunningContainer(string? state, string? containerId, ResourceCommandState expected) 53var result = command.UpdateState(new UpdateCommandStateContext
Aspire.Hosting.SqlServer (2)
src\Shared\ContainerReplCommand.cs (2)
62? ResourceCommandState.Enabled 63: ResourceCommandState.Disabled
Aspire.Hosting.SqlServer.Tests (8)
tests\Shared\ContainerReplCommandTestBase.cs (8)
40[InlineData(nameof(KnownResourceStates.Running), "container-id", ResourceCommandState.Enabled)] 41[InlineData(nameof(KnownResourceStates.Running), null, ResourceCommandState.Disabled)] 42[InlineData(nameof(KnownResourceStates.Running), "", ResourceCommandState.Disabled)] 43[InlineData(nameof(KnownResourceStates.Starting), "container-id", ResourceCommandState.Disabled)] 44[InlineData(nameof(KnownResourceStates.Exited), "container-id", ResourceCommandState.Disabled)] 45[InlineData(null, null, ResourceCommandState.Disabled)] 46public void ReplCommandRequiresRunningContainer(string? state, string? containerId, ResourceCommandState expected) 53var result = command.UpdateState(new UpdateCommandStateContext
Aspire.Hosting.Tests (69)
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (3)
208new ResourceCommandSnapshot("start", ResourceCommandState.Enabled, "Start", "Start the resource", null, null, null, null, false) 238new ResourceCommandSnapshot("stop", ResourceCommandState.Disabled, "Stop", "Stop the resource", null, null, null, null, false), 239new ResourceCommandSnapshot("restart", ResourceCommandState.Hidden, "Restart", null, null, null, null, null, true)
Dashboard\DashboardServiceTests.cs (3)
170UpdateState = c => Hosting.ApplicationModel.ResourceCommandState.Enabled, 197UpdateState = c => Hosting.ApplicationModel.ResourceCommandState.Enabled, 206UpdateState = c => (Hosting.ApplicationModel.ResourceCommandState)999
ResourceCommandAnnotationTests.cs (52)
19[InlineData("start", "Starting", ResourceCommandState.Disabled)] 20[InlineData("start", "Stopping", ResourceCommandState.Hidden)] 21[InlineData("start", "Running", ResourceCommandState.Hidden)] 22[InlineData("start", "Exited", ResourceCommandState.Enabled)] 23[InlineData("start", "Finished", ResourceCommandState.Enabled)] 24[InlineData("start", "FailedToStart", ResourceCommandState.Enabled)] 25[InlineData("start", "Unknown", ResourceCommandState.Enabled)] 26[InlineData("start", "Waiting", ResourceCommandState.Enabled)] 27[InlineData("start", "Building", ResourceCommandState.Disabled)] 28[InlineData("start", "RuntimeUnhealthy", ResourceCommandState.Disabled)] 29[InlineData("start", "", ResourceCommandState.Disabled)] 30[InlineData("start", null, ResourceCommandState.Disabled)] 31[InlineData("stop", "Starting", ResourceCommandState.Hidden)] 32[InlineData("stop", "Stopping", ResourceCommandState.Disabled)] 33[InlineData("stop", "Running", ResourceCommandState.Enabled)] 34[InlineData("stop", "Exited", ResourceCommandState.Hidden)] 35[InlineData("stop", "Finished", ResourceCommandState.Hidden)] 36[InlineData("stop", "FailedToStart", ResourceCommandState.Hidden)] 37[InlineData("stop", "Unknown", ResourceCommandState.Hidden)] 38[InlineData("stop", "Waiting", ResourceCommandState.Hidden)] 39[InlineData("stop", "Building", ResourceCommandState.Hidden)] 40[InlineData("stop", "RuntimeUnhealthy", ResourceCommandState.Hidden)] 41[InlineData("stop", "", ResourceCommandState.Hidden)] 42[InlineData("stop", null, ResourceCommandState.Hidden)] 43[InlineData("restart", "Starting", ResourceCommandState.Disabled)] 44[InlineData("restart", "Stopping", ResourceCommandState.Disabled)] 45[InlineData("restart", "Running", ResourceCommandState.Enabled)] 46[InlineData("restart", "Exited", ResourceCommandState.Disabled)] 47[InlineData("restart", "Finished", ResourceCommandState.Disabled)] 48[InlineData("restart", "FailedToStart", ResourceCommandState.Disabled)] 49[InlineData("restart", "Unknown", ResourceCommandState.Disabled)] 50[InlineData("restart", "Waiting", ResourceCommandState.Disabled)] 51[InlineData("restart", "Building", ResourceCommandState.Disabled)] 52[InlineData("restart", "RuntimeUnhealthy", ResourceCommandState.Disabled)] 53[InlineData("restart", "", ResourceCommandState.Disabled)] 54[InlineData("restart", null, ResourceCommandState.Disabled)] 55public void LifeCycleCommands_CommandState(string commandName, string? resourceState, ResourceCommandState commandState) 65var state = startCommand.UpdateState(new UpdateCommandStateContext 126[InlineData("rebuild", "Starting", ResourceCommandState.Disabled)] 127[InlineData("rebuild", "Stopping", ResourceCommandState.Disabled)] 128[InlineData("rebuild", "Running", ResourceCommandState.Enabled)] 129[InlineData("rebuild", "Exited", ResourceCommandState.Enabled)] 130[InlineData("rebuild", "Finished", ResourceCommandState.Enabled)] 131[InlineData("rebuild", "FailedToStart", ResourceCommandState.Enabled)] 132[InlineData("rebuild", "Unknown", ResourceCommandState.Disabled)] 133[InlineData("rebuild", "Waiting", ResourceCommandState.Enabled)] 134[InlineData("rebuild", "RuntimeUnhealthy", ResourceCommandState.Disabled)] 135[InlineData("rebuild", "Building", ResourceCommandState.Disabled)] 136[InlineData("rebuild", "", ResourceCommandState.Disabled)] 137[InlineData("rebuild", null, ResourceCommandState.Disabled)] 138public void RebuildCommand_CommandState(string commandName, string? resourceState, ResourceCommandState commandState) 145var state = rebuildCommand.UpdateState(new UpdateCommandStateContext
ResourceNotificationTests.cs (1)
2128return new("command", ResourceCommandState.Enabled, "Command", DisplayDescription: null, Parameter: null, ConfirmationMessage: null, IconName: null, IconVariant: null, IsHighlighted: false)
WithHttpCommandTests.cs (10)
959Assert.Equal(ResourceCommandState.Disabled, startingEvent.Snapshot.Commands.First(c => c.Name == "mycommand").State); 971e.Snapshot.Commands.First(c => c.Name == "mycommand").State == ResourceCommandState.Enabled).DefaultTimeout(); 973Assert.Equal(ResourceCommandState.Enabled, runningEvent.Snapshot.Commands.First(c => c.Name == "mycommand").State); 997return enableCommand ? ResourceCommandState.Enabled : ResourceCommandState.Hidden; 1014e.Snapshot.Commands.First(c => c.Name == "mycommand").State == ResourceCommandState.Hidden).DefaultTimeout(); 1016Assert.Equal(ResourceCommandState.Hidden, runningEvent.Snapshot.Commands.First(c => c.Name == "mycommand").State); 1028e => e.Snapshot.Commands.First(c => c.Name == "mycommand").State == ResourceCommandState.Enabled).DefaultTimeout(); 1031Assert.Equal(ResourceCommandState.Enabled, enabledEvent.Snapshot.Commands.First(c => c.Name == "mycommand").State); 1070e.Snapshot.Commands.FirstOrDefault(c => c.Name == commandName)?.State == ResourceCommandState.Enabled).DefaultTimeout();
Aspire.Hosting.Valkey (2)
src\Shared\ContainerReplCommand.cs (2)
62? ResourceCommandState.Enabled 63: ResourceCommandState.Disabled
Aspire.Hosting.Valkey.Tests (8)
tests\Shared\ContainerReplCommandTestBase.cs (8)
40[InlineData(nameof(KnownResourceStates.Running), "container-id", ResourceCommandState.Enabled)] 41[InlineData(nameof(KnownResourceStates.Running), null, ResourceCommandState.Disabled)] 42[InlineData(nameof(KnownResourceStates.Running), "", ResourceCommandState.Disabled)] 43[InlineData(nameof(KnownResourceStates.Starting), "container-id", ResourceCommandState.Disabled)] 44[InlineData(nameof(KnownResourceStates.Exited), "container-id", ResourceCommandState.Disabled)] 45[InlineData(null, null, ResourceCommandState.Disabled)] 46public void ReplCommandRequiresRunningContainer(string? state, string? containerId, ResourceCommandState expected) 53var result = command.UpdateState(new UpdateCommandStateContext