249 instantiations of ResourceSnapshot
Aspire.Cli.Tests (249)
Backchannel\AppHostAuxiliaryBackchannelTests.cs (1)
240
new
()
Backchannel\ResourceSnapshotMapperTests.cs (25)
37
var snapshot = new
ResourceSnapshot
133
var snapshot = new
ResourceSnapshot
157
var snapshot = new
ResourceSnapshot
183
var snapshot = new
ResourceSnapshot
211
var snapshot = new
ResourceSnapshot
238
var snapshot = new
ResourceSnapshot
281
var snapshot = new
ResourceSnapshot
310
var dependency = new
ResourceSnapshot
318
var resource = new
ResourceSnapshot
336
var resource = new
ResourceSnapshot
368
var firstDependency = new
ResourceSnapshot
375
var secondDependency = new
ResourceSnapshot
383
var resource = new
ResourceSnapshot
403
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" },
404
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
418
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" },
419
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
433
new
() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" },
434
new
() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" },
435
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
448
new
() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" },
449
new
() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" },
450
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
464
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" }
477
new
() { Name = "Cache-Zuyppzgw", DisplayName = "Cache", ResourceType = "Container", State = "Running" }
Backchannel\ResourceSnapshotWatcherTests.cs (12)
199
new
ResourceSnapshot
211
new
ResourceSnapshot
244
new
ResourceSnapshot
257
new
ResourceSnapshot
291
new
ResourceSnapshot
304
new
ResourceSnapshot
338
new
()
350
new
ResourceSnapshot
360
new
ResourceSnapshot
485
return new
ResourceSnapshot
556
var firstSnapshot = new
ResourceSnapshot
582
await source.Writer.WriteAsync(new
ResourceSnapshot
Backchannel\TrayResourceHealthTests.cs (11)
34
var resource = new
ResourceSnapshot
53
var resource = new
ResourceSnapshot
73
new
() { Name = "hidden-state", State = "Hidden", HealthStatus = "Unhealthy" },
74
new
() { Name = "hidden-flag", State = "FailedToStart", IsHidden = true },
75
new
() { Name = "parameter", ResourceType = "Parameter", State = "Active" },
76
new
() { Name = "connection", ResourceType = "ConnectionString" },
77
new
() { Name = "setup", State = "Finished", ExitCode = 0 }
82
[.. resources,
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }]));
92
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" },
93
new
() { Name = "worker", State = "Waiting" },
94
new
() { Name = "database", State = "Running", HealthStatus = "Unhealthy" }
Backchannel\TrayWatchStreamTests.cs (14)
674
new
() { Name = "api", State = "Starting", Version = 1 },
675
new
() { Name = "cache", State = "Running", HealthStatus = "Healthy", Version = 1 }
700
resourceUpdates.Writer.TryWrite(
new
() { Name = "api", State = "Running", HealthStatus = "Healthy", Version = 2 });
703
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Degraded", Version = 2 });
706
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Unhealthy", Version = 3 });
709
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Healthy", Version = 4 });
712
resourceUpdates.Writer.TryWrite(
new
() { Name = "api", State = "Running", HealthStatus = "Unhealthy", Version = 1 });
713
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "FailedToStart", Version = 5 });
716
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "FailedToStart", IsHidden = true, Version = 6 });
766
connection.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
807
initial.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
810
replacement.ResourceSnapshots = [
new
() { Name = "api", State = "Waiting" }];
873
initial.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
876
replacement.ResourceSnapshots = [
new
() { Name = "api", State = "Waiting" }];
Commands\AgentMcpCommandTests.cs (14)
237
new
ResourceSnapshot
301
new
ResourceSnapshot
378
new
ResourceSnapshot
511
new
ResourceSnapshot
662
new
ResourceSnapshot
707
new
ResourceSnapshot
804
new
()
833
new
()
925
new
()
1123
new
ResourceSnapshot
1204
new
ResourceSnapshot
1406
new
ResourceSnapshot
1835
new
ResourceSnapshot
1950
new
ResourceSnapshot
Commands\DescribeCommandTests.cs (50)
276
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
284
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
286
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
288
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
328
.Select(index => new
ResourceSnapshot
338
new
ResourceSnapshot
345
new
ResourceSnapshot
408
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
444
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
445
new
ResourceSnapshot
{ Name = "postgres", DisplayName = "postgres", ResourceType = "Container", State = "Running" },
446
new
ResourceSnapshot
{ Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" },
471
new
ResourceSnapshot
537
new
ResourceSnapshot
{ Name = "redis", Version = 1, DisplayName = "redis", ResourceType = "Container", State = "Starting" },
576
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
585
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
587
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
589
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
620
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
650
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
674
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
702
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
730
new
ResourceSnapshot
772
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
803
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
804
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
805
new
ResourceSnapshot
{ Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true },
829
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
830
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
831
new
ResourceSnapshot
{ Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true },
857
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
858
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
882
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
883
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
910
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
911
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
940
new
ResourceSnapshot
955
new
ResourceSnapshot
{ Name = "api-2", DisplayName = "api", ResourceType = "Project", State = "Running" },
956
new
ResourceSnapshot
{ Name = "api-1", DisplayName = "api", ResourceType = "Project", State = "Running" },
957
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Running", IsHidden = true },
958
new
ResourceSnapshot
{ Name = "connection", DisplayName = "connection", ResourceType = "Parameter", State = "Running" }
975
new
ResourceSnapshot
997
new
ResourceSnapshot
1002
new
ResourceSnapshot
{ Name = "api-2", DisplayName = "api", ResourceType = "Project", State = "Running" },
1003
new
ResourceSnapshot
{ Name = "api-1", DisplayName = "api", ResourceType = "Project", State = "Running" }
1020
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Hidden" },
1021
new
ResourceSnapshot
{ Name = "connection", DisplayName = "connection", ResourceType = "Parameter", State = "Running" }
1052
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Running" }
1129
yield return new
ResourceSnapshot
1195
yield return new
ResourceSnapshot
1208
yield return new
ResourceSnapshot
Commands\ExportCommandTests.cs (26)
50
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
51
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
127
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
204
new
ResourceSnapshot
{ Name = "other-resource", DisplayName = "other-resource", ResourceType = "Project", State = "Running" },
227
new
ResourceSnapshot
{ Name = "target-resource", DisplayName = "target-resource", ResourceType = "Container", State = "Running" },
330
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
331
new
ResourceSnapshot
{ Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
332
new
ResourceSnapshot
{ Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
450
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
451
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
507
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
508
new
ResourceSnapshot
{ Name = "webfrontend", DisplayName = "webfrontend", ResourceType = "Project", State = "Running" },
565
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
566
new
ResourceSnapshot
{ Name = "apiservice-abc", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
567
new
ResourceSnapshot
{ Name = "apiservice-def", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
615
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
616
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
617
new
ResourceSnapshot
{ Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true },
659
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
660
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
703
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
704
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
745
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
781
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
824
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
825
new
ResourceSnapshot
{ Name = "apiservice", DisplayName = "apiservice", ResourceType = "Project", State = "Running" },
Commands\LogsCommandTests.cs (12)
733
new
ResourceSnapshot
740
new
ResourceSnapshot
823
new
ResourceSnapshot
854
new
()
864
new
()
871
new
()
990
new
ResourceSnapshot
997
new
ResourceSnapshot
1554
new
ResourceSnapshot
1562
new
ResourceSnapshot
1569
new
ResourceSnapshot
1633
yield return new
ResourceSnapshot
Commands\ResourceCommandTests.cs (1)
2349
return new
ResourceSnapshot
Commands\TerminalCommandTests.cs (1)
793
return new
ResourceSnapshot
Commands\TerminalTapePlayCommandTests.cs (1)
508
new
ResourceSnapshot
{ Name = "shell-0", DisplayName = "shell", ResourceType = "Executable", State = "Running" }
Mcp\ExcludeFromMcpTests.cs (15)
29
var snapshot = new
ResourceSnapshot
41
var snapshot = new
ResourceSnapshot
56
var snapshot = new
ResourceSnapshot
71
var snapshot = new
ResourceSnapshot
86
var snapshot = new
ResourceSnapshot
107
new
ResourceSnapshot
123
new
ResourceSnapshot
165
new
ResourceSnapshot
211
new
ResourceSnapshot
249
new
ResourceSnapshot
283
new
ResourceSnapshot
422
new
ResourceSnapshot
429
new
ResourceSnapshot
470
new
ResourceSnapshot
477
new
ResourceSnapshot
Mcp\ListResourcesToolTests.cs (42)
76
CreateConnection(new
ResourceSnapshot
102
new
ResourceSnapshot
122
new
ResourceSnapshot
129
new
ResourceSnapshot
136
new
ResourceSnapshot
172
new
ResourceSnapshot
187
new
ResourceSnapshot
194
new
ResourceSnapshot
229
new
ResourceSnapshot
237
new
ResourceSnapshot
244
new
ResourceSnapshot
309
new
ResourceSnapshot
316
new
ResourceSnapshot
323
new
ResourceSnapshot
387
var connection = CreateConnection(names.Reverse().Select(name => new
ResourceSnapshot
392
connection.ResourceSnapshots.Insert(0, new
ResourceSnapshot
{ Name = "hidden", IsHidden = true });
393
connection.ResourceSnapshots.Insert(1, new
ResourceSnapshot
{ Name = "hidden-state", State = "Hidden" });
394
connection.ResourceSnapshots.Insert(2, new
ResourceSnapshot
445
new
ResourceSnapshot
{ Name = "first" },
446
new
ResourceSnapshot
{ Name = "second" },
447
new
ResourceSnapshot
{ Name = "third" }));
474
var snapshots = Enumerable.Range(0, 300).Select(index => new
ResourceSnapshot
478
snapshots.Insert(0, new
ResourceSnapshot
487
snapshots.Add(new
ResourceSnapshot
{ Name = "redis-visible", DisplayName = "Redis" });
488
snapshots.Add(new
ResourceSnapshot
{ Name = "redis-hidden", DisplayName = "Redis", IsHidden = true });
506
monitor.AddConnection("hash1", "socket.hash1", CreateConnection(new
ResourceSnapshot
590
monitor.AddConnection("hash1", "socket.hash1", CreateConnection(new
ResourceSnapshot
{ Name = "api", Commands = commands }));
637
CreateConnection(new
ResourceSnapshot
664
var snapshots = resourceNames.Select((name, index) => new
ResourceSnapshot
724
new
ResourceSnapshot
734
new
ResourceSnapshot
762
new
ResourceSnapshot
773
new
ResourceSnapshot
784
new
ResourceSnapshot
813
CreateConnection(new
ResourceSnapshot
840
CreateConnection(new
ResourceSnapshot
884
new
ResourceSnapshot
963
new
ResourceSnapshot
975
new
ResourceSnapshot
985
new
ResourceSnapshot
995
new
ResourceSnapshot
1053
CreateConnection(new
ResourceSnapshot
Mcp\WaitForResourcesToolTests.cs (24)
89
new
ResourceSnapshot
96
new
ResourceSnapshot
102
new
ResourceSnapshot
155
.Select(index => new
ResourceSnapshot
183
var connection = CreateConnection(new
ResourceSnapshot
217
var connection = CreateConnection(new
ResourceSnapshot
254
new
ResourceSnapshot
260
new
ResourceSnapshot
307
new
ResourceSnapshot
313
new
ResourceSnapshot
362
new
ResourceSnapshot
369
new
ResourceSnapshot
380
new
ResourceSnapshot
386
new
ResourceSnapshot
483
responses.Keys.Select(static name => new
ResourceSnapshot
540
new
ResourceSnapshot
{ Name = "ready", State = "Running" },
541
new
ResourceSnapshot
{ Name = "slow", State = "Starting" });
568
new
ResourceSnapshot
611
new
ResourceSnapshot
{ Name = "api", State = "Starting" },
612
new
ResourceSnapshot
{ Name = "worker", State = "Starting" },
613
new
ResourceSnapshot
{ Name = "database", State = "Starting" });
693
new
ResourceSnapshot
{ Name = "api", State = "Starting" },
694
new
ResourceSnapshot
{ Name = "worker", State = "Starting" });
775
var connection = CreateConnection(new
ResourceSnapshot
{ Name = "api", State = "Starting" });
229 references to ResourceSnapshot
aspire (114)
Backchannel\AppHostAuxiliaryBackchannel.cs (12)
397
public async Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
421
var snapshots = await rpc.InvokeWithProfilingAsync<List<
ResourceSnapshot
>>(
444
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync(bool includeHidden, [EnumeratorCancellation] CancellationToken cancellationToken = default)
448
await foreach (
var
snapshot in WatchResourcesV2Async(new WatchResourcesRequest
468
IAsyncEnumerable<
ResourceSnapshot
>? snapshots;
471
snapshots = await rpc.InvokeStreamingWithProfilingAsync<
ResourceSnapshot
>(
489
await foreach (
var
snapshot in snapshots.WithCancellation(cancellationToken).ConfigureAwait(false))
695
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourcesV2Async(
705
await foreach (
var
snapshot in WatchResourceSnapshotsAsync(includeHidden: true, cancellationToken).ConfigureAwait(false))
720
IAsyncEnumerable<
ResourceSnapshot
>? snapshots;
723
snapshots = await rpc.InvokeStreamingWithProfilingAsync<
ResourceSnapshot
>(
740
await 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)
92
Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default);
100
IAsyncEnumerable<
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"/>.
22
internal static IEnumerable<
ResourceSnapshot
> WhereMatchesResourceName(IEnumerable<
ResourceSnapshot
> snapshots, string resourceName)
29
/// Maps a list of <see cref="
ResourceSnapshot
"/> to a list of <see cref="ResourceJson"/>.
35
public 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"/>.
49
public static ResourceJson MapToResourceJson(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allSnapshots, string? dashboardBaseUrl = null, bool includeEnvironmentVariableValues = true, bool includeDisabledCommands = false)
101
foreach (
var
match in matches)
172
private static string[]? GetResolvedWaitingForDependencies(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allSnapshots)
301
/// First tries an exact match on <see cref="
ResourceSnapshot
.Name"/>, then falls back
302
/// to matching by <see cref="
ResourceSnapshot
.DisplayName"/> only when the display name is
308
public static IReadOnlyList<
ResourceSnapshot
> ResolveResources(string resourceName, IReadOnlyList<
ResourceSnapshot
> snapshots)
335
public static string GetResourceName(
ResourceSnapshot
resource, IDictionary<string,
ResourceSnapshot
> allResources)
347
public static string GetResourceName(
ResourceSnapshot
resource, IEnumerable<
ResourceSnapshot
> allResources)
350
foreach (
var
item in allResources)
375
/// A resource is hidden if its <see cref="
ResourceSnapshot
.IsHidden"/> flag is set
376
/// or its <see cref="
ResourceSnapshot
.State"/> is "Hidden".
378
internal static bool IsHiddenResource(
ResourceSnapshot
snapshot)
393
internal static (bool EffectiveIncludeHidden, List<
ResourceSnapshot
> Snapshots, HashSet<string> HiddenResourceNames) FilterHiddenResources(
394
IReadOnlyList<
ResourceSnapshot
> allSnapshots,
Backchannel\ResourceSnapshotWatcher.cs (19)
19
private readonly Dictionary<string,
ResourceSnapshot
> _resources = new(StringComparers.ResourceName);
111
foreach (
var
snapshot in snapshots)
127
List<
ResourceSnapshot
> snapshots;
157
foreach (
var
snapshot in snapshots)
159
if (!_resources.TryGetValue(snapshot.Name, out
var
currentSnapshot) ||
174
await foreach (
var
snapshot in _connection.WatchResourceSnapshotsAsync(includeHidden: true, cancellationToken).ConfigureAwait(false))
181
_resources.TryGetValue(snapshot.Name, out
var
currentSnapshot) &&
296
public
ResourceSnapshot
? GetResource(string name)
309
public IReadOnlyList<
ResourceSnapshot
> GetResources()
318
public IReadOnlyList<
ResourceSnapshot
> GetAllResources()
329
ResourceSnapshot
[] resources;
340
private IReadOnlyList<
ResourceSnapshot
> GetResources(bool includeHidden)
344
ResourceSnapshot
[] resources;
353
private
ResourceSnapshot
[] CopyResourcesNoLock() => [.. _resources.Values];
355
private static IReadOnlyList<
ResourceSnapshot
> FilterAndOrderResources(
356
IEnumerable<
ResourceSnapshot
> resources,
383
IReadOnlyList<
ResourceSnapshot
> Resources,
387
IReadOnlyList<
ResourceSnapshot
> Snapshots,
392
ResourceSnapshot
Snapshot);
Backchannel\TrayResourceHealth.cs (4)
13
public static string? Aggregate(IEnumerable<
ResourceSnapshot
> resources)
16
foreach (
var
resource in resources)
36
private static string? GetHealth(
ResourceSnapshot
resource)
82
private static bool IsState(
ResourceSnapshot
resource, string state)
Commands\AppHostLauncher.cs (2)
801
Task<List<
ResourceSnapshot
>> probeTask;
808
probeTask = Task.FromException<List<
ResourceSnapshot
>>(ex);
Commands\DescribeCommand.cs (10)
209
private int ExecuteSnapshot(IReadOnlyList<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl, string? resourceName, ResourceOutputFormat format, bool includeDisabledCommands)
262
void DisplaySnapshot(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> currentSnapshots)
319
foreach (
var
snapshot in currentSnapshots)
327
var changedSnapshots = new List<
ResourceSnapshot
>(batch.Snapshots.Count);
328
foreach (
var
snapshot in batch.Snapshots)
348
foreach (
var
snapshot in changedSnapshots)
356
private void DisplayResourcesTable(IReadOnlyList<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl)
404
private static ResourceDisplayState BuildResourceDisplayState(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> allResources)
Commands\ExportCommand.cs (4)
155
IReadOnlyList<
ResourceSnapshot
> snaps = connection is not null
231
private static void AddResources(ExportArchive exportArchive, IReadOnlyList<
ResourceSnapshot
> snapshots, string? resourceName)
254
IReadOnlyList<
ResourceSnapshot
> snapshots,
278
var
snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, name, StringComparisons.ResourceName));
Commands\LogsCommand.cs (5)
348
var
resource = resourceWatcher.GetResource(logLine.ResourceName);
403
var
resource = resourceWatcher.GetResource(logLine.ResourceName);
436
private static LogEntry ParseLogLine(ResourceLogLine logLine, LogParser logParser, IEnumerable<
ResourceSnapshot
> snapshots)
498
private static string ResolveResourceName(string resourceName, IEnumerable<
ResourceSnapshot
> snapshots)
500
var
snapshot = snapshots.FirstOrDefault(s => string.Equals(s.Name, resourceName, StringComparisons.ResourceName));
Commands\McpToolsCommand.cs (2)
75
foreach (
var
r in resourcesWithTools)
101
foreach (
var
resource in resourcesWithTools)
Mcp\McpResourceToolRefreshService.cs (1)
99
foreach (
var
resource in resourcesWithTools)
Mcp\Tools\ListResourcesTool.cs (13)
299
private static Dictionary<string, McpResourceCommandJson> GetCommandMetadata(
ResourceSnapshot
snapshot)
335
IReadOnlyList<
ResourceSnapshot
> snapshots)
338
foreach (
var
snapshot in snapshots)
350
foreach (
var
snapshot in snapshots)
359
foreach (
var
snapshot in snapshots)
375
IReadOnlyList<
ResourceSnapshot
> snapshots)
384
foreach (
var
snapshot in snapshots)
389
foreach (
var
snapshot in snapshots)
412
ResourceSnapshot
snapshot,
453
ResourceSnapshot
snapshot,
488
private static string? GetDashboardUrl(
ResourceSnapshot
snapshot, string? dashboardBaseUrl)
499
private static string? GetBoundedSource(
ResourceSnapshot
snapshot)
535
private static string? GetStringProperty(
ResourceSnapshot
snapshot, string propertyName)
Mcp\Tools\McpToolHelpers.cs (2)
370
internal static bool IsExcludedFromMcp(
ResourceSnapshot
snapshot)
463
foreach (
var
snapshot in snapshots)
Mcp\Tools\WaitForResourcesTool.cs (5)
121
List<
ResourceSnapshot
> snapshots;
337
IReadOnlyList<
ResourceSnapshot
> snapshots)
341
var
runtimeMatch = snapshots.FirstOrDefault(snapshot =>
368
ResourceSnapshot
snapshot,
408
ResourceSnapshot
? Resource,
src\Aspire.Hosting\Backchannel\BackchannelDataTypes.cs (1)
282
public required
ResourceSnapshot
[] Resources { get; init; }
Aspire.Cli.Tests (115)
Backchannel\AppHostAuxiliaryBackchannelTests.cs (4)
27
var
snapshot = Assert.Single(snapshots);
46
var
resource = enumerator.Current;
232
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourcesAsync(WatchResourcesRequest? request = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
239
private static
ResourceSnapshot
CreateResourceSnapshot() =>
Backchannel\ResourceSnapshotMapperTests.cs (21)
27
var
snapshot = JsonSerializer.Deserialize(json, BackchannelJsonSerializerContext.Default.ResourceSnapshot);
37
var
snapshot = new ResourceSnapshot
90
var allSnapshots = new List<
ResourceSnapshot
> { snapshot };
133
var
snapshot = new ResourceSnapshot
157
var
snapshot = new ResourceSnapshot
183
var
snapshot = new ResourceSnapshot
211
var
snapshot = new ResourceSnapshot
238
var
snapshot = new ResourceSnapshot
281
var
snapshot = new ResourceSnapshot
310
var
dependency = new ResourceSnapshot
318
var
resource = new ResourceSnapshot
336
var
resource = new ResourceSnapshot
368
var
firstDependency = new ResourceSnapshot
375
var
secondDependency = new ResourceSnapshot
383
var
resource = new ResourceSnapshot
401
var snapshots = new List<
ResourceSnapshot
>
416
var snapshots = new List<
ResourceSnapshot
>
431
var snapshots = new List<
ResourceSnapshot
>
446
var snapshots = new List<
ResourceSnapshot
>
462
var snapshots = new List<
ResourceSnapshot
>
475
var snapshots = new List<
ResourceSnapshot
>
Backchannel\ResourceSnapshotWatcherTests.cs (30)
25
var getGate = new TaskCompletionSource<List<
ResourceSnapshot
>>(TaskCreationOptions.RunContinuationsAsynchronously);
40
return duringInitialLoad ? getGate.Task : Task.FromResult(new List<
ResourceSnapshot
>());
90
async IAsyncEnumerable<
ResourceSnapshot
> Watch([EnumeratorCancellation] CancellationToken token)
197
new List<
ResourceSnapshot
>
227
var
snapshot = Assert.Single(watcher.CaptureAllResources().Resources);
272
var
snapshot = Assert.Single(watcher.CaptureAllResources().Resources);
319
var
snapshot = Assert.Single(watcher.CaptureAllResources().Resources);
336
new List<
ResourceSnapshot
>
383
var
retainedSnapshot = Assert.Single(staleCapture.Resources);
397
var
currentSnapshot = Assert.Single(watcher.CaptureAllResources().Resources);
402
var
update = Assert.Single(consumer.Current.Snapshots);
414
GetResourceSnapshotsHandler = _ => Task.FromResult(new List<
ResourceSnapshot
>()),
474
GetResourceSnapshotsHandler = _ => Task.FromResult(new List<
ResourceSnapshot
>()),
536
var source = Channel.CreateUnbounded<
ResourceSnapshot
>();
540
GetResourceSnapshotsHandler = _ => Task.FromResult(new List<
ResourceSnapshot
>()),
556
var
firstSnapshot = new ResourceSnapshot
603
foreach (
var
snapshot in batch.Snapshots)
645
private static async IAsyncEnumerable<
ResourceSnapshot
> ReadSnapshotsAndSignalFirstApplied(
646
ChannelReader<
ResourceSnapshot
> source,
651
await foreach (
var
snapshot in source.ReadAllAsync(cancellationToken))
665
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldSnapshotAndWait(
667
ResourceSnapshot
snapshot,
680
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldSnapshotsInSequence(
682
ResourceSnapshot
firstSnapshot,
685
ResourceSnapshot
secondSnapshot,
700
private static async IAsyncEnumerable<
ResourceSnapshot
> ProduceResourceSnapshotsAfter(
703
Func<int,
ResourceSnapshot
> createSnapshot,
718
private static async IAsyncEnumerable<
ResourceSnapshot
> WaitForResourceSnapshotCancellation(
736
private static async IAsyncEnumerable<
ResourceSnapshot
> WaitForResourceSnapshotGate(
755
private static async IAsyncEnumerable<
ResourceSnapshot
> WaitForCancellationWithThrowingCallback(
Backchannel\TrayResourceHealthTests.cs (4)
34
var
resource = new ResourceSnapshot
53
var
resource = new ResourceSnapshot
71
ResourceSnapshot
[] resources =
90
ResourceSnapshot
[] resources =
Backchannel\TrayWatchStreamTests.cs (7)
667
var resourceUpdates = Channel.CreateUnbounded<
ResourceSnapshot
>();
739
async IAsyncEnumerable<
ResourceSnapshot
> Watch(bool includeHidden, [EnumeratorCancellation] CancellationToken token)
745
await foreach (
var
resource in resourceUpdates.Reader.ReadAllAsync(token))
763
var resourceUpdates = Channel.CreateUnbounded<
ResourceSnapshot
>();
842
async IAsyncEnumerable<
ResourceSnapshot
> Watch(bool includeHidden, [EnumeratorCancellation] CancellationToken token)
957
async IAsyncEnumerable<
ResourceSnapshot
> Watch([EnumeratorCancellation] CancellationToken token)
1008
private static async IAsyncEnumerable<
ResourceSnapshot
> WatchUntilCanceled([EnumeratorCancellation] CancellationToken cancellationToken)
Commands\AgentMcpCommandTests.cs (6)
660
return Task.FromResult(new List<
ResourceSnapshot
>
705
return Task.FromResult(new List<
ResourceSnapshot
>
802
return Task.FromResult(new List<
ResourceSnapshot
>
831
GetResourceSnapshotsHandler = _ => Task.FromResult(new List<
ResourceSnapshot
>
923
return Task.FromResult(new List<
ResourceSnapshot
>
1404
return Task.FromResult(new List<
ResourceSnapshot
>
Commands\AppHostLauncherTests.cs (2)
489
return Task.FromResult<List<
ResourceSnapshot
>>([]);
549
return Task.FromResult<List<
ResourceSnapshot
>>([]);
Commands\DescribeCommandTests.cs (15)
390
foreach (
var
snapshot in initialSnapshots)
1086
List<
ResourceSnapshot
> resourceSnapshots,
1127
private static async IAsyncEnumerable<
ResourceSnapshot
> ThrowObjectDisposedAfterSnapshot([EnumeratorCancellation] CancellationToken cancellationToken = default)
1143
private static async IAsyncEnumerable<
ResourceSnapshot
> EmptyResourceSnapshots([EnumeratorCancellation] CancellationToken cancellationToken = default)
1150
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshots(
1151
IEnumerable<
ResourceSnapshot
> snapshots,
1154
foreach (
var
snapshot in snapshots)
1162
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshotsAfter(
1164
IEnumerable<
ResourceSnapshot
> snapshots,
1168
await foreach (
var
snapshot in YieldResourceSnapshots(snapshots, cancellationToken))
1174
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshotsImmediatelyAfter(
1176
IEnumerable<
ResourceSnapshot
> snapshots,
1180
foreach (
var
snapshot in snapshots)
1187
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceAfterSignaling(
1206
private static async IAsyncEnumerable<
ResourceSnapshot
> ThrowObjectDisposedAfterCancellationAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
Commands\ExportCommandTests.cs (1)
869
List<
ResourceSnapshot
> resourceSnapshots,
Commands\LogsCommandTests.cs (3)
852
? new List<
ResourceSnapshot
>
862
: new List<
ResourceSnapshot
>
1631
private static async IAsyncEnumerable<
ResourceSnapshot
> WatchWithLateHidden([EnumeratorCancellation] CancellationToken cancellationToken)
Commands\ResourceCommandTests.cs (2)
2342
private static
ResourceSnapshot
CreateResourceSnapshot(string name, params ResourceSnapshotCommand[] commands)
2347
private static
ResourceSnapshot
CreateResourceSnapshot(string name, string state, params ResourceSnapshotCommand[] commands)
Commands\TerminalCommandTests.cs (3)
791
private static
ResourceSnapshot
CreateSnapshot(string name, string? displayName = null)
841
public Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
843
public IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
Mcp\ExcludeFromMcpTests.cs (5)
29
var
snapshot = new ResourceSnapshot
41
var
snapshot = new ResourceSnapshot
56
var
snapshot = new ResourceSnapshot
71
var
snapshot = new ResourceSnapshot
86
var
snapshot = new ResourceSnapshot
Mcp\ListResourcesToolTests.cs (2)
1193
private static TestAppHostAuxiliaryBackchannel CreateConnection(params
ResourceSnapshot
[] snapshots)
1196
private static TestAppHostAuxiliaryBackchannel CreateConnection(string appHostPath, params
ResourceSnapshot
[] snapshots)
Mcp\WaitForResourcesToolTests.cs (3)
251
ResourceSnapshot
[] snapshots = includeUnavailableResources
757
Task.FromCanceled<List<
ResourceSnapshot
>>(cancellationToken);
798
private static TestAppHostAuxiliaryBackchannel CreateConnection(params
ResourceSnapshot
[] snapshots)
TestServices\TestAppHostAuxiliaryBackchannel.cs (7)
47
public List<
ResourceSnapshot
> ResourceSnapshots { get; set; } = [];
87
public Func<CancellationToken, Task<List<
ResourceSnapshot
>>>? GetResourceSnapshotsHandler { get; set; }
109
public Func<bool, CancellationToken, IAsyncEnumerable<
ResourceSnapshot
>>? WatchResourceSnapshotsHandler { get; set; }
177
public Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
193
public async IAsyncEnumerable<
ResourceSnapshot
> WatchResourceSnapshotsAsync(bool includeHidden, [EnumeratorCancellation] CancellationToken cancellationToken = default)
197
await foreach (
var
snapshot in WatchResourceSnapshotsHandler(includeHidden, cancellationToken).WithCancellation(cancellationToken).ConfigureAwait(false))
204
foreach (
var
snapshot in ResourceSnapshots)