275 instantiations of ResourceSnapshot
Aspire.Cli.Tests (275)
Backchannel\AppHostAuxiliaryBackchannelTests.cs (1)
240
new
()
Backchannel\ResourceSnapshotMapperTests.cs (26)
38
var snapshot = new
ResourceSnapshot
70
var snapshot = new
ResourceSnapshot
166
var snapshot = new
ResourceSnapshot
190
var snapshot = new
ResourceSnapshot
216
var snapshot = new
ResourceSnapshot
244
var snapshot = new
ResourceSnapshot
271
var snapshot = new
ResourceSnapshot
314
var snapshot = new
ResourceSnapshot
343
var dependency = new
ResourceSnapshot
351
var resource = new
ResourceSnapshot
369
var resource = new
ResourceSnapshot
401
var firstDependency = new
ResourceSnapshot
408
var secondDependency = new
ResourceSnapshot
416
var resource = new
ResourceSnapshot
436
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" },
437
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
451
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" },
452
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
466
new
() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" },
467
new
() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" },
468
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
481
new
() { Name = "cache-abc12345", DisplayName = "cache", ResourceType = "Container", State = "Running" },
482
new
() { Name = "cache-def67890", DisplayName = "cache", ResourceType = "Container", State = "Running" },
483
new
() { Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" }
497
new
() { Name = "cache-zuyppzgw", DisplayName = "cache", ResourceType = "Container", State = "Running" }
510
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 (13)
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" }]));
90
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" },
92
new
()
110
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" },
111
new
() { Name = "worker", State = "Waiting" },
112
new
() { Name = "database", State = "Running", HealthStatus = "Unhealthy" }
Backchannel\TrayWatchStreamTests.cs (14)
732
new
() { Name = "api", State = "Starting", Version = 1 },
733
new
() { Name = "cache", State = "Running", HealthStatus = "Healthy", Version = 1 }
758
resourceUpdates.Writer.TryWrite(
new
() { Name = "api", State = "Running", HealthStatus = "Healthy", Version = 2 });
761
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Degraded", Version = 2 });
764
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Unhealthy", Version = 3 });
767
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "Running", HealthStatus = "Healthy", Version = 4 });
770
resourceUpdates.Writer.TryWrite(
new
() { Name = "api", State = "Running", HealthStatus = "Unhealthy", Version = 1 });
771
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "FailedToStart", Version = 5 });
774
resourceUpdates.Writer.TryWrite(
new
() { Name = "cache", State = "FailedToStart", IsHidden = true, Version = 6 });
824
connection.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
865
initial.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
868
replacement.ResourceSnapshots = [
new
() { Name = "api", State = "Waiting" }];
931
initial.ResourceSnapshots = [
new
() { Name = "api", State = "Running", HealthStatus = "Healthy" }];
934
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)
386
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
394
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
396
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
398
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
438
.Select(index => new
ResourceSnapshot
448
new
ResourceSnapshot
455
new
ResourceSnapshot
518
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
554
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
555
new
ResourceSnapshot
{ Name = "postgres", DisplayName = "postgres", ResourceType = "Container", State = "Running" },
556
new
ResourceSnapshot
{ Name = "frontend", DisplayName = "frontend", ResourceType = "Project", State = "Running" },
581
new
ResourceSnapshot
647
new
ResourceSnapshot
{ Name = "redis", Version = 1, DisplayName = "redis", ResourceType = "Container", State = "Starting" },
686
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
695
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
697
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
699
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Stopping" },
730
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
760
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
784
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
812
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
840
new
ResourceSnapshot
882
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
913
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
914
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
915
new
ResourceSnapshot
{ Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true },
939
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
940
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
941
new
ResourceSnapshot
{ Name = "hidden-svc", DisplayName = "hidden-svc", ResourceType = "Project", State = "Running", IsHidden = true },
967
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
968
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
992
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
993
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
1020
new
ResourceSnapshot
{ Name = "redis", DisplayName = "redis", ResourceType = "Container", State = "Running" },
1021
new
ResourceSnapshot
{ Name = "aspire-dashboard", DisplayName = "aspire-dashboard", ResourceType = "Executable", State = "Hidden" },
1050
new
ResourceSnapshot
1065
new
ResourceSnapshot
{ Name = "api-2", DisplayName = "api", ResourceType = "Project", State = "Running" },
1066
new
ResourceSnapshot
{ Name = "api-1", DisplayName = "api", ResourceType = "Project", State = "Running" },
1067
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Running", IsHidden = true },
1068
new
ResourceSnapshot
{ Name = "connection", DisplayName = "connection", ResourceType = "Parameter", State = "Running" }
1085
new
ResourceSnapshot
1107
new
ResourceSnapshot
1112
new
ResourceSnapshot
{ Name = "api-2", DisplayName = "api", ResourceType = "Project", State = "Running" },
1113
new
ResourceSnapshot
{ Name = "api-1", DisplayName = "api", ResourceType = "Project", State = "Running" }
1130
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Hidden" },
1131
new
ResourceSnapshot
{ Name = "connection", DisplayName = "connection", ResourceType = "Parameter", State = "Running" }
1162
new
ResourceSnapshot
{ Name = "cache", DisplayName = "cache", ResourceType = "Container", State = "Running" }
1287
yield return new
ResourceSnapshot
1353
yield return new
ResourceSnapshot
1366
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)
820
return new
ResourceSnapshot
Commands\TerminalResourceResolverTests.cs (17)
27
new
() { Name = "shell-def456", DisplayName = "shell" },
28
new
() { Name = "shell-abc123", DisplayName = "shell" }
53
new
() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties(replicaIndex) }
83
new
() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties("0") },
84
new
() { Name = "shell-def456", DisplayName = "shell", Properties = Properties("1") }
108
new
() { Name = "other-abc123", DisplayName = "shell-def456", Properties = Properties("0") },
109
new
() { Name = "shell-def456", DisplayName = "shell", Properties = Properties("1") }
144
new
() { Name = "shell-abc123", DisplayName = "shell" },
145
new
() { Name = "shell-def456", DisplayName = "shell" }
177
new
() { Name = "shell-abc123", DisplayName = "shell" },
178
new
() { Name = "shell-def456", DisplayName = "shell" }
214
new
() { Name = "shell-def456", DisplayName = "shell", Properties = Properties(replicaIndex) }
248
new
()
279
new
() { Name = "shell-abc123", DisplayName = "shell" },
280
new
() { Name = "shell-def456", DisplayName = "shell" }
306
new
() { Name = "shell-abc123", DisplayName = "shell", Properties = Properties("0") }
336
ResourceSnapshots = hasOtherInstances ? [
new
() { Name = "shell-abc123", DisplayName = "shell" }] : [],
Commands\TerminalTapePlayCommandTests.cs (7)
135
new
() { Name = "shell-abc123", DisplayName = "shell" },
136
new
() { Name = "shell-def456", DisplayName = "shell" }
172
new
() { Name = "shell-def456", DisplayName = "shell" },
173
new
() { Name = "shell-abc123", DisplayName = "shell" }
207
new
()
213
new
()
567
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" });
232 references to ResourceSnapshot
aspire (115)
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)
91
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)
230
private int ExecuteSnapshot(IReadOnlyList<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl, string? resourceName, ResourceOutputFormat format, bool includeDisabledCommands)
283
void DisplaySnapshot(
ResourceSnapshot
snapshot, IReadOnlyList<
ResourceSnapshot
> currentSnapshots)
340
foreach (
var
snapshot in currentSnapshots)
348
var changedSnapshots = new List<
ResourceSnapshot
>(batch.Snapshots.Count);
349
foreach (
var
snapshot in batch.Snapshots)
369
foreach (
var
snapshot in changedSnapshots)
377
private void DisplayResourcesTable(IReadOnlyList<
ResourceSnapshot
> snapshots, string? dashboardBaseUrl)
425
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)
Commands\TerminalResourceResolver.cs (1)
51
var
snapshot = matches[0];
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 (117)
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 (22)
28
var
snapshot = JsonSerializer.Deserialize(json, BackchannelJsonSerializerContext.Default.ResourceSnapshot);
38
var
snapshot = new ResourceSnapshot
70
var
snapshot = new ResourceSnapshot
123
var allSnapshots = new List<
ResourceSnapshot
> { snapshot };
166
var
snapshot = new ResourceSnapshot
190
var
snapshot = new ResourceSnapshot
216
var
snapshot = new ResourceSnapshot
244
var
snapshot = new ResourceSnapshot
271
var
snapshot = new ResourceSnapshot
314
var
snapshot = new ResourceSnapshot
343
var
dependency = new ResourceSnapshot
351
var
resource = new ResourceSnapshot
369
var
resource = new ResourceSnapshot
401
var
firstDependency = new ResourceSnapshot
408
var
secondDependency = new ResourceSnapshot
416
var
resource = new ResourceSnapshot
434
var snapshots = new List<
ResourceSnapshot
>
449
var snapshots = new List<
ResourceSnapshot
>
464
var snapshots = new List<
ResourceSnapshot
>
479
var snapshots = new List<
ResourceSnapshot
>
495
var snapshots = new List<
ResourceSnapshot
>
508
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 (5)
34
var
resource = new ResourceSnapshot
53
var
resource = new ResourceSnapshot
71
ResourceSnapshot
[] resources =
88
ResourceSnapshot
[] resources =
108
ResourceSnapshot
[] resources =
Backchannel\TrayWatchStreamTests.cs (7)
725
var resourceUpdates = Channel.CreateUnbounded<
ResourceSnapshot
>();
797
async IAsyncEnumerable<
ResourceSnapshot
> Watch(bool includeHidden, [EnumeratorCancellation] CancellationToken token)
803
await foreach (
var
resource in resourceUpdates.Reader.ReadAllAsync(token))
821
var resourceUpdates = Channel.CreateUnbounded<
ResourceSnapshot
>();
900
async IAsyncEnumerable<
ResourceSnapshot
> Watch(bool includeHidden, [EnumeratorCancellation] CancellationToken token)
1015
async IAsyncEnumerable<
ResourceSnapshot
> Watch([EnumeratorCancellation] CancellationToken token)
1066
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)
500
foreach (
var
snapshot in initialSnapshots)
1244
List<
ResourceSnapshot
> resourceSnapshots,
1285
private static async IAsyncEnumerable<
ResourceSnapshot
> ThrowObjectDisposedAfterSnapshot([EnumeratorCancellation] CancellationToken cancellationToken = default)
1301
private static async IAsyncEnumerable<
ResourceSnapshot
> EmptyResourceSnapshots([EnumeratorCancellation] CancellationToken cancellationToken = default)
1308
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshots(
1309
IEnumerable<
ResourceSnapshot
> snapshots,
1312
foreach (
var
snapshot in snapshots)
1320
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshotsAfter(
1322
IEnumerable<
ResourceSnapshot
> snapshots,
1326
await foreach (
var
snapshot in YieldResourceSnapshots(snapshots, cancellationToken))
1332
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceSnapshotsImmediatelyAfter(
1334
IEnumerable<
ResourceSnapshot
> snapshots,
1338
foreach (
var
snapshot in snapshots)
1345
private static async IAsyncEnumerable<
ResourceSnapshot
> YieldResourceAfterSignaling(
1364
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)
818
private static
ResourceSnapshot
CreateSnapshot(string name, string? displayName = null)
868
public Task<List<
ResourceSnapshot
>> GetResourceSnapshotsAsync(bool includeHidden, CancellationToken cancellationToken = default)
870
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)