4 instantiations of ResourceViewModel
Aspire.Dashboard (1)
ServiceClient\Partials.cs (1)
23return new()
Aspire.Dashboard.Components.Tests (2)
Pages\ResourcesTests.cs (1)
366return new ResourceViewModel
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
32return new ResourceViewModel
Aspire.Dashboard.Tests (1)
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
32return new ResourceViewModel
377 references to ResourceViewModel
Aspire.Dashboard (222)
Components\Controls\PropertyValues\ResourceHealthStateValue.razor.cs (1)
22public required ResourceViewModel Resource { get; set; }
Components\Controls\PropertyValues\ResourceNameButtonValue.razor.cs (1)
33private ResourceViewModel? _resource;
Components\Controls\PropertyValues\ResourceNameValue.razor.cs (2)
18public required ResourceViewModel Resource { get; set; } 21public required Func<ResourceViewModel, string> FormatName { get; set; }
Components\Controls\PropertyValues\ResourceStateValue.razor.cs (1)
22public required ResourceViewModel Resource { get; set; }
Components\Controls\ResourceActions.razor.cs (4)
53public required Func<ResourceViewModel, CommandViewModel, bool> IsCommandExecuting { get; set; } 59public required ResourceViewModel Resource { get; set; } 62public required Func<ResourceViewModel, string> GetResourceName { get; set; } 68public required ConcurrentDictionary<string, ResourceViewModel> ResourceByName { get; set; }
Components\Controls\ResourceDetails.razor.cs (11)
26public required ResourceViewModel Resource { get; set; } 29public required ConcurrentDictionary<string, ResourceViewModel> ResourceByName { get; set; } 61private ResourceViewModel? _resource; 177Parameters = { ["Resource"] = _resource, ["FormatName"] = new Func<ResourceViewModel, string>(FormatName) } 222NavigationManager.NavigateTo(DashboardUrls.ConsoleLogsUrl(ResourceViewModel.GetResourceName(Resource, ResourceByName))); 278foreach (var match in matches) 280items.Add(ResourceDetailRelationshipViewModel.Create(match, ResourceViewModel.GetResourceName(match, ResourceByName), resourceRelationships)); 300foreach (var otherResource in otherResources) 306items.Add(ResourceDetailRelationshipViewModel.Create(otherResource, ResourceViewModel.GetResourceName(otherResource, ResourceByName), resourceRelationships)); 365private string FormatName(ResourceViewModel resource) 367return ResourceViewModel.GetResourceName(resource, ResourceByName);
Components\Pages\ConsoleLogs.razor.cs (23)
40public ResourceViewModel Resource { get; } 47public ConsoleLogsSubscription(ResourceViewModel resource, ILogger logger) 143private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 248foreach (var resource in snapshot) 259if (ResourceViewModel.TryGetResourceByName(ResourceName, _resourceByName, out var selectedResource)) 301void SetSelectedResourceOption(ResourceViewModel resource) 410else if (selectedResourceName is not null && _resourceByName.TryGetValue(selectedResourceName, out var resource)) 449var selectedResource = GetSelectedResource(); 527private ResourceViewModel? GetSelectedResource() 534_resourceByName.TryGetValue(name, out var resource); 561var selectedResource = GetSelectedResource(); 618foreach (var resource in availableResources) 626private Task SubscribeToSingleResourceAsync(ResourceViewModel resource) 653private string GetResourceName(ResourceViewModel resource) => ResourceViewModel.GetResourceName(resource, _resourceByName); 656ConcurrentDictionary<string, ResourceViewModel> resourcesByName, 686foreach (var resource in grouping.Select(g => g.Value).OrderBy(r => r, ResourceViewModelNameComparer.Instance)) 707SelectViewModel<ResourceTypeDetails> ToOption(ResourceViewModel resource, bool isReplica, string resourceName) 721var resourceName = ResourceViewModel.GetResourceName(resource, resourcesByName); 785var resourcePrefix = ResourceViewModel.GetResourceName(subscription.Resource, _resourceByName, _showHiddenResources); 866private async Task OnResourceChanged(ResourceViewModelChangeType changeType, ResourceViewModel resource) 1059ResourceViewModel? TryGetSingleResource()
Components\Pages\Resources.razor.cs (24)
107private ResourceViewModel? SelectedResource { get; set; } 110private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 139private bool Filter(ResourceViewModel resource) 283foreach (var resource in snapshot) 343private bool UpdateFromResource(ResourceViewModel resource) 356private bool UpdateFromResource(ResourceViewModel resource, Func<string, bool> resourceTypeVisible, Func<string, bool> stateVisible, Func<string, bool> healthStatusVisible) 420if (resources._resourceByName.TryGetValue(id, out var resource)) 433if (resources._resourceByName.TryGetValue(id, out var resource)) 443internal IEnumerable<ResourceViewModel> GetFilteredResources() 548foreach (var resource in GetFilteredResources()) 584if (_resourceByName.TryGetValue(ResourceName, out var selectedResource)) 618private async Task ShowContextMenuAsync(ResourceViewModel resource, int screenWidth, int screenHeight, int clientX, int clientY) 658private async Task ShowResourceDetailsAsync(ResourceViewModel resource, string? buttonId) 673var current = resource; 728private string GetResourceName(ResourceViewModel resource) => ResourceViewModel.GetResourceName(resource, _resourceByName, _showHiddenResources); 730private bool HasMultipleReplicas(ResourceViewModel resource) 753private string GetRowClass(ResourceViewModel resource) 756private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, CommandViewModel command) 761private static (string? Value, bool IsSensitive, bool IsUnresolved) GetParameterValue(ResourceViewModel resource) 774private static string GetUrlsTooltip(ResourceViewModel resource) 828foreach (var resource in resourcesWithChildren) 835foreach (var resource in resourcesWithChildren) 854private static List<DisplayedUrl> GetDisplayedUrls(ResourceViewModel resource)
Components\ResourcesGridColumns\StateColumnDisplay.razor.cs (1)
15public required ResourceViewModel Resource { get; set; }
Components\ResourcesGridColumns\UnreadLogErrorsBadge.razor.cs (2)
17public required ResourceViewModel Resource { get; set; } 30private (string? resourceName, int unviewedErrorCount) GetUnviewedErrorCount(ResourceViewModel resource)
Components\ResourcesGridColumns\UrlsColumnDisplay.razor.cs (1)
14public required ResourceViewModel Resource { get; set; }
Components_Controls_ResourceActions_razor.g.cs (1)
437() => NavigationManager.NavigateTo(Aspire.Dashboard.Utils.DashboardUrls.ConsoleLogsUrl(resource: ResourceViewModel.GetResourceName(Resource, ResourceByName)))
Components_Controls_ResourceDetails_razor.g.cs (4)
2148), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2182), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)( 2584), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2618), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)(
Components_Pages_Resources_razor.g.cs (11)
1882), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 1916), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)( 1996), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2092), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2586), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2696), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::Aspire.Dashboard.Model.CommandViewModel, global::System.Boolean>)( 2730), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 2747), (global::System.Func<global::Aspire.Dashboard.Model.ResourceViewModel, global::System.String>)( 2781), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Collections.Concurrent.ConcurrentDictionary<global::System.String, global::Aspire.Dashboard.Model.ResourceViewModel>>( 3289), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>( 3306), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Collections.Concurrent.ConcurrentDictionary<global::System.String, global::Aspire.Dashboard.Model.ResourceViewModel>>(
Components_ResourcesGridColumns_ResourceNameDisplay_razor.g.cs (2)
411public required ResourceViewModel Resource { get; set; } 414public required Func<ResourceViewModel, string> FormatName { get; set; }
Components_ResourcesGridColumns_StartTimeColumnDisplay_razor.g.cs (1)
251public required ResourceViewModel Resource { get; set; }
Components_ResourcesGridColumns_StateColumnDisplay_razor.g.cs (1)
295), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Aspire.Dashboard.Model.ResourceViewModel>(
Extensions\ResourceViewModelExtensions.cs (10)
10public static bool IsRunningState(this ResourceViewModel resource) 15public static bool IsFinishedState(this ResourceViewModel resource) 20public static bool IsExitedState(this ResourceViewModel resource) 25public static bool IsStopped(this ResourceViewModel resource) 30public static bool IsUnusableTransitoryState(this ResourceViewModel resource) 35public static bool IsRuntimeUnhealthy(this ResourceViewModel resource) 40public static bool IsNotStarted(this ResourceViewModel resource) 45public static bool IsWaiting(this ResourceViewModel resource) 50public static bool IsUnknownState(this ResourceViewModel resource) => resource.KnownState is KnownResourceState.Unknown; 52public static bool HasNoState(this ResourceViewModel resource) => string.IsNullOrEmpty(resource.State);
Mcp\AspireResourceMcpTools.cs (5)
50getResourceName: r => ResourceViewModel.GetResourceName(r, resources)); 69private static List<ResourceViewModel> GetFilteredResources(List<ResourceViewModel> resources) 86if (AIHelpers.TryGetResource(filteredResources, resourceName, out var resource)) 150if (!AIHelpers.TryGetResource(filteredResources, resourceName, out var resource))
Mcp\AspireTelemetryMcpTools.cs (2)
213private static List<ResourceViewModel> GetOptOutResources(IEnumerable<ResourceViewModel> resources)
Model\Assistant\AIHelpers.cs (11)
161internal static string GetResponseGraphJson(List<ResourceViewModel> resources, DashboardOptions options, bool includeDashboardUrl = false, Func<ResourceViewModel, string>? getResourceName = null, bool includeEnvironmentVariables = false) 214static List<object> GetResourceRelationships(List<ResourceViewModel> allResources, ResourceViewModel resourceViewModel, Func<ResourceViewModel, string>? getResourceName) 225foreach (var match in matches) 238static string? GetResourceHealthStatus(ResourceViewModel resource) 253static string? GetReportHealthStatus(ResourceViewModel resource, HealthReportViewModel report) 431public static bool TryGetResource(IReadOnlyList<ResourceViewModel> resources, string resourceName, [NotNullWhen(true)] out ResourceViewModel? resource) 590public static bool IsResourceAIOptOut(ResourceViewModel r)
Model\Assistant\AssistantChatDataContext.cs (3)
55public IReadOnlyList<ResourceViewModel> GetResources() 232if (AIHelpers.TryGetResource(resources, resourceName, out var resource)) 301if (!AIHelpers.TryGetResource(resources, resourceName, out var resource))
Model\Assistant\Markdown\AspireEnrichmentParser.cs (2)
54if (AIHelpers.TryGetResource(resources, text, out var resource)) 56var resourceName = ResourceViewModel.GetResourceName(resource, resources);
Model\Assistant\Markdown\ResourceInline.cs (1)
11public required ResourceViewModel Resource { get; init; }
Model\Assistant\Prompts\IceBreakersBuilder.cs (3)
28public void ResourceDetails(BuildIceBreakersContext context, ResourceViewModel resource) 47private InitialPrompt CreateAnalyzeResource(ResourceViewModel resource) 77public void ConsoleLogs(BuildIceBreakersContext context, ResourceViewModel resource)
Model\Assistant\Prompts\KnownChatMessages.cs (4)
45public static ChatMessage CreateInitialMessage(string promptText, string applicationName, List<ResourceViewModel> resources, DashboardOptions dashboardOptions) 91public static ChatMessage CreateResourceRecentActivityMessage(ResourceViewModel resource) 104public static ChatMessage CreateAnalyzeResourceMessage(ResourceViewModel resource) 157public static ChatMessage CreateResourceConsoleLogsMessage(ResourceViewModel resource)
Model\Assistant\Prompts\PromptContextsBuilder.cs (1)
43public static Task AnalyzeResource(InitializePromptContext promptContext, string displayText, ResourceViewModel resource)
Model\BrowserLinkOutgoingPeerResolver.cs (1)
22public bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResource)
Model\CommonMenuItems.cs (1)
18IEnumerable<ResourceViewModel> resources,
Model\DashboardCommandExecutor.cs (4)
35public async Task ExecuteAsync(ResourceViewModel resource, CommandViewModel command, Func<ResourceViewModel, string> getResourceName) 87public async Task ExecuteAsyncCore(ResourceViewModel resource, CommandViewModel command, Func<ResourceViewModel, string> getResourceName)
Model\IOutgoingPeerResolver.cs (1)
8bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResourced);
Model\ResourceDetailRelationshipViewModel.cs (2)
8public required ResourceViewModel Resource { get; init; } 18public static ResourceDetailRelationshipViewModel Create(ResourceViewModel resource, string resourceName, IEnumerable<RelationshipViewModel> matches)
Model\ResourceGraph\ResourceGraphMapper.cs (5)
16public static ResourceDto MapResource(ResourceViewModel r, IDictionary<string, ResourceViewModel> resourcesByName, IStringLocalizer<Columns> columnsLoc, bool showHiddenResources, IconResolver iconResolver) 30foreach (var match in matches) 39var resourceName = ResourceViewModel.GetResourceName(r, resourcesByName); 50DisplayName = ResourceViewModel.GetResourceName(r, resourcesByName),
Model\ResourceGridViewModel.cs (3)
11public required ResourceViewModel Resource { get; init; } 36public static List<ResourceGridViewModel> OrderNestedResources(List<ResourceGridViewModel> initialGridVMs, Func<ResourceViewModel, bool> isCollapsed) 58void AddChildViewModel(ResourceViewModel resource, ResourceGridViewModel parent, int depth, bool hidden)
Model\ResourceIconHelpers.cs (2)
15public static Icon GetIconForResource(IconResolver iconResolver, ResourceViewModel resource, IconSize desiredSize, IconVariant desiredVariant = IconVariant.Filled) 47static Icon? ResolveProjectIcon(IconResolver iconResolver, ResourceViewModel resource, IconSize desiredSize, IconVariant desiredVariant = IconVariant.Filled)
Model\ResourceMenuItems.cs (8)
31ResourceViewModel resource, 35Func<ResourceViewModel, string> getResourceName, 43Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting, 96private static void AddUrlMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, IStringLocalizer<Resources.Resources> loc) 153private static void AddTelemetryMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, NavigationManager navigationManager, TelemetryRepository telemetryRepository, Func<ResourceViewModel, string> getResourceName, IStringLocalizer<Resources.Resources> loc) 205private static void AddCommandMenuItems(List<MenuButtonItem> menuItems, ResourceViewModel resource, IStringLocalizer<Resources.Resources> loc, IStringLocalizer<Commands> commandsLoc, EventCallback<CommandViewModel> commandSelected, Func<ResourceViewModel, CommandViewModel, bool> isCommandExecuting, IconResolver iconResolver)
Model\ResourceOutgoingPeerResolver.cs (13)
21private readonly ConcurrentDictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 40foreach (var resource in snapshot) 57if (!_resourceByName.TryGetValue(resource.Name, out var existingResource) || 82private static bool ArePeerRelevantPropertiesEquivalent(ResourceViewModel resource1, ResourceViewModel resource2) 127private static bool ArePropertyValuesEquivalent(ResourceViewModel resource1, ResourceViewModel resource2, string propertyName) 151public bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResource) 156internal static bool TryResolvePeerCore(IDictionary<string, ResourceViewModel> resources, KeyValuePair<string, string>[] attributes, [NotNullWhen(true)] out string? name, [NotNullWhen(true)] out ResourceViewModel? resourceMatch) 191private static bool TryMatchAgainstResources(string peerAddress, IDictionary<string, ResourceViewModel> resources, [NotNullWhen(true)] out string? name, [NotNullWhen(true)] out ResourceViewModel? resourceMatch) 199name = ResourceViewModel.GetResourceName(resource, resources);
Model\ResourceSourceViewModel.cs (2)
15internal static ResourceSourceViewModel? GetSourceViewModel(ResourceViewModel resource) 42static CommandLineInfo? GetCommandLineInfo(ResourceViewModel resourceViewModel)
Model\ResourceStateViewModel.cs (4)
23internal static ResourceStateViewModel GetStateViewModel(ResourceViewModel resource, IStringLocalizer<Columns> loc) 31private static (Icon icon, Color color) GetStateIcon(ResourceViewModel resource) 104internal static string GetResourceStateTooltip(ResourceViewModel resource, IStringLocalizer<Columns> loc) 142private static string GetStateText(ResourceViewModel resource, IStringLocalizer<Columns> loc)
Model\ResourceUrlHelpers.cs (1)
25public static List<DisplayedUrl> GetUrls(ResourceViewModel resource, bool includeInternalUrls = false, bool includeNonEndpointUrls = false)
Model\ResourceViewModel.cs (10)
151public static string GetResourceName(ResourceViewModel resource, IDictionary<string, ResourceViewModel> allResources, bool showHiddenResources = false) 156public static string GetResourceName(ResourceViewModel resource, IEnumerable<ResourceViewModel> allResources, bool showHiddenResources = false) 159foreach (var item in allResources) 181public static bool TryGetResourceByName(string resourceName, IDictionary<string, ResourceViewModel> resourceByName, [NotNullWhen(true)] out ResourceViewModel? resource) 199public sealed class ResourceViewModelNameComparer : IComparer<ResourceViewModel> 203public int Compare(ResourceViewModel? x, ResourceViewModel? y)
Model\ResourceViewModelExtensions.cs (14)
12public static bool IsContainer(this ResourceViewModel resource) 17public static bool IsProject(this ResourceViewModel resource) 22public static bool IsExecutable(this ResourceViewModel resource, bool allowSubtypes) 37public static bool TryGetExitCode(this ResourceViewModel resource, out int exitCode) 42public static bool TryGetContainerImage(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? containerImage) 47public static bool TryGetProjectPath(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? projectPath) 52public static bool TryGetExecutablePath(this ResourceViewModel resource, [NotNullWhen(returnValue: true)] out string? executablePath) 57public static bool TryGetExecutableArguments(this ResourceViewModel resource, out ImmutableArray<string> arguments) 62public static bool TryGetAppArgs(this ResourceViewModel resource, out ImmutableArray<string> arguments) 67public static bool TryGetAppArgsSensitivity(this ResourceViewModel resource, out ImmutableArray<bool> argParams) 72private static bool TryGetCustomDataString(this ResourceViewModel resource, string key, [NotNullWhen(returnValue: true)] out string? s) 84private static bool TryGetCustomDataStringArray(this ResourceViewModel resource, string key, out ImmutableArray<string> strings) 109private static bool TryGetCustomDataBoolArray(this ResourceViewModel resource, string key, out ImmutableArray<bool> bools) 134private static bool TryGetCustomDataInt(this ResourceViewModel resource, string key, out int i)
Model\TelemetryExportService.cs (1)
94var resourceName = ResourceViewModel.GetResourceName(resource, resources);
Otlp\Storage\TelemetryRepository.cs (4)
1129var peer = ResolveUninstrumentedPeerResource(span, _outgoingPeerResolvers); 1147var uninstrumentedPeer = hasUninstrumentedPeer ? ResolveUninstrumentedPeerResource(span, _outgoingPeerResolvers) : null; 1168private static ResourceViewModel? ResolveUninstrumentedPeerResource(OtlpSpan span, IEnumerable<IOutgoingPeerResolver> outgoingPeerResolvers) 1173if (resolver.TryResolvePeer(span.Attributes, out _, out var matchedResourced))
ServiceClient\DashboardClient.cs (7)
45private readonly Dictionary<string, ResourceViewModel> _resourceByName = new(StringComparers.ResourceName); 369var viewModel = resource.ToViewModel(_knownPropertyLookup, _logger); 389var viewModel = change.Upsert.ToViewModel(_knownPropertyLookup, _logger); 396if (_resourceByName.Remove(change.Delete.ResourceName, out var removed)) 553public ResourceViewModel? GetResource(string resourceName) 558if (_resourceByName.TryGetValue(resourceName, out var resource)) 566public IReadOnlyList<ResourceViewModel> GetResources()
ServiceClient\IDashboardClient.cs (4)
47ResourceViewModel? GetResource(string resourceName); 53IReadOnlyList<ResourceViewModel> GetResources(); 77ImmutableArray<ResourceViewModel> InitialState, 82ResourceViewModel Resource);
ServiceClient\Partials.cs (2)
19public ResourceViewModel ToViewModel(IKnownPropertyLookup knownPropertyLookup, ILogger logger) 50throw new InvalidOperationException($@"Error converting resource ""{Name}"" to {nameof(ResourceViewModel)}.", ex);
Aspire.Dashboard.Components.Tests (59)
Controls\ResourceDetailsTests.cs (25)
27var resource1 = ModelTestHelpers.CreateResource( 40builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel> (resource1.Name, resource1)])); 79var resource2 = ModelTestHelpers.CreateResource( 117var resource1 = ModelTestHelpers.CreateResource( 130builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel> (resource1.Name, resource1)])); 169var resource2 = ModelTestHelpers.CreateResource( 207var resource1 = ModelTestHelpers.CreateResource( 220builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel> (resource1.Name, resource1)])); 253var resource2 = ModelTestHelpers.CreateResource( 291var resource1 = ModelTestHelpers.CreateResource( 304builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel> (resource1.Name, resource1)])); 337var resource2 = ModelTestHelpers.CreateResource( 375var resource = ModelTestHelpers.CreateResource( 391builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel>(resource.Name, resource)])); 411var resource = ModelTestHelpers.CreateResource( 427builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel>(resource.Name, resource)])); 447var resource = ModelTestHelpers.CreateResource( 463builder.Add(p => p.ResourceByName, new ConcurrentDictionary<string, ResourceViewModel>([new KeyValuePair<string, ResourceViewModel>(resource.Name, resource)]));
Pages\ConsoleLogsTests.cs (13)
43var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 93var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 94var testResource2 = ModelTestHelpers.CreateResource(resourceName: "test-resource2", state: KnownResourceState.Running); 175var regularResource = ModelTestHelpers.CreateResource(resourceName: "regular-resource", state: KnownResourceState.Running); 176var hiddenResource = ModelTestHelpers.CreateResource(resourceName: "hidden-resource", state: KnownResourceState.Running, hidden: true); 282var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 331var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 380var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 433var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 490var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running); 544var testResource = ModelTestHelpers.CreateResource( 608var testResource = ModelTestHelpers.CreateResource( 671var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running);
Pages\ResourcesTests.cs (16)
30var initialResources = new List<ResourceViewModel> 119var initialResources = new List<ResourceViewModel> 181var initialResources = new List<ResourceViewModel> 218var initialResources = new List<ResourceViewModel> 315var initialResources = new List<ResourceViewModel> 357private static ResourceViewModel CreateResource( 395var initialResources = new List<ResourceViewModel> 422var initialResources = new List<ResourceViewModel> 451var initialResources = new List<ResourceViewModel> 484var initialResources = new List<ResourceViewModel> 526var initialResources = new List<ResourceViewModel> 548var resource = filteredResources[0]; 570var initialResources = new List<ResourceViewModel> 592var resource = filteredResources[0]; 612var initialResources = new List<ResourceViewModel> 634var resource = filteredResources[0];
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
13public static ResourceViewModel CreateResource(
tests\Shared\TestDashboardClient.cs (4)
19private readonly IList<ResourceViewModel>? _initialResources; 33IList<ResourceViewModel>? initialResources = null) 140public ResourceViewModel? GetResource(string resourceName) => null; 142public IReadOnlyList<ResourceViewModel> GetResources() => _initialResources?.ToList() ?? [];
Aspire.Dashboard.Tests (96)
ConsoleLogsTests\CreateResourceSelectModelsTests.cs (7)
18var resources = new List<ResourceViewModel> 23var resourcesByName = new ConcurrentDictionary<string, ResourceViewModel>(resources.ToDictionary(app => app.Name)); 50var resources = new List<ResourceViewModel> 66var resourcesByName = new ConcurrentDictionary<string, ResourceViewModel>(resources.ToDictionary(app => app.Name)); 140var resources = new List<ResourceViewModel> 147var resourcesByName = new ConcurrentDictionary<string, ResourceViewModel>(resources.ToDictionary(app => app.Name)); 180var resourcesByName = new ConcurrentDictionary<string, ResourceViewModel>();
Integration\Playwright\Infrastructure\MockDashboardClient.cs (5)
13public static readonly ResourceViewModel TestResource1 = ModelTestHelpers.CreateResource( 32private readonly List<ResourceViewModel>? _resources; 34public MockDashboardClient(List<ResourceViewModel>? resources = null) 71public ResourceViewModel? GetResource(string resourceName) => null; 73public IReadOnlyList<ResourceViewModel> GetResources() => _resources ?? [];
Mcp\AspireResourceMcpToolsTests.cs (12)
41var resource = ModelTestHelpers.CreateResource(resourceName: "app1"); 58var resource1 = ModelTestHelpers.CreateResource(resourceName: "app1"); 59var resource2 = ModelTestHelpers.CreateResource(resourceName: "app2"); 77var resource1 = ModelTestHelpers.CreateResource(resourceName: "app1"); 78var resource2 = ModelTestHelpers.CreateResource( 98var resource = ModelTestHelpers.CreateResource(resourceName: "app1"); 114var resource = ModelTestHelpers.CreateResource( 132var resource = ModelTestHelpers.CreateResource(resourceName: "app1"); 156var resource1 = ModelTestHelpers.CreateResource(resourceName: "app1"); 157var resource2 = ModelTestHelpers.CreateResource(resourceName: "app1"); // Same name 188var resource = ModelTestHelpers.CreateResource( 206var resource = ModelTestHelpers.CreateResource(resourceName: "app1", commands: ImmutableArray<CommandViewModel>.Empty);
Mcp\AspireTelemetryMcpToolsTests.cs (2)
68var resource = ModelTestHelpers.CreateResource( 161var resource = ModelTestHelpers.CreateResource(
Model\AIAssistant\AssistantChatDataContextTests.cs (1)
98var testResource = ModelTestHelpers.CreateResource(resourceName: "test-resource", state: KnownResourceState.Running);
Model\ResourceGraphMapperTests.cs (12)
22var resource1 = ModelTestHelpers.CreateResource("app1-abcxyc", displayName: "app1", relationships: [new RelationshipViewModel("app2", "Reference")]); 23var resource2 = ModelTestHelpers.CreateResource("app2-123456", displayName: "app2", relationships: ImmutableArray<RelationshipViewModel>.Empty); 24var resources = new Dictionary<string, ResourceViewModel> 42var resource1 = ModelTestHelpers.CreateResource("app1-abcxyc", displayName: "app1", relationships: [new RelationshipViewModel("app2", "Reference")]); 43var resource21 = ModelTestHelpers.CreateResource("app2-123456", displayName: "app2", relationships: ImmutableArray<RelationshipViewModel>.Empty); 44var resource22 = ModelTestHelpers.CreateResource("app2-654321", displayName: "app2", relationships: ImmutableArray<RelationshipViewModel>.Empty); 45var resources = new Dictionary<string, ResourceViewModel> 65var resource = ModelTestHelpers.CreateResource("app1-abcxyc", displayName: "app1", relationships: ImmutableArray<RelationshipViewModel>.Empty); 66var resources = new Dictionary<string, ResourceViewModel> 82var resource1 = ModelTestHelpers.CreateResource("app1-abcxyc", displayName: "app1", relationships: [new RelationshipViewModel("hidden-app", "Reference")]); 83var hiddenResource = ModelTestHelpers.CreateResource("hidden-app", displayName: "hidden-app", relationships: ImmutableArray<RelationshipViewModel>.Empty, hidden: true); 84var resources = new Dictionary<string, ResourceViewModel>
Model\ResourceIconHelpersTests.cs (9)
21var resource = ModelTestHelpers.CreateResource(iconName: "Database", iconVariant: IconVariant.Filled); 36var resource = ModelTestHelpers.CreateResource(iconName: "CloudArrowUp", iconVariant: IconVariant.Regular); 49var resource = ModelTestHelpers.CreateResource(resourceType: KnownResourceTypes.Container); 63var resource = ModelTestHelpers.CreateResource(resourceType: KnownResourceTypes.Project, iconName: "NonExistentIcon", iconVariant: IconVariant.Filled); 83var resource = ModelTestHelpers.CreateResource(resourceType: resourceType); 96var resource = ModelTestHelpers.CreateResource(resourceType: "postgres-database"); 122var resource = ModelTestHelpers.CreateResource( 138var resource = ModelTestHelpers.CreateResource(resourceType: KnownResourceTypes.Project); 155var resource = ModelTestHelpers.CreateResource(resourceType: KnownResourceTypes.Container);
Model\ResourceMenuItemsTests.cs (3)
27var resource = ModelTestHelpers.CreateResource(); 62var resource = ModelTestHelpers.CreateResource(resourceName: "test-abc"); 120var resource = ModelTestHelpers.CreateResource(resourceName: "test-abc");
Model\ResourceSourceViewModelTests.cs (1)
39var resource = ModelTestHelpers.CreateResource(
Model\ResourceStateViewModelTests.cs (1)
78var resource = ModelTestHelpers.CreateResource(
Model\ResourceUrlHelpersTests.cs (1)
12public static List<DisplayedUrl> GetUrls(ResourceViewModel resource, bool includeInternalUrls = false)
Model\ResourceViewModelTests.cs (7)
30var actualStatus = ResourceViewModel.ComputeHealthStatus(reports, state); 50var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance); 78var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance); 128var viewModel = resource.ToViewModel(new MockKnownPropertyLookup(123, kp), NullLogger.Instance); 170var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance); 192var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance); 213var vm = resource.ToViewModel(new MockKnownPropertyLookup(), NullLogger.Instance);
ResourceOutgoingPeerResolverTests.cs (25)
17private static ResourceViewModel CreateResource(string name, string? serviceAddress = null, int? servicePort = null, string? displayName = null, KnownResourceState? state = null) 30var resources = new Dictionary<string, ResourceViewModel> 43var resources = new Dictionary<string, ResourceViewModel> 56var resources = new Dictionary<string, ResourceViewModel> 69var resources = new Dictionary<string, ResourceViewModel> 88var resources = new Dictionary<string, ResourceViewModel> 102var resources = new Dictionary<string, ResourceViewModel> 116var resources = new Dictionary<string, ResourceViewModel> 195var resources = new Dictionary<string, ResourceViewModel> 209var resources = new Dictionary<string, ResourceViewModel> 223private static bool TryResolvePeerName(IDictionary<string, ResourceViewModel> resources, KeyValuePair<string, string>[] attributes, out string? peerName) 233var resources = new Dictionary<string, ResourceViewModel> 248var resources = new Dictionary<string, ResourceViewModel> 262var resources = new Dictionary<string, ResourceViewModel> 277var resources = new Dictionary<string, ResourceViewModel> 290var resources = new Dictionary<string, ResourceViewModel> 304var resources = new Dictionary<string, ResourceViewModel> 319var resources = new Dictionary<string, ResourceViewModel> 329private static ResourceViewModel CreateResourceWithConnectionString(string name, string connectionString) 347private static ResourceViewModel CreateResourceWithParameterValue(string name, string value) 369var resources = new Dictionary<string, ResourceViewModel> 384var resources = new Dictionary<string, ResourceViewModel> 401var resources = new Dictionary<string, ResourceViewModel> 419public ResourceViewModel? GetResource(string resourceName) => null; 420public IReadOnlyList<ResourceViewModel> GetResources() => [];
TelemetryRepositoryTests\TestOutgoingPeerResolver.cs (3)
11private readonly Func<KeyValuePair<string, string>[], (string? Name, ResourceViewModel? Resource)>? _onResolve; 14public TestOutgoingPeerResolver(Func<KeyValuePair<string, string>[], (string? Name, ResourceViewModel? Resource)>? onResolve = null) 38public bool TryResolvePeer(KeyValuePair<string, string>[] attributes, out string? name, out ResourceViewModel? matchedResourced)
TelemetryRepositoryTests\TraceTests.cs (2)
2014var matchedResourced = ModelTestHelpers.CreateResource(resourceName: "TestPeer"); 2129var resource = ModelTestHelpers.CreateResource(resourceName: "test-abc-def", displayName: "test");
tests\Shared\DashboardModel\ModelTestHelpers.cs (1)
13public static ResourceViewModel CreateResource(
tests\Shared\TestDashboardClient.cs (4)
19private readonly IList<ResourceViewModel>? _initialResources; 33IList<ResourceViewModel>? initialResources = null) 140public ResourceViewModel? GetResource(string resourceName) => null; 142public IReadOnlyList<ResourceViewModel> GetResources() => _initialResources?.ToList() ?? [];