294 instantiations of ResourceSnapshot
Aspire.Cli.Tests (294)
Backchannel\AppHostAuxiliaryBackchannelTests.cs (1)
240new()
Backchannel\ResourceSnapshotMapperTests.cs (26)
54var snapshot = new ResourceSnapshot 86var snapshot = new ResourceSnapshot 182var snapshot = new ResourceSnapshot 206var snapshot = new ResourceSnapshot 232var snapshot = new ResourceSnapshot 260var snapshot = new ResourceSnapshot 287var snapshot = new ResourceSnapshot 330var snapshot = new ResourceSnapshot 359var dependency = new ResourceSnapshot 367var resource = new ResourceSnapshot 385var resource = new ResourceSnapshot 417var firstDependency = new ResourceSnapshot 424var secondDependency = new ResourceSnapshot 432var resource = new ResourceSnapshot 452new() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 453new() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" } 467new() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 468new() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" } 482new() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 483new() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 484new() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" } 497new() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 498new() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" }, 499new() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" } 513new() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" } 526new() { Name = "Cache-Zuyppzgw", DisplayName = "Cache", ResourceType = "Container", State = "Running" }
Backchannel\ResourceSnapshotWatcherTests.cs (12)
199new ResourceSnapshot 211new ResourceSnapshot 244new ResourceSnapshot 257new ResourceSnapshot 291new ResourceSnapshot 304new ResourceSnapshot 338new() 350new ResourceSnapshot 360new ResourceSnapshot 485return new ResourceSnapshot 556var firstSnapshot = new ResourceSnapshot 582await source.Writer.WriteAsync(new ResourceSnapshot
Backchannel\TrayResourceHealthTests.cs (13)
34var resource = new ResourceSnapshot 53var resource = new ResourceSnapshot 73new() { Name = "hidden-state", State = "Hidden", HealthStatus = "Unhealthy" }, 74new() { Name = "hidden-flag", State = "FailedToStart", IsHidden = true }, 75new() { Name = "parameter", ResourceType = "Parameter", State = "Active" }, 76new() { Name = "connection", ResourceType = "ConnectionString" }, 77new() { Name = "setup", State = "Finished", ExitCode = 0 } 83[.. resources, new() { Name = "api", State = "Running", HealthStatus = "Healthy" }])); 91new() { Name = "api", State = "Running", HealthStatus = "Healthy" }, 93new() 111new() { Name = "api", State = "Running", HealthStatus = "Healthy" }, 112new() { Name = "worker", State = "Waiting" }, 113new() { Name = "database", State = "Running", HealthStatus = "Unhealthy" }
Backchannel\TrayWatchStreamTests.cs (17)
732new() { Name = "api", State = "Starting", Version = 1 }, 733new() { Name = "cache", State = "Running", HealthStatus = "Healthy", Version = 1 } 758resourceUpdates.Writer.TryWrite(new() { Name = "api", State = "Running", HealthStatus = "Healthy", Version = 2 }); 761resourceUpdates.Writer.TryWrite(new() { Name = "cache", State = "Running", HealthStatus = "Degraded", Version = 2 }); 764resourceUpdates.Writer.TryWrite(new() { Name = "cache", State = "Running", HealthStatus = "Unhealthy", Version = 3 }); 767resourceUpdates.Writer.TryWrite(new() { Name = "cache", State = "Running", HealthStatus = "Healthy", Version = 4 }); 770resourceUpdates.Writer.TryWrite(new() { Name = "api", State = "Running", HealthStatus = "Unhealthy", Version = 1 }); 771resourceUpdates.Writer.TryWrite(new() { Name = "cache", State = "FailedToStart", Version = 5 }); 774resourceUpdates.Writer.TryWrite(new() { Name = "cache", State = "FailedToStart", IsHidden = true, Version = 6 }); 825? [new() { Name = "api", State = "Running", IsHidden = true }] 842resourceUpdates.Writer.TryWrite(new() { Name = "api", State = "Running" }); 845resourceUpdates.Writer.TryWrite(new() { Name = "api", State = "Running", IsHidden = true }); 874connection.ResourceSnapshots = [new() { Name = "api", State = "Running", HealthStatus = "Healthy" }]; 915initial.ResourceSnapshots = [new() { Name = "api", State = "Running", HealthStatus = "Healthy" }]; 918replacement.ResourceSnapshots = [new() { Name = "api", State = "Waiting" }]; 981initial.ResourceSnapshots = [new() { Name = "api", State = "Running", HealthStatus = "Healthy" }]; 984replacement.ResourceSnapshots = [new() { Name = "api", State = "Waiting" }];
Commands\AgentMcpCommandTests.cs (14)
237new ResourceSnapshot 301new ResourceSnapshot 378new ResourceSnapshot 511new ResourceSnapshot 662new ResourceSnapshot 707new ResourceSnapshot 804new() 833new() 925new() 1123new ResourceSnapshot 1204new ResourceSnapshot 1406new ResourceSnapshot 1835new ResourceSnapshot 1950new ResourceSnapshot
Commands\DescribeCommandTests.cs (66)
38var snapshot = new ResourceSnapshot { Name = "resource", State = state, ExitCode = exitCode }; 52new() { Name = "running", ResourceType = "Project", State = "Running", HealthStatus = "Healthy" }, 53new() { Name = "finished-positive", ResourceType = "Project", State = "Finished", ExitCode = 1 }, 54new() { Name = "finished-negative", ResourceType = "Project", State = "Finished", ExitCode = -532462766 }, 55new() { Name = "finished-zero", ResourceType = "Project", State = "Finished", ExitCode = 0 }, 56new() { Name = "finished-unknown", ResourceType = "Project", State = "Finished" }, 57new() { Name = "exited-positive", ResourceType = "Container", State = "Exited", ExitCode = 1 }, 58new() { Name = "exited-negative", ResourceType = "Container", State = "Exited", ExitCode = -532462766 }, 59new() { Name = "exited-zero", ResourceType = "Container", State = "Exited", ExitCode = 0 }, 60new() { Name = "exited-unknown", ResourceType = "Container", State = "Exited" } 78new() { Name = "api", ResourceType = "Project", State = "Finished", ExitCode = -532462766 } 103new() { Name = "api", ResourceType = "Project", State = "Finished", ExitCode = -532462766 } 122new ResourceSnapshot { Name = "cache", ResourceType = "Container", ResourceTypeDisplayName = "Redis", State = "Running" }, 123new ResourceSnapshot { Name = "postgres", ResourceType = "Container", ResourceTypeDisplayName = "PostgreSQL Server", State = "Running" }, 124new ResourceSnapshot { Name = "orders", ResourceType = "Project", ResourceTypeDisplayName = "ASP.NET Core", State = "Running" }, 125new ResourceSnapshot { Name = "generic", ResourceType = "Container", State = "Running" } 499new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 507new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 509new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" }, 511new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" }, 551.Select(index => new ResourceSnapshot 561new ResourceSnapshot 568new ResourceSnapshot 631new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 667new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 668new ResourceSnapshot { Name = "postgres", DisplayName = "postgres", ResourceType = "Container", State = "Running" }, 669new ResourceSnapshot { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }, 694new ResourceSnapshot 760new ResourceSnapshot { Name = "redis", Version = 1, DisplayName = "redis", ResourceType = "Container", State = "Starting" }, 799new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 808new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 810new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" }, 812new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" }, 843new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 873new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 897new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 925new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 953new ResourceSnapshot 995new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 1026new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 1027new ResourceSnapshot { Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" }, 1028new ResourceSnapshot { Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true }, 1052new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 1053new ResourceSnapshot { Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" }, 1054new ResourceSnapshot { Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true }, 1080new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 1081new ResourceSnapshot { Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" }, 1105new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 1106new ResourceSnapshot { Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" }, 1133new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 1134new ResourceSnapshot { Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" }, 1163new ResourceSnapshot 1178new ResourceSnapshot { Name = "api-2", DisplayName = "api", ResourceType = "Project", State = "Running" }, 1179new ResourceSnapshot { Name = "api-1", DisplayName = "api", ResourceType = "Project", State = "Running" }, 1180new ResourceSnapshot { Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Running", IsHidden = true }, 1181new ResourceSnapshot { Name = "connection", DisplayName = "connection", ResourceType = "Parameter", State = "Running" } 1198new ResourceSnapshot 1220new ResourceSnapshot 1225new ResourceSnapshot { Name = "api-2", DisplayName = "api", ResourceType = "Project", State = "Running" }, 1226new ResourceSnapshot { Name = "api-1", DisplayName = "api", ResourceType = "Project", State = "Running" } 1243new ResourceSnapshot { Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Hidden" }, 1244new ResourceSnapshot { Name = "connection", DisplayName = "connection", ResourceType = "Parameter", State = "Running" } 1275new ResourceSnapshot { Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Running" } 1400yield return new ResourceSnapshot 1466yield return new ResourceSnapshot 1479yield return new ResourceSnapshot
Commands\ExportCommandTests.cs (26)
50new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 51new ResourceSnapshot { Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 127new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 204new ResourceSnapshot { Name = "other-resource", DisplayName = "other-resource", ResourceType = "Project", State = "Running" }, 227new ResourceSnapshot { Name = "target-resource", DisplayName = "target-resource", ResourceType = "Container", State = "Running" }, 330new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 331new ResourceSnapshot { Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 332new ResourceSnapshot { Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 450new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 451new ResourceSnapshot { Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 507new ResourceSnapshot { Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 508new ResourceSnapshot { Name = "webfrontend", DisplayName = "webfrontend", ResourceType = "Project", State = "Running" }, 565new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 566new ResourceSnapshot { Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 567new ResourceSnapshot { Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" }, 615new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 616new ResourceSnapshot { Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" }, 617new ResourceSnapshot { Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true }, 659new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 660new ResourceSnapshot { Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" }, 703new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 704new ResourceSnapshot { Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" }, 745new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 781new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 824new ResourceSnapshot { Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" }, 825new ResourceSnapshot { Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
Commands\LogsCommandTests.cs (12)
733new ResourceSnapshot 740new ResourceSnapshot 823new ResourceSnapshot 854new() 864new() 871new() 990new ResourceSnapshot 997new ResourceSnapshot 1554new ResourceSnapshot 1562new ResourceSnapshot 1569new ResourceSnapshot 1633yield return new ResourceSnapshot
Commands\ResourceCommandTests.cs (1)
2349return new ResourceSnapshot
Commands\TerminalCommandTests.cs (1)
820return new ResourceSnapshot
Commands\TerminalResourceResolverTests.cs (17)
27new() { Name = "shell-def456", DisplayName = "shell" }, 28new() { Name = "shell-abc123", DisplayName = "shell" } 53new() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties(replicaIndex) } 83new() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties("0") }, 84new() { Name = "shell-def456", DisplayName = "shell", Properties = Properties("1") } 108new() { Name = "other-abc123", DisplayName = "shell-def456", Properties = Properties("0") }, 109new() { Name = "shell-def456", DisplayName = "shell", Properties = Properties("1") } 144new() { Name = "shell-abc123", DisplayName = "shell" }, 145new() { Name = "shell-def456", DisplayName = "shell" } 177new() { Name = "shell-abc123", DisplayName = "shell" }, 178new() { Name = "shell-def456", DisplayName = "shell" } 214new() { Name = "shell-def456", DisplayName = "shell", Properties = Properties(replicaIndex) } 248new() 279new() { Name = "shell-abc123", DisplayName = "shell" }, 280new() { Name = "shell-def456", DisplayName = "shell" } 306new() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties("0") } 336ResourceSnapshots = hasOtherInstances ? [new() { Name = "shell-abc123", DisplayName = "shell" }] : [],
Commands\TerminalTapePlayCommandTests.cs (7)
135new() { Name = "shell-abc123", DisplayName = "shell" }, 136new() { Name = "shell-def456", DisplayName = "shell" } 172new() { Name = "shell-def456", DisplayName = "shell" }, 173new() { Name = "shell-abc123", DisplayName = "shell" } 207new() 213new() 567new ResourceSnapshot { Name = "shell-0", DisplayName = "shell", ResourceType = "Executable", State = "Running" }
Mcp\ExcludeFromMcpTests.cs (15)
29var snapshot = new ResourceSnapshot 41var snapshot = new ResourceSnapshot 56var snapshot = new ResourceSnapshot 71var snapshot = new ResourceSnapshot 86var snapshot = new ResourceSnapshot 107new ResourceSnapshot 123new ResourceSnapshot 165new ResourceSnapshot 211new ResourceSnapshot 249new ResourceSnapshot 283new ResourceSnapshot 422new ResourceSnapshot 429new ResourceSnapshot 470new ResourceSnapshot 477new ResourceSnapshot
Mcp\ListResourcesToolTests.cs (42)
76CreateConnection(new ResourceSnapshot 104new ResourceSnapshot 124new ResourceSnapshot 131new ResourceSnapshot 138new ResourceSnapshot 174new ResourceSnapshot 189new ResourceSnapshot 196new ResourceSnapshot 231new ResourceSnapshot 239new ResourceSnapshot 246new ResourceSnapshot 311new ResourceSnapshot 318new ResourceSnapshot 325new ResourceSnapshot 389var connection = CreateConnection(names.Reverse().Select(name => new ResourceSnapshot 394connection.ResourceSnapshots.Insert(0, new ResourceSnapshot { Name = "hidden", IsHidden = true }); 395connection.ResourceSnapshots.Insert(1, new ResourceSnapshot { Name = "hidden-state", State = "Hidden" }); 396connection.ResourceSnapshots.Insert(2, new ResourceSnapshot 447new ResourceSnapshot { Name = "first" }, 448new ResourceSnapshot { Name = "second" }, 449new ResourceSnapshot { Name = "third" })); 476var snapshots = Enumerable.Range(0, 300).Select(index => new ResourceSnapshot 480snapshots.Insert(0, new ResourceSnapshot 489snapshots.Add(new ResourceSnapshot { Name = "redis-visible", DisplayName = "Redis" }); 490snapshots.Add(new ResourceSnapshot { Name = "redis-hidden", DisplayName = "Redis", IsHidden = true }); 508monitor.AddConnection("hash1", "socket.hash1", CreateConnection(new ResourceSnapshot 592monitor.AddConnection("hash1", "socket.hash1", CreateConnection(new ResourceSnapshot { Name = "api", Commands = commands })); 639CreateConnection(new ResourceSnapshot 666var snapshots = resourceNames.Select((name, index) => new ResourceSnapshot 726new ResourceSnapshot 736new ResourceSnapshot 764new ResourceSnapshot 775new ResourceSnapshot 786new ResourceSnapshot 815CreateConnection(new ResourceSnapshot 842CreateConnection(new ResourceSnapshot 886new ResourceSnapshot 965new ResourceSnapshot 977new ResourceSnapshot 987new ResourceSnapshot 997new ResourceSnapshot 1055CreateConnection(new ResourceSnapshot
Mcp\WaitForResourcesToolTests.cs (24)
89new ResourceSnapshot 96new ResourceSnapshot 102new ResourceSnapshot 155.Select(index => new ResourceSnapshot 183var connection = CreateConnection(new ResourceSnapshot 217var connection = CreateConnection(new ResourceSnapshot 254new ResourceSnapshot 260new ResourceSnapshot 307new ResourceSnapshot 313new ResourceSnapshot 362new ResourceSnapshot 369new ResourceSnapshot 380new ResourceSnapshot 386new ResourceSnapshot 483responses.Keys.Select(static name => new ResourceSnapshot 540new ResourceSnapshot { Name = "ready", State = "Running" }, 541new ResourceSnapshot { Name = "slow", State = "Starting" }); 568new ResourceSnapshot 611new ResourceSnapshot { Name = "api", State = "Starting" }, 612new ResourceSnapshot { Name = "worker", State = "Starting" }, 613new ResourceSnapshot { Name = "database", State = "Starting" }); 693new ResourceSnapshot { Name = "api", State = "Starting" }, 694new ResourceSnapshot { Name = "worker", State = "Starting" }); 775var connection = CreateConnection(new ResourceSnapshot { Name = "api", State = "Starting" });
236 references to ResourceSnapshot
aspire (116)
Backchannel\AppHostAuxiliaryBackchannel.cs (12)
397public async Task<List<ResourceSnapshot>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default) 421var snapshots = await rpc.InvokeWithProfilingAsync<List<ResourceSnapshot>>( 444public async IAsyncEnumerable<ResourceSnapshot> WatchResourceSnapshotsAsync(bool includeHidden, [EnumeratorCancellation] CancellationToken cancellationToken = default) 448await foreach (var snapshot in WatchResourcesV2Async(new WatchResourcesRequest 468IAsyncEnumerable<ResourceSnapshot>? snapshots; 471snapshots = await rpc.InvokeStreamingWithProfilingAsync<ResourceSnapshot>( 489await foreach (var snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false)) 695public async IAsyncEnumerable<ResourceSnapshot> WatchResourcesV2Async( 705await foreach (var snapshot in WatchResourceSnapshotsAsync(includeHidden: true, cancellationToken).ConfigureAwait(false)) 720IAsyncEnumerable<ResourceSnapshot>? snapshots; 723snapshots = await rpc.InvokeStreamingWithProfilingAsync<ResourceSnapshot>( 740await foreach (var snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false))
Backchannel\BackchannelJsonSerializerContext.cs (5)
46[JsonSerializable(typeof(ResourceSnapshot))] 47[JsonSerializable(typeof(ResourceSnapshot[]))] 48[JsonSerializable(typeof(List<ResourceSnapshot>))] 49[JsonSerializable(typeof(IAsyncEnumerable<ResourceSnapshot>))] 50[JsonSerializable(typeof(MessageFormatterEnumerableTracker.EnumeratorResults<ResourceSnapshot>))]
Backchannel\IAppHostAuxiliaryBackchannel.cs (2)
92Task<List<ResourceSnapshot>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default); 100IAsyncEnumerable<ResourceSnapshot> WatchResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default);
Backchannel\ResourceSnapshotMapper.cs (27)
14/// Maps <see cref="ResourceSnapshot"/> to <see cref="ResourceJson"/> for serialization. 20/// <see cref="ResourceSnapshot.Name"/> and <see cref="ResourceSnapshot.DisplayName"/>. 22internal static IEnumerable<ResourceSnapshot> WhereMatchesResourceName(IEnumerable<ResourceSnapshot> snapshots, string resourceName) 29/// Maps a list of <see cref="ResourceSnapshot"/> to a list of <see cref="ResourceJson"/>. 35public static List<ResourceJson> MapToResourceJsonList(IEnumerable<ResourceSnapshot> snapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true, bool includeDisabledCommands = false) 42/// Maps a <see cref="ResourceSnapshot"/> to <see cref="ResourceJson"/>. 49public static ResourceJson MapToResourceJson(ResourceSnapshot snapshot, IReadOnlyList<ResourceSnapshot> allSnapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true, bool includeDisabledCommands = false) 101foreach (var match in matches) 173private static string[]? GetResolvedWaitingForDependencies(ResourceSnapshot snapshot, IReadOnlyList<ResourceSnapshot> allSnapshots) 302/// First tries an exact match on <see cref="ResourceSnapshot.Name"/>, then falls back 303/// to matching by <see cref="ResourceSnapshot.DisplayName"/> only when the display name is 309public static IReadOnlyList<ResourceSnapshot> ResolveResources(string resourceName, IReadOnlyList<ResourceSnapshot> snapshots) 336public static string GetResourceName(ResourceSnapshot resource, IDictionary<string, ResourceSnapshot> allResources) 348public static string GetResourceName(ResourceSnapshot resource, IEnumerable<ResourceSnapshot> allResources) 351foreach (var item in allResources) 376/// A resource is hidden if its <see cref="ResourceSnapshot.IsHidden"/> flag is set 377/// or its <see cref="ResourceSnapshot.State"/> is "Hidden". 379internal static bool IsHiddenResource(ResourceSnapshot snapshot) 394internal static (bool EffectiveIncludeHidden, List<ResourceSnapshot> Snapshots, HashSet<string> HiddenResourceNames) FilterHiddenResources( 395IReadOnlyList<ResourceSnapshot> allSnapshots,
Backchannel\ResourceSnapshotWatcher.cs (19)
19private readonly Dictionary<string, ResourceSnapshot> _resources = new(StringComparers.ResourceName); 111foreach (var snapshot in snapshots) 127List<ResourceSnapshot> snapshots; 157foreach (var snapshot in snapshots) 159if (!_resources.TryGetValue(snapshot.Name, out var currentSnapshot) || 174await foreach (var snapshot in _connection.WatchResourceSnapshotsAsync(includeHidden: true, cancellationToken).ConfigureAwait(false)) 181_resources.TryGetValue(snapshot.Name, out var currentSnapshot) && 296public ResourceSnapshot? GetResource(string name) 309public IReadOnlyList<ResourceSnapshot> GetResources() 318public IReadOnlyList<ResourceSnapshot> GetAllResources() 329ResourceSnapshot[] resources; 340private IReadOnlyList<ResourceSnapshot> GetResources(bool includeHidden) 344ResourceSnapshot[] resources; 353private ResourceSnapshot[] CopyResourcesNoLock() => [.. _resources.Values]; 355private static IReadOnlyList<ResourceSnapshot> FilterAndOrderResources( 356IEnumerable<ResourceSnapshot> resources, 383IReadOnlyList<ResourceSnapshot> Resources, 387IReadOnlyList<ResourceSnapshot> Snapshots, 392ResourceSnapshot Snapshot);
Backchannel\TrayResourceHealth.cs (4)
13public static string? Aggregate(IEnumerable<ResourceSnapshot> resources) 17foreach (var resource in resources) 40private static string? GetHealth(ResourceSnapshot resource) 95private static bool IsState(ResourceSnapshot resource, string state)
Commands\AppHostLauncher.cs (2)
820Task<List<ResourceSnapshot>> probeTask; 827probeTask = Task.FromException<List<ResourceSnapshot>>(ex);
Commands\DescribeCommand.cs (11)
230private int ExecuteSnapshot(IReadOnlyList<ResourceSnapshot> snapshots, string? dashboardBaseUrl, string? resourceName, ResourceOutputFormat format, bool includeDisabledCommands) 283void DisplaySnapshot(ResourceSnapshot snapshot, IReadOnlyList<ResourceSnapshot> currentSnapshots) 340foreach (var snapshot in currentSnapshots) 348var changedSnapshots = new List<ResourceSnapshot>(batch.Snapshots.Count); 349foreach (var snapshot in batch.Snapshots) 369foreach (var snapshot in changedSnapshots) 377private void DisplayResourcesTable(IReadOnlyList<ResourceSnapshot> snapshots, string? dashboardBaseUrl) 425private static ResourceDisplayState BuildResourceDisplayState(ResourceSnapshot snapshot, IReadOnlyList<ResourceSnapshot> allResources) 450internal static string GetSnapshotStateMarkup(ResourceSnapshot snapshot)
Commands\ExportCommand.cs (4)
155IReadOnlyList<ResourceSnapshot> snaps = connection is not null 231private static void AddResources(ExportArchive exportArchive, IReadOnlyList<ResourceSnapshot> snapshots, string? resourceName) 254IReadOnlyList<ResourceSnapshot> snapshots, 278var snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, name, StringComparisons.ResourceName));
Commands\LogsCommand.cs (5)
348var resource = resourceWatcher.GetResource(logLine.ResourceName); 403var resource = resourceWatcher.GetResource(logLine.ResourceName); 436private static LogEntry ParseLogLine(ResourceLogLine logLine, LogParser logParser, IEnumerable<ResourceSnapshot> snapshots) 498private static string ResolveResourceName(string resourceName, IEnumerable<ResourceSnapshot> snapshots) 500var snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, resourceName, StringComparisons.ResourceName));
Commands\McpToolsCommand.cs (2)
75foreach (var r in resourcesWithTools) 101foreach (var resource in resourcesWithTools)
Commands\TerminalResourceResolver.cs (1)
51var snapshot = matches[0];
Mcp\McpResourceToolRefreshService.cs (1)
99foreach (var resource in resourcesWithTools)
Mcp\Tools\ListResourcesTool.cs (13)
301private static Dictionary<string, McpResourceCommandJson> GetCommandMetadata(ResourceSnapshot snapshot) 337IReadOnlyList<ResourceSnapshot> snapshots) 340foreach (var snapshot in snapshots) 352foreach (var snapshot in snapshots) 361foreach (var snapshot in snapshots) 377IReadOnlyList<ResourceSnapshot> snapshots) 386foreach (var snapshot in snapshots) 391foreach (var snapshot in snapshots) 414ResourceSnapshot snapshot, 455ResourceSnapshot snapshot, 490private static string? GetDashboardUrl(ResourceSnapshot snapshot, string? dashboardBaseUrl) 501private static string? GetBoundedSource(ResourceSnapshot snapshot) 537private static string? GetStringProperty(ResourceSnapshot snapshot, string propertyName)
Mcp\Tools\McpToolHelpers.cs (2)
370internal static bool IsExcludedFromMcp(ResourceSnapshot snapshot) 463foreach (var snapshot in snapshots)
Mcp\Tools\WaitForResourcesTool.cs (5)
121List<ResourceSnapshot> snapshots; 337IReadOnlyList<ResourceSnapshot> snapshots) 341var runtimeMatch = snapshots.FirstOrDefault(snapshot => 368ResourceSnapshot snapshot, 408ResourceSnapshot? Resource,
src\Aspire.Hosting\Backchannel\BackchannelDataTypes.cs (1)
282public required ResourceSnapshot[] Resources { get; init; }
Aspire.Cli.Tests (120)
Backchannel\AppHostAuxiliaryBackchannelTests.cs (4)
27var snapshot = Assert.Single(snapshots); 46var resource = enumerator.Current; 232public async IAsyncEnumerable<ResourceSnapshot> WatchResourcesAsync(WatchResourcesRequest? request = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) 239private static ResourceSnapshot CreateResourceSnapshot() =>
Backchannel\ResourceSnapshotMapperTests.cs (23)
22var snapshot = JsonSerializer.Deserialize(json, BackchannelJsonSerializerContext.Default.ResourceSnapshot); 44var snapshot = JsonSerializer.Deserialize(json, BackchannelJsonSerializerContext.Default.ResourceSnapshot); 54var snapshot = new ResourceSnapshot 86var snapshot = new ResourceSnapshot 139var allSnapshots = new List<ResourceSnapshot> { snapshot }; 182var snapshot = new ResourceSnapshot 206var snapshot = new ResourceSnapshot 232var snapshot = new ResourceSnapshot 260var snapshot = new ResourceSnapshot 287var snapshot = new ResourceSnapshot 330var snapshot = new ResourceSnapshot 359var dependency = new ResourceSnapshot 367var resource = new ResourceSnapshot 385var resource = new ResourceSnapshot 417var firstDependency = new ResourceSnapshot 424var secondDependency = new ResourceSnapshot 432var resource = new ResourceSnapshot 450var snapshots = new List<ResourceSnapshot> 465var snapshots = new List<ResourceSnapshot> 480var snapshots = new List<ResourceSnapshot> 495var snapshots = new List<ResourceSnapshot> 511var snapshots = new List<ResourceSnapshot> 524var snapshots = new List<ResourceSnapshot>
Backchannel\ResourceSnapshotWatcherTests.cs (30)
25var getGate = new TaskCompletionSource<List<ResourceSnapshot>>(TaskCreationOptions.RunContinuationsAsynchronously); 40return duringInitialLoad ? getGate.Task : Task.FromResult(new List<ResourceSnapshot>()); 90async IAsyncEnumerable<ResourceSnapshot> Watch([EnumeratorCancellation] CancellationToken token) 197new List<ResourceSnapshot> 227var snapshot = Assert.Single(watcher.CaptureAllResources().Resources); 272var snapshot = Assert.Single(watcher.CaptureAllResources().Resources); 319var snapshot = Assert.Single(watcher.CaptureAllResources().Resources); 336new List<ResourceSnapshot> 383var retainedSnapshot = Assert.Single(staleCapture.Resources); 397var currentSnapshot = Assert.Single(watcher.CaptureAllResources().Resources); 402var update = Assert.Single(consumer.Current.Snapshots); 414GetResourceSnapshotsHandler = _ => Task.FromResult(new List<ResourceSnapshot>()), 474GetResourceSnapshotsHandler = _ => Task.FromResult(new List<ResourceSnapshot>()), 536var source = Channel.CreateUnbounded<ResourceSnapshot>(); 540GetResourceSnapshotsHandler = _ => Task.FromResult(new List<ResourceSnapshot>()), 556var firstSnapshot = new ResourceSnapshot 603foreach (var snapshot in batch.Snapshots) 645private static async IAsyncEnumerable<ResourceSnapshot> ReadSnapshotsAndSignalFirstApplied( 646ChannelReader<ResourceSnapshot> source, 651await foreach (var snapshot in source.ReadAllAsync(cancellationToken)) 665private static async IAsyncEnumerable<ResourceSnapshot> YieldSnapshotAndWait( 667ResourceSnapshot snapshot, 680private static async IAsyncEnumerable<ResourceSnapshot> YieldSnapshotsInSequence( 682ResourceSnapshot firstSnapshot, 685ResourceSnapshot secondSnapshot, 700private static async IAsyncEnumerable<ResourceSnapshot> ProduceResourceSnapshotsAfter( 703Func<int, ResourceSnapshot> createSnapshot, 718private static async IAsyncEnumerable<ResourceSnapshot> WaitForResourceSnapshotCancellation( 736private static async IAsyncEnumerable<ResourceSnapshot> WaitForResourceSnapshotGate( 755private static async IAsyncEnumerable<ResourceSnapshot> WaitForCancellationWithThrowingCallback(
Backchannel\TrayResourceHealthTests.cs (5)
34var resource = new ResourceSnapshot 53var resource = new ResourceSnapshot 71ResourceSnapshot[] resources = 89ResourceSnapshot[] resources = 109ResourceSnapshot[] resources =
Backchannel\TrayWatchStreamTests.cs (8)
725var resourceUpdates = Channel.CreateUnbounded<ResourceSnapshot>(); 797async IAsyncEnumerable<ResourceSnapshot> Watch(bool includeHidden, [EnumeratorCancellation] CancellationToken token) 803await foreach (var resource in resourceUpdates.Reader.ReadAllAsync(token)) 821var resourceUpdates = Channel.CreateUnbounded<ResourceSnapshot>(); 871var resourceUpdates = Channel.CreateUnbounded<ResourceSnapshot>(); 950async IAsyncEnumerable<ResourceSnapshot> Watch(bool includeHidden, [EnumeratorCancellation] CancellationToken token) 1065async IAsyncEnumerable<ResourceSnapshot> Watch([EnumeratorCancellation] CancellationToken token) 1116private static async IAsyncEnumerable<ResourceSnapshot> WatchUntilCanceled([EnumeratorCancellation] CancellationToken cancellationToken)
Commands\AgentMcpCommandTests.cs (6)
660return Task.FromResult(new List<ResourceSnapshot> 705return Task.FromResult(new List<ResourceSnapshot> 802return Task.FromResult(new List<ResourceSnapshot> 831GetResourceSnapshotsHandler = _ => Task.FromResult(new List<ResourceSnapshot> 923return Task.FromResult(new List<ResourceSnapshot> 1404return Task.FromResult(new List<ResourceSnapshot>
Commands\AppHostLauncherTests.cs (2)
489return Task.FromResult<List<ResourceSnapshot>>([]); 549return Task.FromResult<List<ResourceSnapshot>>([]);
Commands\DescribeCommandTests.cs (16)
38var snapshot = new ResourceSnapshot { Name = "resource", State = state, ExitCode = exitCode }; 613foreach (var snapshot in initialSnapshots) 1357List<ResourceSnapshot> resourceSnapshots, 1398private static async IAsyncEnumerable<ResourceSnapshot> ThrowObjectDisposedAfterSnapshot([EnumeratorCancellation] CancellationToken cancellationToken = default) 1414private static async IAsyncEnumerable<ResourceSnapshot> EmptyResourceSnapshots([EnumeratorCancellation] CancellationToken cancellationToken = default) 1421private static async IAsyncEnumerable<ResourceSnapshot> YieldResourceSnapshots( 1422IEnumerable<ResourceSnapshot> snapshots, 1425foreach (var snapshot in snapshots) 1433private static async IAsyncEnumerable<ResourceSnapshot> YieldResourceSnapshotsAfter( 1435IEnumerable<ResourceSnapshot> snapshots, 1439await foreach (var snapshot in YieldResourceSnapshots(snapshots, cancellationToken)) 1445private static async IAsyncEnumerable<ResourceSnapshot> YieldResourceSnapshotsImmediatelyAfter( 1447IEnumerable<ResourceSnapshot> snapshots, 1451foreach (var snapshot in snapshots) 1458private static async IAsyncEnumerable<ResourceSnapshot> YieldResourceAfterSignaling( 1477private static async IAsyncEnumerable<ResourceSnapshot> ThrowObjectDisposedAfterCancellationAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
Commands\ExportCommandTests.cs (1)
869List<ResourceSnapshot> resourceSnapshots,
Commands\LogsCommandTests.cs (3)
852? new List<ResourceSnapshot> 862: new List<ResourceSnapshot> 1631private static async IAsyncEnumerable<ResourceSnapshot> WatchWithLateHidden([EnumeratorCancellation] CancellationToken cancellationToken)
Commands\ResourceCommandTests.cs (2)
2342private static ResourceSnapshot CreateResourceSnapshot(string name, params ResourceSnapshotCommand[] commands) 2347private static ResourceSnapshot CreateResourceSnapshot(string name, string state, params ResourceSnapshotCommand[] commands)
Commands\TerminalCommandTests.cs (3)
818private static ResourceSnapshot CreateSnapshot(string name, string? displayName = null) 868public Task<List<ResourceSnapshot>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default) 870public IAsyncEnumerable<ResourceSnapshot> WatchResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
Mcp\ExcludeFromMcpTests.cs (5)
29var snapshot = new ResourceSnapshot 41var snapshot = new ResourceSnapshot 56var snapshot = new ResourceSnapshot 71var snapshot = new ResourceSnapshot 86var snapshot = new ResourceSnapshot
Mcp\ListResourcesToolTests.cs (2)
1196private static TestAppHostAuxiliaryBackchannel CreateConnection(params ResourceSnapshot[] snapshots) 1199private static TestAppHostAuxiliaryBackchannel CreateConnection(string appHostPath, params ResourceSnapshot[] snapshots)
Mcp\WaitForResourcesToolTests.cs (3)
251ResourceSnapshot[] snapshots = includeUnavailableResources 757Task.FromCanceled<List<ResourceSnapshot>>(cancellationToken); 798private static TestAppHostAuxiliaryBackchannel CreateConnection(params ResourceSnapshot[] snapshots)
TestServices\TestAppHostAuxiliaryBackchannel.cs (7)
47public List<ResourceSnapshot> ResourceSnapshots { get; set; } = []; 87public Func<CancellationToken, Task<List<ResourceSnapshot>>>? GetResourceSnapshotsHandler { get; set; } 109public Func<bool, CancellationToken, IAsyncEnumerable<ResourceSnapshot>>? WatchResourceSnapshotsHandler { get; set; } 177public Task<List<ResourceSnapshot>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default) 193public async IAsyncEnumerable<ResourceSnapshot> WatchResourceSnapshotsAsync(bool includeHidden, [EnumeratorCancellation] CancellationToken cancellationToken = default) 197await foreach (var snapshot in WatchResourceSnapshotsHandler(includeHidden, cancellationToken).WithCancellation(cancellationToken).ConfigureAwait(false)) 204foreach (var snapshot in ResourceSnapshots)