4 overrides of GetValue
System.Text.Json (4)
System\Text\Json\Nodes\JsonValueOfJsonPrimitive.cs (3)
56public override T GetValue<T>() 140public override T GetValue<T>() 187public override T GetValue<T>()
System\Text\Json\Nodes\JsonValueOfT.cs (1)
23public override T GetValue<T>()
1545 references to GetValue
aspire (21)
Agents\AspireSkills\AspireSkillsRemoteConfiguration.cs (2)
226_ = value.GetValue<string>(); 243return node.GetValue<bool>();
Agents\OpenCode\OpenCodeAgentClient.cs (1)
111var value = node!.GetValue<string>();
Commands\InitCommand.cs (6)
772if (!TryParseHostPort(https["applicationUrl"]?.GetValue<string>(), "https", out var dashboardHttps) 773|| !TryParseHostPort(http["applicationUrl"]?.GetValue<string>(), "http", out var dashboardHttp) 774|| !TryParseHostPort(httpsEnv[KnownConfigNames.DashboardOtlpGrpcEndpointUrl]?.GetValue<string>(), "https", out var otlpHttps) 775|| !TryParseHostPort(httpEnv[KnownConfigNames.DashboardOtlpGrpcEndpointUrl]?.GetValue<string>(), "http", out var otlpHttp) 776|| !TryParseHostPort(httpsEnv[KnownConfigNames.ResourceServiceEndpointUrl]?.GetValue<string>(), "https", out var resourceServiceHttps) 777|| !TryParseHostPort(httpEnv[KnownConfigNames.ResourceServiceEndpointUrl]?.GetValue<string>(), "http", out var resourceServiceHttp))
Migrations\TypeScriptAppHostMigration.cs (3)
208var currentPath = pathValue.GetValue<string>(); 261rewritten.Add((JsonNode?)JsonValue.Create(LegacyTypeScriptAppHost.RewriteTsConfigIncludeEntry(value.GetValue<string>()))); 300var current = value.GetValue<string>();
Npm\SigstoreNpmProvenanceChecker.cs (1)
220predicateType = predicateTypeValue.GetValue<string>();
Projects\RepositoryToolUpdater.cs (3)
286var isRoot = !isNpm && content["isRoot"]?.GetValue<bool>() == true; 294references.Add(new(dependencies, NpmPackageId, version.GetValue<string>())); 304references.Add(new(properties, "version", properties["version"]?.GetValue<string>() ?? throw new JsonException("Missing tool version.")));
Utils\EnvironmentChecker\DeprecatedAgentConfigCheck.cs (5)
124args[0]?.GetValue<string>() == "mcp" && 125args[1]?.GetValue<string>() == "start") 156command[0]?.GetValue<string>() == "aspire" && 157command[1]?.GetValue<string>() == "mcp" && 158command[2]?.GetValue<string>() == "start")
Aspire.Cli.EndToEnd.Tests (37)
CSharpInitTests.cs (3)
128Assert.Equal("apphost.cs", config["appHost"]?["path"]?.GetValue<string>()); 201var path = appHostNode!["path"]?.GetValue<string>(); 204var language = appHostNode["language"]?.GetValue<string>();
CustomTemplateTests.cs (4)
105Assert.Equal(sourceLocation, listed["company"]!["path"]!.GetValue<string>()); 106Assert.Equal("https://example.test/templates", listed["git-example"]!["repository"]!.GetValue<string>()); 107Assert.Equal("main", listed["git-example"]!["ref"]!.GetValue<string>()); 108Assert.Equal("templates", listed["git-example"]!["path"]!.GetValue<string>());
Helpers\ConfigSourceTestContext.cs (9)
76Assert.Equal("SourceApp.AppHost.csproj", configuration["appHost"]!["path"]!.GetValue<string>()); 154Assert.Equal(_repository, configuration["configSource"]!["repository"]!.GetValue<string>()); 155Assert.Equal("teams/platform.json", configuration["configSource"]!["path"]!.GetValue<string>()); 156Assert.Equal("main", configuration["configSource"]!["ref"]!.GetValue<string>()); 171var appHostPath = configuration["appHost"]!["path"]!.GetValue<string>(); 299Assert.Equal($"https://docs.example/{version}/llms.txt", config["docs"]!["llmsTxtUrl"]!.GetValue<string>()); 300Assert.Equal($"https://docs.example/{version}/sitemap.xml", config["docs"]!["api"]!["sitemapUrl"]!.GetValue<string>()); 301Assert.Equal("keep", config["docs"]!["custom"]!.GetValue<string>()); 302Assert.Equal(appliedVersion, config["configSource"]!["appliedVersion"]!.GetValue<string>());
SelfUpdateChannelPersistenceTests.cs (1)
113Assert.Equal("staging", updatedConfig["channel"]?.GetValue<string>());
SingleFileAppHostInitDotnetRunTests.cs (4)
91Assert.Equal("Project", httpsProfile["commandName"]?.GetValue<string>()); 92Assert.False(string.IsNullOrWhiteSpace(httpsProfile["applicationUrl"]?.GetValue<string>())); 95Assert.False(string.IsNullOrWhiteSpace(httpsEnv["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]?.GetValue<string>())); 96Assert.False(string.IsNullOrWhiteSpace(httpsEnv["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]?.GetValue<string>()));
TypeScriptMigrateAppHostTests.cs (1)
216var includes = tsconfig["include"]!.AsArray().Select(n => n!.GetValue<string>()).ToArray();
TypeScriptPolyglotTests.cs (15)
450originalDevScript = scripts["dev"]?.GetValue<string>(); 451originalBuildScript = scripts["build"]?.GetValue<string>(); 452originalPreviewScript = scripts["preview"]?.GetValue<string>(); 453originalPackageType = packageJson["type"]?.GetValue<string>(); 482Assert.Equal(originalDevScript, scripts["dev"]?.GetValue<string>()); 483Assert.Equal(originalBuildScript, scripts["build"]?.GetValue<string>()); 484Assert.Equal(originalPreviewScript, scripts["preview"]?.GetValue<string>()); 485Assert.Equal("custom-apphost-start", scripts["aspire:start"]?.GetValue<string>()); 486Assert.Equal("npm --prefix aspire-apphost run aspire:build", scripts["aspire:build"]?.GetValue<string>()); 487Assert.Equal("npm --prefix aspire-apphost run aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 488Assert.Equal(originalPackageType, packageJson["type"]?.GetValue<string>()); 508Assert.Equal("module", appHostPackageJson["type"]?.GetValue<string>()); 509Assert.Equal("aspire-apphost", appHostPackageJson["name"]?.GetValue<string>()); 510Assert.Equal("aspire run", appHostScripts["aspire:start"]?.GetValue<string>()); 522Assert.Equal("aspire-apphost/apphost.mts", appHost["path"]?.GetValue<string>());
Aspire.Cli.Tests (305)
Agents\AgentConfigurationTests.cs (7)
62Assert.Equal("caf\u00e9 \u4e16\u754c \ud83d\ude80", file!["value"]!.GetValue<string>()); 183Assert.Equal("external", discovered!["value"]!.GetValue<string>()); 184Assert.Equal("original", captured!["value"]!.GetValue<string>()); 386JsonNode.Parse(await File.ReadAllTextAsync(path))!["token"]!.GetValue<string>()); 422Assert.Equal("replacement", JsonNode.Parse(await File.ReadAllTextAsync(path))!["token"]!.GetValue<string>()); 448Assert.Equal("replacement", JsonNode.Parse(await File.ReadAllTextAsync(path))!["token"]!.GetValue<string>()); 660Assert.True(settings["enabledPlugins"]!["aspire@aspire-skills"]!.GetValue<bool>());
Backchannel\ResourceSnapshotMapperTests.cs (7)
32Assert.Equal(12345, pid.GetValue<int>()); 60Assert.Equal("maui", result.Properties![KnownProperties.Resource.LaunchConfigurationType]!.GetValue<string>()); 61Assert.Equal("watch", result.Properties[KnownProperties.Project.LaunchCommand]!.GetValue<string>()); 62Assert.Equal("Release", result.Properties[KnownProperties.Project.Configuration]!.GetValue<string>()); 63Assert.Equal("net10.0", result.Properties[KnownProperties.Project.TargetFramework]!.GetValue<string>()); 387value => Assert.Equal("one", value?.GetValue<string>()), 388value => Assert.Equal("two", value?.GetValue<string>()));
Commands\ConfigCommandTests.cs (1)
839Assert.Equal("true", feature.Value?.GetValue<string>());
Commands\ConfigSourceCommandTests.cs (4)
555Assert.Equal("version-2", globalConfiguration["configSource"]!["appliedVersion"]!.GetValue<string>()); 831Assert.Equal(accepted ? "https://docs.example/llms.txt" : null, configuration["docs"]?["llmsTxtUrl"]?.GetValue<string>()); 847Assert.Equal("https://docs.example/llms.txt", configuration["docs"]!["llmsTxtUrl"]!.GetValue<string>()); 874Assert.Equal("https://local.example/llms.txt", configuration["docs"]!["llmsTxtUrl"]!.GetValue<string>());
Commands\GoAppHostToolingCheckTests.cs (7)
57Assert.Equal(KnownLanguageId.Go, result.Metadata["language"]?.GetValue<string>()); 58Assert.Equal(expectedVersion, result.Metadata["version"]?.GetValue<string>()); 59Assert.Equal(appHostFile.FullName, result.Metadata["appHostPath"]?.GetValue<string>()); 74Assert.Equal(appHostFile.FullName, result.Metadata["appHostPath"]?.GetValue<string>()); 137Assert.Equal(appHostFile.FullName, result.Metadata["appHostPath"]?.GetValue<string>()); 173Assert.Equal(KnownLanguageId.Go, result.Metadata["language"]?.GetValue<string>()); 191Assert.Equal("1.24.1", result.Metadata["version"]?.GetValue<string>());
Commands\InitCommandTests.cs (33)
308Assert.Equal("apphost.cs", config["appHost"]!["path"]!.GetValue<string>()); 351Assert.Equal("apphost.cs", appHost["path"]!.GetValue<string>()); 398Assert.Equal("Project", https["commandName"]!.GetValue<string>()); 399Assert.True(https["dotnetRunMessages"]!.GetValue<bool>()); 400var httpsUrls = https["applicationUrl"]!.GetValue<string>(); 403Assert.Equal("Development", httpsEnv[KnownAspNetCoreConfigNames.Environment]!.GetValue<string>()); 404Assert.Equal("Development", httpsEnv[KnownAspNetCoreConfigNames.DotNetEnvironment]!.GetValue<string>()); 405Assert.StartsWith("https://localhost:", httpsEnv["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 406Assert.StartsWith("https://localhost:", httpsEnv["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>()); 409Assert.Equal("Project", http["commandName"]!.GetValue<string>()); 411Assert.Equal("Development", httpEnv[KnownAspNetCoreConfigNames.Environment]!.GetValue<string>()); 412Assert.StartsWith("http://localhost:", httpEnv["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 413Assert.StartsWith("http://localhost:", httpEnv["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>()); 414Assert.Equal("true", httpEnv["ASPIRE_ALLOW_UNSECURED_TRANSPORT"]!.GetValue<string>()); 421aspireProfiles["https"]!["applicationUrl"]!.GetValue<string>(), 424aspireProfiles["http"]!["applicationUrl"]!.GetValue<string>(), 425http["applicationUrl"]!.GetValue<string>()); 477Assert.Equal("https://localhost:18000;http://localhost:18001", https["applicationUrl"]!.GetValue<string>()); 478Assert.Equal("https://localhost:18002", https["environmentVariables"]!["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 479Assert.Equal("https://localhost:18003", https["environmentVariables"]!["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>()); 480Assert.Equal("http://localhost:18001", http["applicationUrl"]!.GetValue<string>()); 481Assert.Equal("http://localhost:18005", http["environmentVariables"]!["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 482Assert.Equal("http://localhost:18006", http["environmentVariables"]!["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>()); 529Assert.Equal("https://localhost:18000", preservedHttps["applicationUrl"]!.GetValue<string>()); 531Assert.Equal("custom-value", preservedEnv["MY_CUSTOM_VAR"]!.GetValue<string>()); 666Assert.Equal("apphost.mts", appHost["path"]!.GetValue<string>()); 667Assert.Equal("typescript/nodejs", appHost["language"]!.GetValue<string>()); 939Assert.Equal("apphost.cs", merged["appHost"]!.AsObject()["path"]!.GetValue<string>()); 941Assert.Equal("stable", merged["channel"]!.GetValue<string>()); 942Assert.True(merged["features"]!.AsObject()["polyglotSupportEnabled"]!.GetValue<bool>()); 962Assert.Equal("stable", JsonNode.Parse(await File.ReadAllTextAsync(configPath))!["channel"]!.GetValue<string>()); 1412Assert.Equal(contextChannel, config["channel"]!.GetValue<string>()); 1445Assert.Equal("pr-99999", config["channel"]!.GetValue<string>());
Commands\NewCommandLocalTemplateTests.SourceManagement.cs (6)
55Assert.Equal(location, source.Value![repository ? "repository" : "path"]!.GetValue<string>()); 207Assert.Equal(options[index + 1], source[options[index][2..]]!.GetValue<string>()); 209Assert.Equal("preserved", settings["unrelated"]!.GetValue<string>()); 216Assert.Equal("preserved", settings["unrelated"]!.GetValue<string>()); 374Assert.Equal("templates/api", edited[pathField]!.GetValue<string>()); 446Assert.False(JsonNode.Parse(await File.ReadAllTextAsync(path))!["templateSources"]!["broken"]!.GetValue<bool>());
Commands\OperatingSystemCheckTests.cs (8)
28Assert.Equal("Linux", result.Metadata["osType"]!.GetValue<string>()); 29Assert.Equal("Linux Ubuntu", result.Metadata["displayName"]!.GetValue<string>()); 30Assert.Equal("24.04", result.Metadata["version"]!.GetValue<string>()); 31Assert.Equal("Ubuntu 24.04.2 LTS", result.Metadata["description"]!.GetValue<string>()); 50Assert.Equal("unknown", result.Metadata["osType"]!.GetValue<string>()); 51Assert.Equal("unknown", result.Metadata["displayName"]!.GetValue<string>()); 52Assert.Equal("1.2.3", result.Metadata["version"]!.GetValue<string>()); 53Assert.Equal("Unknown OS description", result.Metadata["description"]!.GetValue<string>());
Commands\ResourceCommandHelperTests.cs (1)
143Assert.Equal("#submit", connection.ExecuteResourceCommandArguments["selector"]!.GetValue<string>());
Commands\ResourceCommandTests.cs (5)
1808Assert.Equal("browser", argumentInputs[0]!["name"]!.GetValue<string>()); 1809Assert.Equal("Chrome", argumentInputs[0]!["value"]!.GetValue<string>()); 1810Assert.Equal("profile", argumentInputs[1]!["name"]!.GetValue<string>()); 1811Assert.Equal("Default", argumentInputs[1]!["options"]!["Default"]!.GetValue<string>()); 2337Assert.Equal(value, actualElement.GetValue<string>());
Commands\SecretCommandTests.cs (4)
378Assert.Equal(42, persisted["Resource:Count"]!.GetValue<int>()); 379Assert.True(persisted["Resource:Enabled"]!.GetValue<bool>()); 380Assert.Equal(1.25, persisted["Resource:Ratio"]!.GetValue<double>()); 383Assert.Equal("value", persisted["Resource:Text"]!.GetValue<string>());
Commands\TelemetryTracesCommandTests.cs (3)
141Assert.Equal("abc1234567890def", item["traceId"]!.GetValue<string>()); 143var dashboardUrl = item["dashboardUrl"]!.GetValue<string>(); 229var dashboardUrl = items[0]!["dashboardUrl"]!.GetValue<string>();
Commands\TemplateSourceStartupTests.cs (3)
146JsonNode.Parse(File.ReadAllText(migratedPath))!["templateSources"]!["company"]!["repository"]!.GetValue<string>()); 264Assert.True(JsonNode.Parse(await File.ReadAllTextAsync(destination))!["features"]!["defaultWatchEnabled"]!.GetValue<bool>()); 356Assert.Equal("stable", JsonNode.Parse(File.ReadAllText(migratedPath))!["channel"]!.GetValue<string>());
Commands\UpdateCommandRepositoryToolsTests.cs (10)
54Assert.Equal("^13.4.0", packageJson["devDependencies"]![RepositoryToolUpdater.NpmPackageId]!.GetValue<string>()); 67Assert.Equal("13.5.4", JsonNode.Parse(await File.ReadAllTextAsync(dotnetManifest))!["tools"]!["aspire.cli"]!["version"]!.GetValue<string>()); 68Assert.Equal("^13.5.4", JsonNode.Parse(await File.ReadAllTextAsync(npmManifest))!["devDependencies"]![RepositoryToolUpdater.NpmPackageId]!.GetValue<string>()); 174Assert.Equal("99.0.0", JsonNode.Parse(await File.ReadAllTextAsync(dotnetManifest))!["tools"]!["aspire.cli"]!["version"]!.GetValue<string>()); 175Assert.Equal("^99.0.0", JsonNode.Parse(await File.ReadAllTextAsync(npmManifest))!["devDependencies"]![RepositoryToolUpdater.NpmPackageId]!.GetValue<string>()); 321Assert.Equal("13.5.4", JsonNode.Parse(await File.ReadAllTextAsync(selectedManifest))!["tools"]!["aspire.cli"]!["version"]!.GetValue<string>()); 547Assert.Equal(targetVersion, JsonNode.Parse(await File.ReadAllTextAsync(dotnetManifest))!["tools"]!["aspire.cli"]!["version"]!.GetValue<string>()); 548Assert.Equal("^" + targetVersion, JsonNode.Parse(await File.ReadAllTextAsync(npmManifest))!["devDependencies"]![RepositoryToolUpdater.NpmPackageId]!.GetValue<string>()); 550Assert.Equal(targetVersion, config["sdk"]!["version"]!.GetValue<string>()); 551Assert.Equal("daily", config["channel"]!.GetValue<string>());
Commands\VsCodeExtensionCheckTests.cs (6)
51Assert.True(result.Metadata["vsCodeInstalled"]!.GetValue<bool>()); 52Assert.False(result.Metadata["extensionInstalled"]!.GetValue<bool>()); 53Assert.Equal(VsCodeExtensionCheck.ExtensionId, result.Metadata["extensionId"]!.GetValue<string>()); 80Assert.True(result.Metadata["vsCodeInstalled"]!.GetValue<bool>()); 81Assert.True(result.Metadata["extensionInstalled"]!.GetValue<bool>()); 82Assert.Equal(VsCodeExtensionCheck.ExtensionId, result.Metadata["extensionId"]!.GetValue<string>());
Configuration\ConfigSourceServiceGitTests.cs (9)
391Assert.True(configuration["features"]!["test"]!.GetValue<bool>()); 392Assert.Equal(custom, configuration["custom"]!.GetValue<string>()); 393Assert.Equal("https://example.com/llms.txt", configuration["DOCS"]!["llmsTxtUrl"]!.GetValue<string>()); 394Assert.Equal("https://example.com/sitemap.xml", configuration["DOCS"]!["API"]!["sitemapUrl"]!.GetValue<string>()); 395Assert.Equal("preserved", configuration["DOCS"]!["API"]!["custom"]!.GetValue<string>()); 558Assert.Equal("preview", configuration["custom"]!.GetValue<string>()); 576Assert.Equal("pinned", configuration["custom"]!.GetValue<string>()); 700Assert.Equal("original", acquired.Configuration["custom"]!.GetValue<string>()); 714Assert.Equal(selector == "commit" ? "original" : "updated", refreshed.Configuration["custom"]!.GetValue<string>());
Configuration\ConfigSourceServiceTests.cs (9)
76Assert.Equal("version-2", JsonNode.Parse(actualGlobal)!["configSource"]!["appliedVersion"]!.GetValue<string>()); 222Assert.Equal("version-2", configuration["configSource"]!["appliedVersion"]!.GetValue<string>()); 223Assert.Equal(directory.Name, configuration["docs"]!["custom"]!.GetValue<string>()); 224Assert.Equal("https://updated.example/llms.txt", configuration["docs"]!["llmsTxtUrl"]!.GetValue<string>()); 554Assert.Equal("preserved", configuration["custom"]!.GetValue<string>()); 556configuration["docs"]!["llmsTxtUrl"]!.GetValue<string>()); 558configuration["configSource"]!["appliedVersion"]!.GetValue<string>()); 1285Assert.Equal("intervening edit", configuration["custom"]!.GetValue<string>()); 1286Assert.Equal("https://docs.example/llms.txt", configuration["docs"]!["llmsTxtUrl"]!.GetValue<string>());
Configuration\ConfigurationHelperTests.cs (13)
117Assert.Equal("updated", JsonNode.Parse(await File.ReadAllTextAsync(targetPath))!["custom"]!.GetValue<string>()); 138Assert.Equal("updated", JsonNode.Parse(await File.ReadAllTextAsync(targetPath))!["custom"]!.GetValue<string>()); 183Assert.Equal("updated", JsonNode.Parse(await File.ReadAllTextAsync(path))!["custom"]!.GetValue<string>()); 209Assert.Equal("updated", JsonNode.Parse(await File.ReadAllTextAsync(file.FullName))!["custom"]!.GetValue<string>()); 500Assert.Equal("daily", JsonNode.Parse(File.ReadAllText(settingsPath))!["channel"]!.GetValue<string>()); 518Assert.Equal("daily", JsonNode.Parse(File.ReadAllText(settingsPath))!["channel"]!.GetValue<string>()); 542Assert.Equal("daily", JsonNode.Parse(File.ReadAllText(settingsPath))!["channel"]!.GetValue<string>()); 667Assert.Equal("preserved", Assert.Single(settings["DOCS"]!.AsObject()).Value!.GetValue<string>()); 671Assert.Equal(i, nested[$"k{i}"]!.GetValue<int>()); 690Assert.Equal(expectedValue, api["SITEMAPURL"]!.GetValue<string>()); 691Assert.Equal("flat", api["other"]!.GetValue<string>()); 818Assert.Equal(i, properties[$"k{i}"]!.GetValue<int>()); 821Assert.Equal(-i, properties[$"x{i}"]!.GetValue<int>());
Configuration\ConfigurationServiceTests.cs (7)
122Assert.Equal(mutation == "delete" ? null : mutation == "set" ? "updated" : "original", settings["custom"]?.GetValue<string>()); 194Assert.Equal("edited", settings["custom"]!.GetValue<string>()); 196Assert.Equal("https://updated.example/llms.txt", settings["docs"]!["llmsTxtUrl"]!.GetValue<string>()); 197Assert.Equal("version-2", settings["configSource"]!["appliedVersion"]!.GetValue<string>()); 526Assert.Equal("true", node.GetValue<string>()); 549Assert.Equal("true", node.GetValue<string>()); 569Assert.Equal("daily", node.GetValue<string>());
Mcp\ExecuteResourceCommandToolTests.cs (4)
92Assert.Equal("#submit", connection.ExecuteResourceCommandArguments["selector"]!.GetValue<string>()); 113Assert.Equal("3", connection.ExecuteResourceCommandArguments["count"]!.GetValue<string>()); 114Assert.Equal("true", connection.ExecuteResourceCommandArguments["urgent"]!.GetValue<string>()); 115Assert.Equal("1.5", connection.ExecuteResourceCommandArguments["ratio"]!.GetValue<string>());
Mcp\ListStructuredLogsToolTests.cs (9)
311Assert.Equal("api-service-instance-1", firstLog["resourceName"]?.GetValue<string>()); 312Assert.Equal(42, firstLog["logId"]?.GetValue<long>()); 319Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=42", firstLog["dashboardUrl"]?.GetValue<string>()); 324Assert.Equal("api-service-instance-2", secondLog["resourceName"]?.GetValue<string>()); 325Assert.Equal(43, secondLog["logId"]?.GetValue<long>()); 330Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=43", secondLog["dashboardUrl"]?.GetValue<string>()); 335Assert.Equal("worker-service", thirdLog["resourceName"]?.GetValue<string>()); 336Assert.Equal(44, thirdLog["logId"]?.GetValue<long>()); 338Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=44", thirdLog["dashboardUrl"]?.GetValue<string>());
Mcp\ListTracesToolTests.cs (11)
236Assert.Equal("abc123def456789012345678901234567890", firstTrace["traceId"]?.GetValue<string>()); 244Assert.Equal("http://localhost:18888/traces/detail/abc123def456789012345678901234567890", firstTrace["dashboardUrl"]?.GetValue<string>()); 247var serverSpan = spans.FirstOrDefault(s => s?["kind"]?.GetValue<string>() == "Server")?.AsObject(); 249Assert.Equal("api-service-instance-1", serverSpan["source"]?.GetValue<string>()); 253var clientSpan = spans.FirstOrDefault(s => s?["kind"]?.GetValue<string>() == "Client")?.AsObject(); 255Assert.Equal("api-service-instance-2", clientSpan["source"]?.GetValue<string>()); 256Assert.Equal("catalog-service", clientSpan["destination"]?.GetValue<string>()); 261Assert.Equal("xyz789abc123456789012345678901234567890", secondTrace["traceId"]?.GetValue<string>()); 263Assert.Equal("http://localhost:18888/traces/detail/xyz789abc123456789012345678901234567890", secondTrace["dashboardUrl"]?.GetValue<string>()); 273Assert.Equal("Internal", internalSpan["kind"]?.GetValue<string>()); 274Assert.Equal("worker-service", internalSpan["source"]?.GetValue<string>());
Migrations\TypeScriptAppHostMigrationTests.cs (7)
62Assert.Equal(KnownLanguageId.TypeScript, descriptor.Metadata["language"]!.GetValue<string>()); 63Assert.Equal(appHostPath, descriptor.Metadata["appHostPath"]!.GetValue<string>()); 113Assert.Equal(appHostPath, descriptor.Metadata!["appHostPath"]!.GetValue<string>()); 190Assert.Equal("apphost.mts", config["appHost"]!["path"]!.GetValue<string>()); 193var includes = tsconfig["include"]!.AsArray().Select(n => n!.GetValue<string>()).ToArray(); 198Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]!.GetValue<string>()); 199Assert.Equal("eslint apphost.mts", scripts["aspire:lint"]!.GetValue<string>());
Projects\NativeAppHostServerProjectTests.cs (3)
88Assert.Equal(contract, request["coreContract"]!.GetValue<string>()); 89Directory.CreateDirectory(request["output"]!.GetValue<string>()); 475var output = request["output"]!.GetValue<string>();
Scaffolding\PackageJsonMergerTests.cs (97)
22ParseJson(mergedJson)["scripts"]![scriptName]?.GetValue<string>()!; 28ParseJson(mergedJson)[section]?[packageName]?.GetValue<string>(); 57Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 58Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 61Assert.Equal("aspire run", scripts["aspire:dev"]?.GetValue<string>()); 62Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 65Assert.Equal("eslint apphost.ts", scripts["lint"]?.GetValue<string>()); 94Assert.Equal("jest", scripts["test"]?.GetValue<string>()); 97Assert.Equal("aspire run", scripts["dev"]?.GetValue<string>()); 98Assert.Equal("tsc -p tsconfig.apphost.json", scripts["build"]?.GetValue<string>()); 99Assert.Equal("eslint apphost.ts", scripts["lint"]?.GetValue<string>()); 131Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 132Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 135Assert.Equal("custom start", scripts["aspire:start"]?.GetValue<string>()); 136Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 137Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 138Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 169Assert.Equal("npm run aspire:start", scripts["start"]?.GetValue<string>()); 170Assert.Equal("npm run aspire:lint", scripts["lint"]?.GetValue<string>()); 173Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 174Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 201Assert.Equal("yarn run aspire:start", scripts["start"]?.GetValue<string>()); 226Assert.Equal("deno task aspire:start", scripts["start"]?.GetValue<string>()); 227Assert.Equal("deno task aspire:dev", scripts["dev"]?.GetValue<string>()); 259Assert.Equal("node server.js", scripts["start"]?.GetValue<string>()); 260Assert.Equal("prettier --check .", scripts["lint"]?.GetValue<string>()); 261Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 262Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 265Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 266Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 267Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 271Assert.Equal("node server.js", scripts["start"]?.GetValue<string>()); 272Assert.Equal("prettier --check .", scripts["lint"]?.GetValue<string>()); 302Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 303Assert.Equal("jest", scripts["test"]?.GetValue<string>()); 306Assert.Equal("aspire run", scripts["aspire:dev"]?.GetValue<string>()); 309Assert.Equal("tsc -p tsconfig.apphost.json", scripts["build"]?.GetValue<string>()); 312Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 313Assert.Equal("npm run aspire:lint", scripts["lint"]?.GetValue<string>()); 395Assert.Equal("my-existing-app", json["name"]?.GetValue<string>()); 396Assert.Equal("3.0.0", json["version"]?.GetValue<string>()); 397Assert.Equal("My cool app", json["description"]?.GetValue<string>()); 398Assert.True(json["private"]?.GetValue<bool>()); 399Assert.Equal("module", json["type"]?.GetValue<string>()); 402Assert.Equal("^20.19.0 || ^22.13.0 || >=24", json["engines"]?["node"]?.GetValue<string>()); 470Assert.Equal("my-app", json["name"]?.GetValue<string>()); 544Assert.Equal("aspire run", scripts["dev"]?.GetValue<string>()); 545Assert.Equal("tsc -p tsconfig.apphost.json", scripts["build"]?.GetValue<string>()); 546Assert.Equal("eslint apphost.ts", scripts["lint"]?.GetValue<string>()); 602Assert.Equal("vite-project", json["name"]?.GetValue<string>()); 603Assert.Equal("1.0.0", json["version"]?.GetValue<string>()); 606Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 607Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 608Assert.Equal("eslint . --ext .ts,.tsx", scripts["lint"]?.GetValue<string>()); 609Assert.Equal("vite preview", scripts["preview"]?.GetValue<string>()); 612Assert.Equal("aspire run", scripts["aspire:dev"]?.GetValue<string>()); 613Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 614Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 617Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["watch"]?.GetValue<string>()); 660Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 661Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 664Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 665Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 666Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 667Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 670Assert.Equal("npm run aspire:start", scripts["start"]?.GetValue<string>()); 671Assert.Equal("npm run aspire:lint", scripts["lint"]?.GetValue<string>()); 674Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 675Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 724Assert.Equal("tsc && vite build", scripts["build"]?.GetValue<string>()); 725Assert.Equal("concurrently \"tsc -w\" \"vite\"", scripts["dev"]?.GetValue<string>()); 726Assert.Equal("vitest run && echo 'done'", scripts["test"]?.GetValue<string>()); 727Assert.Equal("eslint . --ext .ts,.tsx && prettier --check .", scripts["lint"]?.GetValue<string>()); 728Assert.Equal("rm -rf dist && rm -rf node_modules/.cache", scripts["clean"]?.GetValue<string>()); 729Assert.Equal("node server.js | tee output.log", scripts["start"]?.GetValue<string>()); 1044Assert.Equal("scaffold", ParseJson(result)["name"]?.GetValue<string>()); 1173Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 1201Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 1203Assert.Equal(">=8", engines["npm"]?.GetValue<string>()); 1226Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 1252Assert.Equal("web", keywords[0]!.GetValue<string>()); 1253Assert.Equal("api", keywords[1]!.GetValue<string>()); 1257Assert.Equal("dist/**", files[0]!.GetValue<string>()); 1304Assert.Equal("my-project", doc["name"]!.GetValue<string>()); 1305Assert.Equal("ISC", doc["license"]!.GetValue<string>()); 1322Assert.Contains(">=24", doc["engines"]?["node"]?.GetValue<string>()); 1489Assert.Equal("vite-brownfield", doc["name"]!.GetValue<string>()); 1490Assert.Equal("2.0.0", doc["version"]!.GetValue<string>()); 1491Assert.Equal("module", doc["type"]!.GetValue<string>()); 1495Assert.Equal("vite", scripts["dev"]?.GetValue<string>()); 1496Assert.Equal("vite build", scripts["build"]?.GetValue<string>()); 1497Assert.Equal("vite preview", scripts["preview"]?.GetValue<string>()); 1500Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 1501Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 1502Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 1503Assert.Equal("eslint apphost.ts", scripts["aspire:lint"]?.GetValue<string>()); 1518Assert.Contains(">=24", doc["engines"]?["node"]?.GetValue<string>());
Scaffolding\ScaffoldingServiceTests.cs (19)
127Assert.Equal("vitest", scripts["test"]?.GetValue<string>()); 128Assert.Equal("pnpm --dir apps/web/aspire-apphost run aspire:start", scripts["aspire:start"]?.GetValue<string>()); 129Assert.Equal("pnpm --dir apps/web/aspire-apphost run aspire:build", scripts["aspire:build"]?.GetValue<string>()); 130Assert.Equal("pnpm --dir apps/web/aspire-apphost run aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 144Assert.Equal("deno task --cwd apps/web/aspire-apphost aspire:start", scripts["aspire:start"]?.GetValue<string>()); 145Assert.Equal("deno task --cwd apps/web/aspire-apphost aspire:build", scripts["aspire:build"]?.GetValue<string>()); 146Assert.Equal("deno task --cwd apps/web/aspire-apphost aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 169Assert.Equal("pnpm --dir aspire-apphost run aspire:start", scripts["aspire:start"]?.GetValue<string>()); 170Assert.Equal("pnpm --dir aspire-apphost run aspire:build", scripts["aspire:build"]?.GetValue<string>()); 171Assert.Equal("pnpm --dir aspire-apphost run aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 195Assert.Equal("custom-start", scripts["aspire:start"]?.GetValue<string>()); 196Assert.Equal("npm --prefix aspire-apphost run aspire:build", scripts["aspire:build"]?.GetValue<string>()); 197Assert.Equal("npm --prefix aspire-apphost run aspire:dev", scripts["aspire:dev"]?.GetValue<string>()); 324Assert.True(merged["editor.formatOnSave"]!.GetValue<bool>()); 326Assert.Equal("automatic", merged["java.compile.nullAnalysis.mode"]!.GetValue<string>()); 327Assert.Equal([".", ".aspire/modules"], merged["java.project.sourcePaths"]!.AsArray().Select(v => v!.GetValue<string>())); 349merged["java.project.sourcePaths"]!.AsArray().Select(v => v!.GetValue<string>())); 371Assert.Equal(4, merged["editor.tabSize"]!.GetValue<int>()); 372Assert.Equal(["."], merged["java.project.sourcePaths"]!.AsArray().Select(v => v!.GetValue<string>()));
Secrets\SecretStoreResolverTests.cs (6)
171Assert.Equal(42, persisted["Resource:Count"]!.GetValue<int>()); 172Assert.True(persisted["Resource:Enabled"]!.GetValue<bool>()); 173Assert.Equal(1.25, persisted["Resource:Ratio"]!.GetValue<double>()); 176Assert.Equal(7, persisted["Canonical:Count"]!.GetValue<int>()); 177Assert.False(persisted["Canonical:Enabled"]!.GetValue<bool>()); 484Assert.Equal(42, JsonNode.Parse(File.ReadAllText(path))!["Count"]!.GetValue<int>());
Telemetry\ReportedLogExportTests.cs (1)
90switch (data["baseType"]!.GetValue<string>())
Utils\DevCertsCheckTests.cs (3)
309Assert.Equal("AAAA1111BBBB2222", certNode["thumbprint"]!.GetValue<string>()); 310Assert.Equal(MinVersion, certNode["version"]!.GetValue<int>()); 311Assert.Equal("full", certNode["trustLevel"]!.GetValue<string>());
Utils\EnvironmentCheckerTests.cs (2)
61Assert.Equal(nameof(TestEnvironmentCheck), timeoutResult.Metadata!["checkType"]!.GetValue<string>()); 62Assert.Equal(0.1, timeoutResult.Metadata["timeoutSeconds"]!.GetValue<double>());
Aspire.Dashboard (10)
Model\GenAI\GenAIItemPartViewModel.cs (2)
90? toolCallResponsePart.Response.GetValue<string>() 126? serverToolCallResponsePart.ServerToolCallResponse.GetValue<string>()
Model\GenAI\GenAIMessageParsingHelper.cs (1)
147if (node?.GetValueKind() == JsonValueKind.String && node.GetValue<string>() is { } json)
Model\GenAI\GenAISchemaHelpers.cs (4)
23Description = schemaObj["description"]?.GetValue<string>() 53schema.Required.Add(item.GetValue<string>()); 96var typeValue = item.GetValue<string>(); 112var typeString = typeNode.GetValue<string>();
Model\GenAI\GenAIVisualizerDialogViewModel.cs (3)
104Type = obj["type"]?.GetValue<string>() ?? "function", 105Name = obj["name"]?.GetValue<string>(), 106Description = obj["description"]?.GetValue<string>()
Aspire.Dashboard.Tests (15)
Model\GenAIMessageParsingHelperTests.cs (6)
138Assert.Equal("Seattle", toolCallPart.Arguments["location"]!.GetValue<string>()); 153Assert.Equal("Seattle", toolCallPart.Arguments["location"]!.GetValue<string>()); 168Assert.Equal(72, objectResponse.Response!["temperature"]!.GetValue<int>()); 172Assert.Equal("plain text result", stringResponse.Response!.GetValue<string>()); 246Assert.Equal("latest news", serverToolCallPart.ServerToolCall["query"]!.GetValue<string>()); 261Assert.Equal("web_search", serverToolCallResponsePart.ServerToolCallResponse["type"]!.GetValue<string>());
Model\GenAIVisualizerDialogViewModelTests.cs (2)
1194Assert.Equal("celsius", unitProp.Enum[0]!.GetValue<string>()); 1195Assert.Equal("fahrenheit", unitProp.Enum[1]!.GetValue<string>());
Model\TelemetryExportServiceTests.cs (7)
1434Assert.Equal("dependency-resource", waitingForPropertyValue?.GetValue<string>()); 1436Assert.Equal("localhost", connectionPropertiesObject["Host"]?.GetValue<string>()); 1437Assert.Equal("catalogdb", connectionPropertiesObject["DatabaseName"]?.GetValue<string>()); 1568Assert.Equal(6379, portsArray[0]!.GetValue<double>()); 1569Assert.Equal(6380, portsArray[1]!.GetValue<double>()); 1572var exitCode = deserialized.Properties["resource.exitCode"]!.GetValue<double>(); 1576var enabled = deserialized.Properties["resource.enabled"]!.GetValue<bool>();
Aspire.Hosting (10)
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
418JsonValueKind.String => value.GetValue<string>(),
Pipelines\Internal\DeploymentStateManagerBase.cs (1)
198value = jsonValue.GetValue<string>();
Pipelines\Internal\FileDeploymentStateManager.cs (3)
745var legacyFallbackDisabled = migrationState[LegacyFallbackDisabledProperty]?.GetValue<bool>() ?? false; 761JsonValue stateValue => JsonNode.Parse(stateValue.GetValue<string>())?.AsObject() 772claimedSectionsValue.GetValue<string>());
Publishing\ContainerRuntimeBase.cs (5)
197root["WorkingDir"]?.GetValue<string>()); 220if (item?.GetValue<string>() is { } value) 308var actualOperatingSystem = platform?["os"]?.GetValue<string>(); 309var actualArchitecture = platform?["architecture"]?.GetValue<string>(); 310var digest = descriptor["digest"]?.GetValue<string>();
Aspire.Hosting.Azure (56)
AzureProvisioningController.cs (29)
1929var outputs = ParseDeploymentStateJson(resource.Name, "Outputs", section.Data["Outputs"]?.GetValue<string>()); 1932: outputs?[name]?["value"]?.GetValue<string>(); 1951var subscriptionId = section.Data["SubscriptionId"]?.GetValue<string>(); 1952var resourceGroupName = section.Data["ResourceGroup"]?.GetValue<string>(); 2617deployment.TryGetPropertyValue("resourceId", out var resourceIdNode) ? resourceIdNode?.GetValue<string>() : null, 2628var deploymentId = section.Data["Id"]?.GetValue<string>(); 2632var outputs = ParseDeploymentStateJson(resource.Name, "Outputs", section.Data["Outputs"]?.GetValue<string>()); 2642["locationOverride"] = section.Data[LocationOverrideKey]?.GetValue<string>(), 2643["checksum"] = section.Data["CheckSum"]?.GetValue<string>(), 2645["scope"] = ParseDeploymentStateJson(resource.Name, "Scope", section.Data["Scope"]?.GetValue<string>()) 2651if (section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>() is { Length: > 0 } provisioningState) 2871if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 2890if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 3218=> section.Data["Id"]?.GetValue<string>() is { Length: > 0 } deploymentId ? deploymentId : null; 3222section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>(), 3283if (section.Data["Parameters"]?.GetValue<string>() is not { Length: > 0 } parametersJson) 3290var persistedLocation = AzureProvisioningJsonHelpers.ParseDeploymentStateJson(parametersJson)?[AzureBicepResource.KnownParameters.Location]?["value"]?.GetValue<string>(); 3314=> section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride ? locationOverride : null; 3497section.Data["SubscriptionId"]?.GetValue<string>() ?? provisionerOptions.Value.SubscriptionId ?? configuration["Azure:SubscriptionId"], 3498section.Data["ResourceGroup"]?.GetValue<string>() ?? provisionerOptions.Value.ResourceGroup ?? configuration["Azure:ResourceGroup"], 3499section.Data["Location"]?.GetValue<string>() ?? provisionerOptions.Value.Location ?? configuration["Azure:Location"], 3500section.Data["TenantId"]?.GetValue<string>() ?? provisionerOptions.Value.TenantId ?? configuration["Azure:TenantId"], 3501section.Data["Tenant"]?.GetValue<string>()); 3519if (section.Data["Outputs"]?.GetValue<string>() is not { Length: > 0 } outputsJson) 3528return AzureProvisioningJsonHelpers.ParseDeploymentStateJson(outputsJson)?["id"]?["value"]?.GetValue<string>(); 3638if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 3645if (section.Data["Parameters"]?.GetValue<string>() is not { Length: > 0 } parametersJson) 3652return AzureProvisioningJsonHelpers.ParseDeploymentStateJson(parametersJson)?[AzureBicepResource.KnownParameters.Location]?["value"]?.GetValue<string>(); 3946section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>(),
Provisioning\BicepUtilities.cs (2)
145if (section.Data[DeploymentStateParametersKey]?.GetValue<string>() is not { Length: > 0 } jsonString) 153var scope = section.Data[DeploymentStateScopeKey]?.GetValue<string>() is { Length: > 0 } scopeString
Provisioning\Internal\RunModeProvisioningContextProvider.cs (6)
244if (data["TenantResourceSuffix"]?.GetValue<string>() is { } tenantResourceSuffix) 248if (data["Location"]?.GetValue<string>() is { Length: > 0 } location) 253if (data["SubscriptionId"]?.GetValue<string>() is { Length: > 0 } subscriptionId) 258if (data["ResourceGroup"]?.GetValue<string>() is { Length: > 0 } resourceGroup) 263if (data["TenantId"]?.GetValue<string>() is { Length: > 0 } tenantId) 280JsonValueKind.String when bool.TryParse(value.GetValue<string>(), out var parsedValue) => parsedValue,
Provisioning\Provisioners\BicepProvisioner.cs (19)
57if (stateSection.Data[DeploymentStateProvisioningStateKey]?.GetValue<string>() is { Length: > 0 } provisioningState && 65var configCheckSum = stateSection.Data[BicepUtilities.DeploymentStateChecksumKey]?.GetValue<string>(); 81if (stateSection.Data[BicepUtilities.DeploymentStateOutputsKey]?.GetValue<string>() is { Length: > 0 } outputJson) 116if (stateSection.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>() is { Length: > 0 } configuredDeploymentId && 184stateSection.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>() is not { Length: > 0 } deploymentId || 355stateSection.Data[BicepUtilities.DeploymentStateChecksumKey]?.GetValue<string>() is not { Length: > 0 } checksum) 372var locationOverride = stateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 452var locationOverride = stateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 473if (stateSection.Data[key]?.GetValue<string>() is not { Length: > 0 } json) 492stateSection.Data[DeploymentStateProvisioningStateKey]?.GetValue<string>(), 624var canceledLocationOverride = canceledStateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 681locationOverride = stateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 799locationOverride = stateSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>(); 857var cachedDeploymentId = stateSection.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>(); 858var cachedChecksum = stateSection.Data[BicepUtilities.DeploymentStateChecksumKey]?.GetValue<string>(); 1490section.Data[key]?.GetValue<string>() is { Length: > 0 } value ? value : null; 1494if (section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 1499if (section.Data[BicepUtilities.DeploymentStateParametersKey]?.GetValue<string>() is { Length: > 0 } parametersJson) 1503if (JsonNode.Parse(parametersJson)?[AzureBicepResource.KnownParameters.Location]?["value"]?.GetValue<string>() is { Length: > 0 } configuredLocation)
Aspire.Hosting.Azure.Kubernetes (6)
AzureKubernetesEnvironmentResource.AksPipeline.cs (5)
413var scopeJson = deploymentStateSection.Data["Scope"]!.GetValue<string>(); 416scopedSubscription = scope["subscription"]?.GetValue<string>(); 417scopedResourceGroup = scope["resourceGroup"]?.GetValue<string>(); 464var outputsJson = deploymentState["Outputs"]?.GetValue<string>(); 470var resourceId = JsonNode.Parse(outputsJson)?["id"]?["value"]?.GetValue<string>();
AzureKubernetesEnvironmentResource.cs (1)
199return !string.IsNullOrEmpty(deploymentState["ReleaseName"]?.GetValue<string>());
Aspire.Hosting.Azure.Sandboxes (31)
AzureSandboxContainerDeployment.cs (28)
265var previousOwnerId = previousStateSection.Data["OwnerId"]?.GetValue<string>(); 390var pendingSecurityCleanup = previousStateSection.Data["PendingSecurityCleanup"]?.GetValue<bool>() == true; 494if (portStates.FirstOrDefault() is JsonObject firstPort && firstPort["Url"]?.GetValue<string>() is { } publicUrl) 1320var ownerId = stateSection.Data["OwnerId"]?.GetValue<string>(); 1436if (stateSection.Data["OwnerId"]?.GetValue<string>() is { Length: > 0 } ownerId && 1452stateSection.Data["OwnerId"]?.GetValue<string>())) 1592var sandboxId = stateSection.Data["SandboxId"]?.GetValue<string>(); 1605var diskImageId = stateSection.Data["DiskImageId"]?.GetValue<string>(); 1870if (stateSection.Data["ResourceName"]?.GetValue<string>() is { Length: > 0 } resourceName) 1933if (stateSection.Data["OwnerId"]?.GetValue<string>() is { Length: > 0 } previousOwnerId && 1967if (stateSection.Data["OwnerId"]?.GetValue<string>() is { Length: > 0 } previousOwnerId && 2070previousStateSection.Data["HasRuntimeEnvironmentConfiguration"]?.GetValue<bool>() == true || 2072previousStateSection.Data["HasRuntimeCommandConfiguration"]?.GetValue<bool>() == true) 2077if (previousStateSection.Data["PendingSecurityCleanup"]?.GetValue<bool>() == true) 2082var previousFingerprint = previousStateSection.Data["EndpointSecurityFingerprint"]?.GetValue<string>(); 2111var subscriptionId = stateSection.Data["SubscriptionId"]?.GetValue<string>(); 2112var resourceGroup = stateSection.Data["ResourceGroup"]?.GetValue<string>(); 2113var location = stateSection.Data["Location"]?.GetValue<string>(); 2114var sandboxGroup = stateSection.Data["SandboxGroup"]?.GetValue<string>(); 2135!string.IsNullOrWhiteSpace(stateSection.Data["OwnerId"]?.GetValue<string>()) || 2136!string.IsNullOrWhiteSpace(stateSection.Data["SandboxId"]?.GetValue<string>()) || 2137!string.IsNullOrWhiteSpace(stateSection.Data["DiskImageId"]?.GetValue<string>()); 2159if (port["Url"]?.GetValue<string>() is { Length: > 0 } url) 2175if (previousStateSection.Data["DeployId"]?.GetValue<string>() is { Length: > 0 } previousDeployId) 2190if (previousStateSection.Data[stateKey]?.GetValue<string>() is { Length: > 0 } previousId) 2204if (port["Port"]?.GetValue<int>() is { } portNumber) 2213if (stateSection.Data["Port"]?.GetValue<int>() is { } legacyPort) 2302var value = section.Data[name]?.GetValue<string>();
AzureSandboxEndpointPropertyValueProvider.cs (3)
135if (port["Port"]?.GetValue<int>() == sandboxEndpoint.TargetPort) 140if (string.Equals(port["Name"]?.GetValue<string>(), sandboxEndpoint.Name, StringComparison.Ordinal)) 151url = port["Url"]?.GetValue<string>();
Aspire.Hosting.Azure.Tests (177)
AzureBicepProvisionerTests.cs (18)
1119Assert.Equal("westus3", section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 1181Assert.Equal("/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.Resources/deployments/storage2", section.Data["Id"]?.GetValue<string>()); 1182Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateRunning, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1436Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1469Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1501Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1536Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>()); 1594Assert.Equal(ResourcesProvisioningState.Failed.ToString(), section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1696Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>()); 1697var outputs = JsonNode.Parse(section.Data[BicepUtilities.DeploymentStateOutputsKey]!.GetValue<string>())!.AsObject(); 1698Assert.Equal("https://storage.blob.core.windows.net/", outputs["blobEndpoint"]?["value"]?.GetValue<string>()); 1776Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateRunning, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1777Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>()); 1805Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateRunning, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1806Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>()); 1831Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateFailed, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1856Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1890Assert.Equal(deploymentId, section.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>());
AzureDeployerTests.cs (1)
721Assert.Equal("salmonisland-e9e6a567.westus3.azurecontainerapps.io", parameters[reference.Key]!["value"]!.GetValue<string>());
AzureEnvironmentResourceExtensionsTests.cs (136)
131Assert.Equal("aaaabbbb-0000-cccc-1111-dddd2222eeee", remaining[0]!["objectId"]!.GetValue<string>()); 132Assert.Equal("00001111-aaaa-2222-bbbb-3333cccc4444", remaining[1]!["objectId"]!.GetValue<string>()); 139Assert.Equal("storage-deployment", (await deploymentState.AcquireSectionAsync("Azure:Deployments:storage", cts.Token)).Data["Id"]!.GetValue<string>()); 190Assert.Equal("directory", remaining["resourceName"]!.GetValue<string>()); 191Assert.Equal("Microsoft.Graph/applications", remaining["resourceType"]!.GetValue<string>()); 321Assert.Equal("dev-a", saved.Data["TenantResourceSuffix"]!.GetValue<string>()); 323Assert.Equal("dev-a", json["tenantResourceSuffix"]!.GetValue<string>()); 324Assert.Equal("dev-a", json["azureContext"]!["tenantResourceSuffix"]!.GetValue<string>()); 664Assert.Contains("orphaned", resultData["warning"]?.GetValue<string>(), StringComparison.Ordinal); 666Assert.Contains(recommendedActions, action => action?["code"]?.GetValue<string>() == "delete-live-resources"); 1080Assert.Equal(1, data["resourceCount"]?.GetValue<int>()); 1160Assert.Equal(AzureProvisioningController.GetAzureResourceCommandName, data["command"]?.GetValue<string>()); 1161Assert.Equal("storage", data["resourceName"]?.GetValue<string>()); 1162Assert.Equal("westus2", data["azureLocation"]?.GetValue<string>()); 1163Assert.Equal("westus3", data["location"]?.GetValue<string>()); 1164Assert.Equal("westus3", data["effectiveLocation"]?.GetValue<string>()); 1169Assert.Equal(subscriptionId, azureContext["subscriptionId"]?.GetValue<string>()); 1170Assert.Equal(tenantId, azureContext["tenantId"]?.GetValue<string>()); 1171Assert.Equal(resourceGroup, azureContext["resourceGroup"]?.GetValue<string>()); 1172Assert.Equal("westus2", azureContext["location"]?.GetValue<string>()); 1175Assert.True(deployment["hasState"]?.GetValue<bool>()); 1176Assert.Equal(deploymentId, deployment["deploymentId"]?.GetValue<string>()); 1177Assert.Equal(resourceId, deployment["resourceId"]?.GetValue<string>()); 1178Assert.Equal("westus3", deployment["locationOverride"]?.GetValue<string>()); 1179Assert.Equal("checksum", deployment["checksum"]?.GetValue<string>()); 1180Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateRunning, deployment["provisioningState"]?.GetValue<string>()); 1181Assert.Contains("/DeploymentDetailsBlade/", deployment["deploymentPortalUrl"]?.GetValue<string>()); 1182Assert.Contains("/resource/subscriptions/", deployment["resourcePortalUrl"]?.GetValue<string>()); 1185Assert.Equal("https://storage.blob.core.windows.net/", outputs["blobEndpoint"]?["value"]?.GetValue<string>()); 1188Assert.Equal(resourceGroup, scope["resourceGroup"]?.GetValue<string>()); 1191Assert.True(live["checked"]?.GetValue<bool>()); 1192Assert.True(live["exists"]?.GetValue<bool>()); 1244Assert.True(live["checked"]?.GetValue<bool>()); 1245Assert.False(live["exists"]?.GetValue<bool>()); 1246Assert.Equal("missing-live-resource", live["reason"]?.GetValue<string>()); 1247Assert.Equal("azure", live["source"]?.GetValue<string>()); 1248Assert.Equal("missing-live-resource", live["code"]?.GetValue<string>()); 1249Assert.Contains("resource was not found in Azure", live["message"]?.GetValue<string>(), StringComparison.Ordinal); 1251Assert.Contains(recommendedActions, action => action?["code"]?.GetValue<string>() == "reprovision-or-forget-state"); 1305Assert.Equal("Microsoft.Storage/storageAccounts", json["resourceType"]?.GetValue<string>()); 1306Assert.Equal("storage", json["resourceName"]?.GetValue<string>()); 1307Assert.Equal(targetResourceId, json["targetResourceId"]?.GetValue<string>()); 1514Assert.True(deployment["hasState"]?.GetValue<bool>()); 1518Assert.False(live["checked"]?.GetValue<bool>()); 1520Assert.Equal("missing-resource-id", live["reason"]?.GetValue<string>()); 1521Assert.Equal("aspire", live["source"]?.GetValue<string>()); 1522Assert.Equal("missing-resource-id", live["code"]?.GetValue<string>()); 1523Assert.Contains("cached deployment state does not contain a resource ID", live["message"]?.GetValue<string>(), StringComparison.Ordinal); 1525Assert.Contains(recommendedActions, action => action?["code"]?.GetValue<string>() == "reprovision-or-change-context"); 1577Assert.True(live["checked"]?.GetValue<bool>()); 1579Assert.Equal("request-failed", live["reason"]?.GetValue<string>()); 1580Assert.Equal("azure", live["source"]?.GetValue<string>()); 1581Assert.Equal(403, live["status"]?.GetValue<int>()); 1582Assert.Equal("Azure", live["provider"]?.GetValue<string>()); 1583Assert.Equal(403, live["httpStatus"]?.GetValue<int>()); 1584Assert.Equal("AuthorizationFailed", live["errorCode"]?.GetValue<string>()); 1585Assert.Equal("live-resource-check", live["operation"]?.GetValue<string>()); 1586Assert.Contains("Forbidden", live["message"]?.GetValue<string>(), StringComparison.Ordinal); 1638Assert.True(live["checked"]?.GetValue<bool>()); 1640Assert.Equal("credential-unavailable", live["reason"]?.GetValue<string>()); 1641Assert.Contains("Credential unavailable", live["message"]?.GetValue<string>(), StringComparison.Ordinal); 1701Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 1835Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateCanceled, storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 2039Assert.Equal(BicepProvisioner.DeploymentStateProvisioningStateSucceeded, storageSection.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>()); 2129Assert.Equal(2, resultData["deletedResourceCount"]?.GetValue<int>()); 2131Assert.Equal(deletedResourceIds, resultResourceIds.Select(static resourceId => resourceId!.GetValue<string>())); 2134Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 2139Assert.Equal("storage2-deployment", storage2Section.Data["Id"]?.GetValue<string>()); 2220Assert.Equal(1, resultData["deletedResourceCount"]?.GetValue<int>()); 2448Assert.Equal("storage2-deployment", storage2Section.Data["Id"]?.GetValue<string>()); 2513Assert.Equal("storage2-deployment", storage2Section.Data["Id"]?.GetValue<string>()); 3122Assert.Equal("westus2", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3169Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3172Assert.Equal(1, data["schemaVersion"]?.GetValue<int>()); 3173Assert.Equal(AzureProvisioningController.ChangeResourceLocationCommandName, data["command"]?.GetValue<string>()); 3174Assert.Equal("storage", data["resourceName"]?.GetValue<string>()); 3175Assert.Equal("westus3", data["location"]?.GetValue<string>()); 3176Assert.Equal("westus3", data["effectiveLocation"]?.GetValue<string>()); 3177Assert.Equal("eastus", data["azureLocation"]?.GetValue<string>()); 3179Assert.Equal("eastus", azureContext["location"]?.GetValue<string>()); 3227Assert.Equal("westus3", bicepSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3553Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3615Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3680Assert.Equal("westus3", storageSection.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 3734Assert.Equal("12345678-1234-1234-1234-123456789012", azureSection.Data["SubscriptionId"]?.GetValue<string>()); 3735Assert.Equal("westus2", azureSection.Data["Location"]?.GetValue<string>()); 3736Assert.Equal("test-rg", azureSection.Data["ResourceGroup"]?.GetValue<string>()); 3737Assert.Equal("87654321-4321-4321-4321-210987654321", azureSection.Data["TenantId"]?.GetValue<string>()); 3780Assert.Equal("12345678-1234-1234-1234-123456789012", azureSection.Data["SubscriptionId"]?.GetValue<string>()); 3781Assert.Equal("westus3", azureSection.Data["Location"]?.GetValue<string>()); 3782Assert.Equal("cli-rg-é", azureSection.Data["ResourceGroup"]?.GetValue<string>()); 3783Assert.Equal("87654321-4321-4321-4321-210987654321", azureSection.Data["TenantId"]?.GetValue<string>()); 3786Assert.Equal(1, data["schemaVersion"]?.GetValue<int>()); 3787Assert.Equal(AzureProvisioningController.ChangeAzureContextCommandName, data["command"]?.GetValue<string>()); 3788Assert.Equal("12345678-1234-1234-1234-123456789012", data["subscriptionId"]?.GetValue<string>()); 3789Assert.Equal("87654321-4321-4321-4321-210987654321", data["tenantId"]?.GetValue<string>()); 3790Assert.Equal("cli-rg-é", data["resourceGroup"]?.GetValue<string>()); 3791Assert.Equal("westus3", data["azureLocation"]?.GetValue<string>()); 3793Assert.Equal("12345678-1234-1234-1234-123456789012", azureContext["subscriptionId"]?.GetValue<string>()); 3794Assert.Equal("87654321-4321-4321-4321-210987654321", azureContext["tenantId"]?.GetValue<string>()); 3795Assert.Equal("cli-rg-é", azureContext["resourceGroup"]?.GetValue<string>()); 3796Assert.Equal("westus3", azureContext["location"]?.GetValue<string>()); 3800Assert.Equal(1, data["resourceCount"]?.GetValue<int>()); 3901Assert.Equal("westus2", azureSection.Data["Location"]?.GetValue<string>()); 3996Assert.Equal("westus3", storage2Section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 4042Assert.Equal("westus3", storage2Section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 4101Assert.Equal("westus3", storage2Section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>()); 4344Assert.False(data["success"]?.GetValue<bool>()); 4347Assert.Equal("Microsoft.KeyVault", diagnostic["provider"]?.GetValue<string>()); 4348Assert.Equal("Microsoft.KeyVault/vaults", diagnostic["resourceType"]?.GetValue<string>()); 4349Assert.Equal("kv-test", diagnostic["resourceName"]?.GetValue<string>()); 4350Assert.Equal(keyVaultResourceId, diagnostic["targetResourceId"]?.GetValue<string>()); 4351Assert.Equal(AzureProvisioningFailureDetails.KeyVaultDeletedStateTombstoneNotFoundReason, diagnostic["errorCode"]?.GetValue<string>()); 4352Assert.Equal(409, diagnostic["httpStatus"]?.GetValue<int>()); 4353Assert.Contains("deleted vault was not found", diagnostic["errorMessage"]?.GetValue<string>(), StringComparison.Ordinal); 4355Assert.Contains(recommendedActions, action => action?["code"]?.GetValue<string>() == "retry-reprovision"); 4551Assert.False(data["success"]?.GetValue<bool>()); 4552Assert.Equal("failed", data["status"]?.GetValue<string>()); 4555Assert.Equal("azure", diagnostic["source"]?.GetValue<string>()); 4556Assert.Equal("Microsoft.ManagedIdentity", diagnostic["provider"]?.GetValue<string>()); 4557Assert.Equal("Microsoft.ManagedIdentity/userAssignedIdentities", diagnostic["resourceType"]?.GetValue<string>()); 4558Assert.Equal(400, diagnostic["httpStatus"]?.GetValue<int>()); 4559Assert.Equal("LocationNotAvailableForResourceType", diagnostic["errorCode"]?.GetValue<string>()); 4560Assert.Equal("provision", diagnostic["operation"]?.GetValue<string>()); 4562Assert.Contains(resultRecommendedActions, action => action?["code"]?.GetValue<string>() == "change-location"); 4857Assert.Equal("12345678-1234-1234-1234-123456789012", azureSection.Data["SubscriptionId"]?.GetValue<string>()); 4858Assert.Equal("westus2", azureSection.Data["Location"]?.GetValue<string>()); 4859Assert.Equal("test-rg", azureSection.Data["ResourceGroup"]?.GetValue<string>()); 4860Assert.Equal("87654321-4321-4321-4321-210987654321", azureSection.Data["TenantId"]?.GetValue<string>()); 5006Assert.Equal("storage-deployment", storageSection.Data["Id"]?.GetValue<string>()); 5885azureSection.Data["SubscriptionId"]?.GetValue<string>(), 5886azureSection.Data["ResourceGroup"]?.GetValue<string>(), 5887azureSection.Data["Location"]?.GetValue<string>(), 5888azureSection.Data["TenantId"]?.GetValue<string>(), 5889azureSection.Data["TenantResourceSuffix"]?.GetValue<string>()); 5916azureSection.Data["TenantResourceSuffix"]?.GetValue<string>());
AzureFunctionsTests.cs (8)
485Assert.Equal("container.v1", manifest["type"]?.GetValue<string>()); 486Assert.Equal("functions", manifest["build"]?["context"]?.GetValue<string>()); 487Assert.Equal("funcapp.Dockerfile", manifest["build"]?["dockerfile"]?.GetValue<string>()); 488Assert.Equal("node", manifest["env"]?["FUNCTIONS_WORKER_RUNTIME"]?.GetValue<string>()); 489Assert.Equal("OpenTelemetry", manifest["env"]?["AzureFunctionsJobHost__telemetryMode"]?.GetValue<string>()); 490Assert.Equal(80, manifest["bindings"]?["http"]?["targetPort"]?.GetValue<int>()); 572Assert.Equal("functions", manifest["build"]?["context"]?.GetValue<string>()); 573Assert.Equal("functions/Dockerfile", manifest["build"]?["dockerfile"]?.GetValue<string>());
AzureSandboxesTests.cs (3)
441Assert.Equal("existing-rg", rolesManifest["scope"]?["resourceGroup"]?.GetValue<string>()); 928Assert.Equal("production-sandbox", directCleanupState?["SandboxId"]?.GetValue<string>()); 929Assert.Equal("production-disk", directCleanupState?["DiskImageId"]?.GetValue<string>());
BicepUtilitiesTests.cs (7)
41Assert.Equal(expectedSuffix, parameters["tenantResourceSuffix"]!["value"]!.GetValue<string>()); 76Assert.Equal(string.Empty, parameters["tenantResourceSuffix"]!["value"]!.GetValue<string>()); 128Assert.Equal(20, parameters["age"]?["value"]?.GetValue<int>()); 184Assert.Equal("context-value", parameters["value"]?["value"]?.GetValue<string>()); 185Assert.Equal("context-value", parameters["deferred"]?["value"]?.GetValue<string>()); 186Assert.Equal("context-value/suffix", parameters["expression"]?["value"]?.GetValue<string>()); 519Assert.Null(scope["resourceGroup"]?.AsValue().GetValue<object>());
DefaultArmClientProviderTests.cs (1)
158Assert.Equal("https://storage.blob.core.windows.net/", deployment.Outputs?["blobEndpoint"]?["value"]?.GetValue<string>());
JsonExtensionsTests.cs (1)
23Assert.Equal("TestValue", retrievedNode["TestProperty"]!.GetValue<string>());
ProvisioningContextProviderTests.cs (2)
52Assert.Equal(selectedSuffix ?? string.Empty, saved.Data["TenantResourceSuffix"]!.GetValue<string>()); 177saved.Data["TenantResourceSuffix"]?.GetValue<string>());
Aspire.Hosting.CodeGeneration.Go.Tests (3)
GoScaffoldTests.cs (3)
113var applicationUrls = profile["applicationUrl"]!.GetValue<string>().Split(';').Select(url => new Uri(url)).ToList(); 116var otlpHttps = new Uri(environmentVariables["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 117var resourceServiceHttps = new Uri(environmentVariables["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>());
Aspire.Hosting.CodeGeneration.TypeScript.Tests (42)
AtsTypeScriptCodeGeneratorTests.cs (2)
53Assert.Equal("aspire-host", packageJson["name"]?.GetValue<string>()); 54Assert.Equal("module", packageJson["type"]?.GetValue<string>());
TypeScriptLanguageSupportTests.cs (40)
36Assert.Equal("brownfieldapp", packageJson["name"]?.GetValue<string>()); 37Assert.Equal("1.0.0", packageJson["version"]?.GetValue<string>()); 38Assert.True(packageJson["private"]?.GetValue<bool>()); 39Assert.Equal("module", packageJson["type"]?.GetValue<string>()); 40Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 41Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 42Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 43Assert.Equal("eslint apphost.mts", scripts["aspire:lint"]?.GetValue<string>()); 44Assert.Equal("eslint apphost.mts", scripts["lint"]?.GetValue<string>()); 45Assert.Equal("eslint apphost.mts && aspire run", scripts["dev"]?.GetValue<string>()); 46Assert.Equal("eslint apphost.mts && tsc -p tsconfig.apphost.json", scripts["build"]?.GetValue<string>()); 47Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["watch"]?.GetValue<string>()); 48Assert.Equal("^4.21.0", devDependencies["tsx"]?.GetValue<string>()); 49Assert.Equal("^5.9.3", devDependencies["typescript"]?.GetValue<string>()); 50Assert.Equal("^10.0.3", devDependencies["eslint"]?.GetValue<string>()); 51Assert.Equal("^8.57.1", devDependencies["typescript-eslint"]?.GetValue<string>()); 54Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 63Assert.Equal("./dist/apphost", tsConfig["compilerOptions"]?["outDir"]?.GetValue<string>()); 111Assert.Equal("aspire run", scripts["aspire:start"]?.GetValue<string>()); 112Assert.Equal("tsc -p tsconfig.apphost.json", scripts["aspire:build"]?.GetValue<string>()); 113Assert.Equal("tsc --watch -p tsconfig.apphost.json", scripts["aspire:dev"]?.GetValue<string>()); 114Assert.Equal("eslint apphost.mts", scripts["aspire:lint"]?.GetValue<string>()); 120Assert.Equal("^8.2.0", dependencies["vscode-jsonrpc"]?.GetValue<string>()); 121Assert.Equal("^4.21.0", devDependencies["tsx"]?.GetValue<string>()); 122Assert.Equal("^22.0.0", devDependencies["@types/node"]?.GetValue<string>()); 123Assert.Equal("^3.1.14", devDependencies["nodemon"]?.GetValue<string>()); 124Assert.Equal("^5.9.3", devDependencies["typescript"]?.GetValue<string>()); 129Assert.Equal("^20.19.0 || ^22.13.0 || >=24", engines["node"]?.GetValue<string>()); 147Assert.Equal("aspire-apphost", packageJson["name"]?.GetValue<string>()); 148Assert.Equal("1.0.0", packageJson["version"]?.GetValue<string>()); 149Assert.True(packageJson["private"]?.GetValue<bool>()); 150Assert.Equal("module", packageJson["type"]?.GetValue<string>()); 184Assert.Equal("^8.2.0", dependencies["vscode-jsonrpc"]?.GetValue<string>()); 185Assert.Equal("^22.0.0", devDependencies["@types/node"]?.GetValue<string>()); 186Assert.Equal("^3.1.14", devDependencies["nodemon"]?.GetValue<string>()); 187Assert.Equal("^4.21.0", devDependencies["tsx"]?.GetValue<string>()); 188Assert.Equal("^5.9.3", devDependencies["typescript"]?.GetValue<string>()); 236var applicationUrls = httpsProfile["applicationUrl"]!.GetValue<string>().Split(';', StringSplitOptions.RemoveEmptyEntries); 243var otlpHttpsPort = GetPort(environmentVariables["ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL"]!.GetValue<string>()); 244var resourceServiceHttpsPort = GetPort(environmentVariables["ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL"]!.GetValue<string>());
Aspire.Hosting.Dotnet.Tests (2)
DotnetProjectResourceTests.cs (2)
177Assert.Equal("project.v0", manifest["type"]?.GetValue<string>()); 178Assert.Equal(expectedPath, manifest["path"]?.GetValue<string>());
Aspire.Hosting.Foundry.Tests (4)
HostedAgentConfigurationTests.cs (3)
92Assert.Equal(ProjectsAgentProtocol.Responses.ToString(), protocolVersion!["protocol"]!.GetValue<string>()); 93Assert.Equal("2.0.0", protocolVersion["version"]!.GetValue<string>()); 94Assert.Equal("myregistry.azurecr.io/myagent:v1", definition["container_configuration"]!["image"]!.GetValue<string>());
HostedAgentExtensionTests.cs (1)
191Assert.Equal("hello from dashboard", JsonNode.Parse(fakeHandler.RequestContent!)?["message"]?.GetValue<string>());
Aspire.Hosting.JavaScript.Tests (1)
AddDenoAppTests.cs (1)
1092Assert.Equal(8000, manifest["bindings"]!["http"]!["targetPort"]!.GetValue<int>());
Aspire.Hosting.Native.Core.Tests (147)
ApplicationRevisionTests.cs (29)
31Assert.Equal(original["generationId"]!.GetValue<string>(), current["generationId"]!.GetValue<string>()); 40Assert.Equal("retained", logs["entries"]![0]!["message"]!.GetValue<string>()); 79Assert.Equal("pong", Result(await commandResult)["message"]!.GetValue<string>()); 80Assert.Equal("accepted", Result(await confirmationResult)["status"]!.GetValue<string>()); 155var id = context.Read()["resources"]![0]!["resourceId"]!.GetValue<string>(); 160Assert.NotEqual(id, context.Read()["resources"]![0]!["resourceId"]!.GetValue<string>()); 180Assert.Equal(2, change["revision"]!.GetValue<long>()); 181Assert.Equal(1, change["appliedRevision"]!.GetValue<long>()); 182Assert.Equal("pending", change["status"]!.GetValue<string>()); 183Assert.Equal("new-value", change["properties"]![0]!["value"]!.GetValue<string>()); 184Assert.False(context.Read()["resources"]![0]!["healthy"]!.GetValue<bool>()); 187Assert.Equal("failed", context.Read()["resources"]![0]!["configurationStatus"]!.GetValue<string>()); 195Assert.Equal(3, context.Read()["resources"]![0]!["appliedConfigurationRevision"]!.GetValue<long>()); 209Assert.Equal(database["resourceId"]!.GetValue<string>(), Assert.Single(configuration["dependencies"]!.AsArray())!.GetValue<string>()); 210Assert.Equal(2, configuration["revision"]!.GetValue<long>()); 211Assert.Equal("pending", configuration["status"]!.GetValue<string>()); 263Assert.Equal(2, configuration["revision"]!.GetValue<long>()); 264Assert.Equal("pending", configuration["status"]!.GetValue<string>()); 266Assert.Equal("cache", Assert.Single(dependencies["resources"]!.AsArray())!["name"]!.GetValue<string>()); 276var original = context.Read()["resources"]![0]!["resourceId"]!.GetValue<string>(); 285Assert.Equal(1, context.Read()["resources"]![0]!["configurationRevision"]!.GetValue<long>()); 286Assert.Equal(original, context.Read()["resources"]![0]!["resourceId"]!.GetValue<string>()); 295Assert.Equal(2, context.Read()["resources"]![0]!["configurationRevision"]!.GetValue<long>()); 357var original = context.Read()["resources"]![0]!["resourceId"]!.GetValue<string>(); 362Assert.NotEqual(original, context.Read()["resources"]![0]!["resourceId"]!.GetValue<string>()); 396response["error"]?["data"]?["code"]?.GetValue<string>() ?? 397response["result"]?["$error"]?["code"]?.GetValue<string>() ??
DcpWorkloadCleanupTests.cs (2)
302response["error"]?["data"]?["code"]?.GetValue<string>() ?? 303response["result"]?["$error"]?["code"]?.GetValue<string>() ??
DeclarativeApplicationTests.cs (1)
30configuration["properties"]!.AsArray().Select(entry => entry!["name"]!.GetValue<string>()).Order());
NativeAuxiliaryBackchannelTests.cs (4)
217Assert.Equal(1, first.Properties["configurationRevision"]!.GetValue<long>()); 221Assert.Equal("1", oldClient.Properties["configurationRevision"]!.GetValue<string>()); 233Assert.Equal(first.Properties["resourceId"]!.GetValue<string>(), updated.Properties["resourceId"]!.GetValue<string>());
NativeCliControlTests.cs (8)
25Assert.All(sdk, file => Assert.False(string.IsNullOrWhiteSpace(file.Value!.GetValue<string>()))); 32Assert.Equal(await reader.ReadToEndAsync(TestContext.Current.CancellationToken), file.Value!.GetValue<string>()); 34var identity = JsonNode.Parse(sdk["apphost-server.json"]!.GetValue<string>())!; 39Assert.Equal(Convert.ToHexString(contractHash.GetCurrentHash()), identity["contractId"]!.GetValue<string>()); 41identity["version"]!.GetValue<string>()); 48spec["migrationFiles"]![name] = content!.GetValue<string>().ReplaceLineEndings("\n"); 87Assert.True(JsonNode.Parse(response)!["result"]!.GetValue<bool>()); 92private static string Error(JsonObject response) => response["error"]!["data"]!["code"]!.GetValue<string>();
NativeCliProtocolTests.cs (1)
123.AsArray().Select(value => value!.GetValue<string>()));
NativeComposeCSharpDockerTests.cs (4)
39Assert.Equal(project, inputs["projectName"]!.GetValue<string>()); 124var web = state["services"]!.AsArray().Single(service => service!["resource"]!.GetValue<string>() == "web")!; 125var url = web["endpoints"]![0]!["url"]!.GetValue<string>(); 129return body["value"]!.GetValue<string>();
NativeComposeCSharpTests.cs (14)
29var actualProject = first.Compose["name"]!.GetValue<string>(); 32Assert.Equal(Path.Combine(root.FullName, "web"), build["context"]!.GetValue<string>()); 33Assert.Equal(Path.Combine(root.FullName, "web", "Dockerfile"), build["dockerfile"]!.GetValue<string>()); 70var cache = context.Model["resources"]!.AsArray().Single(resource => resource!["name"]!.GetValue<string>() == "cache")!; 71var web = context.Model["resources"]!.AsArray().Single(resource => resource!["name"]!.GetValue<string>() == "web")!; 72var target = context.Model["resources"]!.AsArray().Single(resource => resource!["name"]!.GetValue<string>() == "compose")!; 91var options = JsonNode.Parse(web["configuration"]!["publish.dockerCompose"]!.GetValue<string>())!; 100.Single(part => part!["kind"]!.GetValue<string>() == "endpoint")!["resource"] = "Cache.With Space"; 159.Select(pair => KeyValuePair.Create(pair.Key, pair.Value!.GetValue<string>())), resolved.OrderBy(pair => pair.Key, StringComparer.Ordinal)); 375Assert.Equal(["cache"], model["resources"]!.AsArray().Select(resource => resource!["name"]!.GetValue<string>())); 417var resource = context.Model["resources"]!.AsArray().Single(resource => resource!["name"]!.GetValue<string>() == "web")!; 438var environment = resources.Single(resource => resource!["name"]!.GetValue<string>() == "compose")!.DeepClone(); 441var cache = resources.Single(resource => resource!["name"]!.GetValue<string>() == "cache")!; 465var environment = context.Model["resources"]!.AsArray().Single(resource => resource!["name"]!.GetValue<string>() == "compose")!;
NativeDashboardTests.cs (3)
100ResourceName = "cache", ResourceType = context.Read()["resources"]![0]!["typeId"]!.GetValue<string>(), CommandName = "refresh" 124Assert.Equal(accepted ? "accepted" : "rejected", Result(await completion.WaitAsync(timeout.Token))["status"]!.GetValue<string>()); 138Assert.Equal("accepted", Result(await completion.WaitAsync(timeout.Token))["status"]!.GetValue<string>());
NativeLanguageCatalogTests.cs (4)
24Assert.Equal("custom", spec["execute"]!["command"]!.GetValue<string>()); 25Assert.Equal("CustomSdk.", catalog.GeneratedSdk("Custom")["library.custom"]!.GetValue<string>()); 26Assert.Equal("OtherSdk.", catalog.GeneratedSdk("example/other-runtime")["library.custom"]!.GetValue<string>()); 28Assert.Equal("example/custom-runtime", catalog.RuntimeSpec("example/custom-runtime")["language"]!.GetValue<string>());
NativeModelAlignmentTests.cs (5)
30var api = exported["resources"]!.AsArray().Single(resource => resource!["name"]!.GetValue<string>() == "api")!; 31Assert.Equal("second", api["computeEnvironment"]!.GetValue<string>()); 32Assert.Equal("second", api["configuration"]!["publish.computeEnvironment"]!.GetValue<string>()); 34endpoint => Assert.True(endpoint!["isExternal"]!.GetValue<bool>()), 35endpoint => Assert.False(endpoint!["isExternal"]!.GetValue<bool>()));
NativeNamedPipeTests.cs (2)
28Assert.True((await first.CallAsync("authenticate", new JsonArray(Token), timeout.Token))["result"]!.GetValue<bool>()); 29Assert.True((await second.CallAsync("authenticate", new JsonArray(Token), timeout.Token))["result"]!.GetValue<bool>());
NativeProtocolParsingTests.cs (3)
69Assert.Equal("request-id", request.Id!.GetValue<string>()); 72capability => Assert.Equal("example/test", capability!.GetValue<string>()), 73arguments => Assert.Equal("retained", arguments!["nested"]!["value"]!.GetValue<string>()));
NativeProviderClientTests.cs (3)
60Assert.Equal("getCapabilities", discovery["method"]!.GetValue<string>()); 71Assert.Equal("PROVIDER_REGISTRATION_REJECTED", rejection["error"]!["data"]!["code"]!.GetValue<string>()); 131Assert.Equal("getCapabilities", request["method"]!.GetValue<string>());
NativeProviderProtocolTests.cs (2)
52Assert.Equal("foreign/Resource", Assert.Single(manifest.Capabilities).Value.Metadata["extension"]!["typeId"]!.GetValue<string>()); 94Assert.Equal("attach", capability.Metadata["method"]!.GetValue<string>());
NativePublishingTests.cs (3)
45var application = exported["resources"]!.AsArray().Single(resource => resource!["name"]!.GetValue<string>() == "web")!; 46Assert.Equal(Environment.ProcessPath, application["executable"]!.GetValue<string>()); 47Assert.Equal(AppContext.BaseDirectory, application["workingDirectory"]!.GetValue<string>());
NativeRpcTests.cs (11)
29Assert.False(client.Call("authenticate", new JsonArray("wrong-token"))["result"]!.GetValue<bool>()); 31Assert.True(client.Call("authenticate", new JsonArray(Token))["result"]!.GetValue<bool>()); 50Assert.Equal("cache", resource!["name"]!.GetValue<string>()); 55Assert.Equal("web", resource!["name"]!.GetValue<string>()); 56Assert.Equal(snapshot["resources"]![0]!["resourceId"]!.GetValue<string>(), 57Assert.Single(resource["dependencies"]!.AsArray())!.GetValue<string>()); 102Arguments(("context", liveResources[index]))))["name"]!.GetValue<string>()); 106Assert.Equal("replacement", Result(client.Invoke("inspectResource", Arguments(("context", added))))["name"]!.GetValue<string>()); 124Assert.Equal("cache", Result(first.Invoke("inspectResource", Arguments(("context", resource))))["name"]!.GetValue<string>()); 165Assert.Equal("The operation is not allowed in the current state.", duplicate["result"]!["$error"]!["message"]!.GetValue<string>()); 224(response["result"]?["$error"]?["code"] ?? response["error"]!["data"]!["code"])!.GetValue<string>();
NativeSocketIsolationTests.cs (16)
35Assert.Equal(-32000, error["code"]!.GetValue<int>()); 36Assert.Equal("Authenticate before using capabilities.", error["message"]!.GetValue<string>()); 38Assert.True((await authenticated.CallAsync("authenticate", new JsonArray(Token), timeout.Token))["result"]!.GetValue<bool>()); 72Assert.Equal(-32603, error["code"]!.GetValue<int>()); 73Assert.Equal("The backchannel request failed internally.", error["message"]!.GetValue<string>()); 74Assert.Equal("ok", (await client.CallAsync("Succeed", null, TestContext.Current.CancellationToken))["result"]!.GetValue<string>()); 77Assert.Equal("ok", (await subsequent.CallAsync("Succeed", null, TestContext.Current.CancellationToken))["result"]!.GetValue<string>()); 99Assert.True((await existing.CallAsync("authenticate", new JsonArray(Token), timeout.Token))["result"]!.GetValue<bool>()); 108Assert.True((await subsequent.CallAsync("authenticate", new JsonArray(Token), timeout.Token))["result"]!.GetValue<bool>()); 154Assert.Equal("INTERNAL_ERROR", error["code"]!.GetValue<string>()); 155Assert.Equal("The request failed internally.", error["message"]!.GetValue<string>()); 158Assert.True((await subsequent.CallAsync("authenticate", new JsonArray(Token), timeout.Token))["result"]!.GetValue<bool>()); 195Assert.Equal(["baseline.v2"], response["result"]!.AsArray().Select(value => value!.GetValue<string>())); 232Assert.Equal("ready", (await next.CallAsync("ready", null, timeout.Token))["result"]!.GetValue<string>()); 251Assert.Equal("ready", (await next.CallAsync("ready", null, timeout.Token))["result"]!.GetValue<string>()); 314Assert.True((await client.CallAsync("authenticate", new JsonArray(Token), timeout.Token))["result"]!.GetValue<bool>());
ResourceWorkloadTests.cs (4)
40Assert.Equal(0, endpoint["port"]!.GetValue<int>()); 60Assert.Equal(5050, endpoint["port"]!.GetValue<int>()); 65Assert.Equal("HANDLE_NOT_FOUND", context.Publish("Running", true)["result"]!["$error"]!["code"]!.GetValue<string>()); 67("context", context.Session)))["result"]!["$error"]!["code"]!.GetValue<string>());
RuntimeRpcTests.cs (24)
26Assert.Equal(["entry-2", "entry-3"], logs["entries"]!.AsArray().Select(entry => entry!["message"]!.GetValue<string>())); 44Assert.True(updated["version"]!.GetValue<long>() > initial["version"]!.GetValue<long>()); 46Assert.Equal("cache", resource["name"]!.GetValue<string>()); 47Assert.Equal("Running", resource["state"]!.GetValue<string>()); 48Assert.True(resource["healthy"]!.GetValue<bool>()); 49Assert.Equal("http://localhost:8000", Assert.Single(resource["urls"]!.AsArray())!.GetValue<string>()); 86Assert.True(logs["truncated"]!.GetValue<bool>()); 87Assert.Equal(300, logs["lastSequence"]!.GetValue<long>()); 89logs["entries"]!.AsArray().Select(entry => entry!["message"]!.GetValue<string>())); 92Assert.False(suffix["truncated"]!.GetValue<bool>()); 93Assert.Equal([299L, 300L], suffix["entries"]!.AsArray().Select(entry => entry!["sequence"]!.GetValue<long>())); 109Assert.Equal("refresh", pending["name"]!.GetValue<string>()); 113Assert.Equal("succeeded", result["status"]!.GetValue<string>()); 114Assert.Equal("refreshed", result["message"]!.GetValue<string>()); 119Assert.Equal("cache", prompt["resourceName"]!.GetValue<string>()); 120Assert.Equal("Continue?", prompt["message"]!.GetValue<string>()); 123Assert.Equal("accepted", Result(await answer.WaitAsync(TimeSpan.FromSeconds(10)))["status"]!.GetValue<string>()); 139Assert.Equal("cancelled", Result(await result.WaitAsync(TimeSpan.FromSeconds(10)))["status"]!.GetValue<string>()); 141Assert.Equal("Failed", resource["state"]!.GetValue<string>()); 142Assert.False(resource["healthy"]!.GetValue<bool>()); 155Assert.Equal("cancelled", Result(await answer.WaitAsync(TimeSpan.FromSeconds(10)))["status"]!.GetValue<string>()); 171Assert.Equal("Unknown", context.Read()["resources"]![0]!["state"]!.GetValue<string>()); 175(response["result"]?["$error"]?["code"] ?? response["error"]!["data"]!["code"])!.GetValue<string>();
TestServices\RpcTestClient.cs (1)
39if (authenticate && Call("authenticate", new JsonArray(Token))["result"]?.GetValue<bool>() != true)
WorkloadDefinitionTests.cs (3)
30context.Read()["resources"]![0]!["urls"]!.AsArray().Select(url => url!.GetValue<string>())); 71Assert.Equal("INVALID_ARGUMENT", response["result"]!["$error"]!["code"]!.GetValue<string>()); 73Assert.Equal("Unknown", context.Read()["resources"]![0]!["state"]!.GetValue<string>());
Aspire.Hosting.Native.Server (6)
Api\ParameterApi.cs (3)
51var length = configuration["minLength"]?.GetValue<int>() ?? 22; 59var enabled = configuration[flags[index]]?.GetValue<bool>() ?? true; 60var minimum = configuration[minima[index]]?.GetValue<int>() ?? (enabled ? 1 : 0);
Rpc\NativeProviderMetadata.cs (2)
25contract["Capabilities"]!.AsArray().Select(value => value!["CapabilityId"]!.GetValue<string>()).ToHashSet(StringComparer.Ordinal), 26contract["HandleTypes"]!.AsArray().Select(value => value!["AtsTypeId"]!.GetValue<string>()).ToHashSet(StringComparer.Ordinal));
Rpc\NativeRpcConnection.cs (1)
22.Select(capability => capability!["CapabilityId"]!.GetValue<string>()).ToHashSet(StringComparer.Ordinal);
Aspire.Hosting.Redis.Tests (30)
AddRedisTests.cs (26)
156Assert.Equal("container.v0", manifest["type"]!.GetValue<string>()); 157var connectionString = manifest["connectionString"]!.GetValue<string>(); 162Assert.Equal($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}", manifest["image"]!.GetValue<string>()); 163Assert.Equal("/bin/sh", manifest["entrypoint"]!.GetValue<string>()); 164Assert.Equal("{redis-password.value}", manifest["env"]!["REDIS_PASSWORD"]!.GetValue<string>()); 165Assert.Equal("redis", manifest["bindings"]!["tcp"]!["scheme"]!.GetValue<string>()); 166Assert.Equal(6379, manifest["bindings"]!["tcp"]!["targetPort"]!.GetValue<int>()); 181Assert.Equal("container.v0", manifest["type"]!.GetValue<string>()); 182var connectionString = manifest["connectionString"]!.GetValue<string>(); 187Assert.Equal($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}", manifest["image"]!.GetValue<string>()); 188Assert.Equal("/bin/sh", manifest["entrypoint"]!.GetValue<string>()); 189Assert.Equal("redis", manifest["bindings"]!["tcp"]!["scheme"]!.GetValue<string>()); 190Assert.Equal(6379, manifest["bindings"]!["tcp"]!["targetPort"]!.GetValue<int>()); 210Assert.Equal("container.v0", manifest["type"]!.GetValue<string>()); 211var connectionString = manifest["connectionString"]!.GetValue<string>(); 216Assert.Equal($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}", manifest["image"]!.GetValue<string>()); 217Assert.Equal("{pass.value}", manifest["env"]!["REDIS_PASSWORD"]!.GetValue<string>()); 218Assert.Equal("redis", manifest["bindings"]!["tcp"]!["scheme"]!.GetValue<string>()); 219Assert.Equal(6379, manifest["bindings"]!["tcp"]!["targetPort"]!.GetValue<int>()); 236Assert.Equal("container.v0", manifest["type"]!.GetValue<string>()); 237var connectionString = manifest["connectionString"]!.GetValue<string>(); 242Assert.Equal($"{RedisContainerImageTags.Registry}/{RedisContainerImageTags.Image}:{RedisContainerImageTags.Tag}", manifest["image"]!.GetValue<string>()); 243Assert.Equal("{pass.value}", manifest["env"]!["REDIS_PASSWORD"]!.GetValue<string>()); 244Assert.Equal("redis", manifest["bindings"]!["tcp"]!["scheme"]!.GetValue<string>()); 245Assert.Equal(6379, manifest["bindings"]!["tcp"]!["targetPort"]!.GetValue<int>()); 1090Assert.Equal("value.v0", creEntry["type"]!.GetValue<string>());
RedisFunctionalTests.cs (4)
719Assert.False(agreements["analytics"]!.GetValue<bool>()); 720Assert.False(agreements["notifications"]!.GetValue<bool>()); 721Assert.False(agreements["encryption"]!.GetValue<bool>()); 722Assert.True(agreements["eula"]!.GetValue<bool>());
Aspire.Hosting.RemoteHost (8)
Ats\AtsMarshaller.cs (4)
881return value.GetValue<string>(); 886return value.GetValue<bool>(); 931return value.GetValue<double>(); 936return value.TryGetValue<float>(out var floatValue) ? floatValue : (float)value.GetValue<double>();
Ats\CapabilityDispatcher.cs (3)
1062return value.GetValue<string>() ?? 1073return value.GetValue<string>(); 1085return value.GetValue<int>();
Ats\HandleRegistry.cs (1)
199var handleId = handleNode?.GetValue<string>();
Aspire.Hosting.RemoteHost.Tests (141)
AtsMarshallerTests.cs (31)
137Assert.Equal("hello", result.GetValue<string>()); 148Assert.Equal(42, result.GetValue<int>()); 159Assert.True(result.GetValue<bool>()); 205Assert.Equal("test/IResource", result["$type"]!.GetValue<string>()); 206Assert.True(registry.TryGet(result["$handle"]!.GetValue<string>(), out var retrieved, out _)); 238Assert.Equal("ValueB", result.GetValue<string>()); 249Assert.Equal(1500.0, result.GetValue<double>()); 264Assert.Equal(1, jsonArray[0]!.GetValue<int>()); 265Assert.Equal(2, jsonArray[1]!.GetValue<int>()); 266Assert.Equal(3, jsonArray[2]!.GetValue<int>()); 279var tokenId = tokenValue.GetValue<string>(); 300var tokenId = tokenValue.GetValue<string>(); 529Assert.Equal("2024-06-15", result.GetValue<string>()); 552Assert.Contains("14:30:45", result.GetValue<string>()); 573Assert.Equal(9223372036854775807L, result.GetValue<long>()); 584Assert.Equal(3.14159, result.GetValue<double>()); 613var typeId = jsonObj["$type"]!.GetValue<string>(); 632var typeId = jsonObj["$type"]!.GetValue<string>(); 844Assert.Equal("test", jsonObj["name"]?.GetValue<string>()); 845Assert.Equal(10, jsonObj["count"]?.GetValue<int>()); 897Assert.Equal(1500, json["required"]?.GetValue<double>()); 898Assert.Equal(90_000, json["optional"]?.GetValue<double>()); 991Assert.Equal("root", obj["name"]!.GetValue<string>()); 1007Assert.Equal("parent", obj["label"]!.GetValue<string>()); 1009Assert.Equal("child", childObj["label"]!.GetValue<string>()); 1027Assert.Equal("typed", obj["name"]!.GetValue<string>()); 1043Assert.Equal("parent", obj["label"]!.GetValue<string>()); 1045Assert.Equal("child", childObj["label"]!.GetValue<string>()); 1361var handleId = json["$handle"]!.GetValue<string>(); 1379var handleId = json!["$handle"]!.GetValue<string>(); 1398var handleId = json!["$handle"]!.GetValue<string>();
CallbackProxyTests.cs (10)
209Assert.Equal("hello-world", args["p0"]?.GetValue<string>()); 226Assert.Equal("test-name", args["p0"]?.GetValue<string>()); 227Assert.Equal(42, args["p1"]?.GetValue<int>()); 251Assert.NotNull(handle["$handle"]?.GetValue<string>()); 252Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(ITestCallbackHandle)), handle["$type"]?.GetValue<string>()); 282Assert.Equal("test", args["p0"]?.GetValue<string>()); 283var tokenId = args["p1"]?.GetValue<string>(); 286Assert.Equal(tokenId, args["$cancellationToken"]?.GetValue<string>()); 303var tokenId = args["p0"]?.GetValue<string>(); 305Assert.Equal(tokenId, args["$cancellationToken"]?.GetValue<string>());
CapabilityDispatcherTests.cs (79)
152var resultHandle = result["$handle"]!.GetValue<string>(); 163Assert.Equal(132, invocation.Args!["p0"]!["columns"]!.GetValue<int>()); 164Assert.Equal(50, invocation.Args!["p0"]!["rows"]!.GetValue<int>()); 262receivedName = args?["name"]?.GetValue<string>(); 280Assert.Equal(42, result.GetValue<int>()); 382Assert.Equal("HELLO", result.GetValue<string>()); 394Assert.Equal("test:default", result.GetValue<string>()); 406Assert.Equal("test:custom", result.GetValue<string>()); 462Assert.Equal("test-name", nameResult.GetValue<string>()); 464Assert.Equal(100, countResult.GetValue<int>()); 523Assert.True(result.GetValue<bool>()); 583var nestedHandleId = handleRef["$handle"]!.GetValue<string>(); 584var nestedTypeId = handleRef["$type"]!.GetValue<string>(); 594Assert.Equal("Publish", operationResult.GetValue<string>()); 769Assert.Equal(12, result.GetValue<int>()); 789Assert.Equal("TEST", result.GetValue<string>()); 809Assert.Equal("VALUE-TASK", result.GetValue<string>()); 821Assert.Equal("VALUE-TASK", result.GetValue<string>()); 868Assert.Equal("PROCESSED: test-input", result.GetValue<string>()); 912Assert.Equal("hello from C#", callbackArgs["p0"]?.GetValue<string>()); 932Assert.Equal(42, result.GetValue<int>()); 944Assert.Equal(callerThreadId, result.GetValue<int>()); 956Assert.NotEqual(callerThreadId, result.GetValue<int>()); 968Assert.NotEqual(callerThreadId, result.GetValue<int>()); 993Assert.NotEqual(callerThreadId, result.GetValue<int>()); 1110Assert.Equal("HELLO", result.GetValue<string>()); 1139Assert.Equal(15, result.GetValue<int>()); 1154Assert.Equal("item0", resultArray[0]?.GetValue<string>()); 1155Assert.Equal("item1", resultArray[1]?.GetValue<string>()); 1156Assert.Equal("item2", resultArray[2]?.GetValue<string>()); 1171Assert.Equal(60, result.GetValue<int>()); 1184Assert.Equal("hello", result.GetValue<string>()); 1196Assert.Equal("42", result.GetValue<string>()); 1214Assert.Equal("dto-value", result.GetValue<string>()); 1226Assert.Equal("enum:ValueB", result.GetValue<string>()); 1238Assert.Equal("string:/usr/local/lib/redis/modules/redisearch.so", result.GetValue<string>()); 1279Assert.Equal("union-resource", result.GetValue<string>()); 1345var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1358Assert.Equal("second", result.GetValue<string>()); 1368var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1380Assert.Equal(20, result.GetValue<int>()); 1391var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1403Assert.True(removeResult.GetValue<bool>()); 1413Assert.Equal(2, lengthResult.GetValue<int>()); 1424var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1435Assert.Equal(3, result.GetValue<int>()); 1446var listHandle = (listResult as JsonObject)?["$handle"]?.GetValue<string>(); 1464Assert.Equal(0, lengthResult.GetValue<int>()); 1491var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1504Assert.Equal("value1", result.GetValue<string>()); 1514var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1526Assert.Equal(10, result.GetValue<int>()); 1536var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1548Assert.Equal("one", result.GetValue<string>()); 1559var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1571Assert.True(removeResult.GetValue<bool>()); 1581Assert.Equal(1, countResult.GetValue<int>()); 1592var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1604Assert.True(hasResult.GetValue<bool>()); 1615Assert.False(hasResult2.GetValue<bool>()); 1626var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1640Assert.Contains("key1", keysArray.Select(k => k?.GetValue<string>())); 1641Assert.Contains("key2", keysArray.Select(k => k?.GetValue<string>())); 1651var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1664Assert.Contains(1, keysArray.Select(k => k?.GetValue<int>())); 1665Assert.Contains(2, keysArray.Select(k => k?.GetValue<int>())); 1675var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1695var dictHandle = (dictResult as JsonObject)?["$handle"]?.GetValue<string>(); 1706Assert.Equal(2, result.GetValue<int>()); 1723Assert.Equal("Received: ValueB", result.GetValue<string>()); 1740Assert.Equal("Received: ValueC", result.GetValue<string>()); 1757Assert.Equal("ValueA", result.GetValue<string>()); 1774Assert.Equal("Received: ValueB", result.GetValue<string>()); 1786Assert.Equal("No value", result.GetValue<string>()); 1875Assert.Equal("blue", result.GetValue<string>()); 1916Assert.Equal("hello, test-resource!", result.GetValue<string>()); 1933Assert.Equal("yellow", result.GetValue<string>()); 1950Assert.Equal("my-resource", result.GetValue<string>()); 2293Assert.Equal("Host", result.GetValue<string>());
ExternalCapabilityRegistryTests.cs (18)
29relayId = args!["configure"]!.GetValue<string>(); 113Assert.Equal("configured", (await registry.TryInvokeAsync("test.external/value", null)).Result!.GetValue<string>()); 188relayId = args!["configure"]!.GetValue<string>(); 194return Task.FromResult<JsonNode?>(JsonValue.Create($"deferred-{args!["p0"]!.GetValue<string>()}")); 203Assert.Equal("deferred-configured", result!.GetValue<string>()); 299relayId = args!["configure"]!.GetValue<string>(); 323Assert.Equal("completed", result!.GetValue<string>()); 356relayId = args!["configure"]!.GetValue<string>(); 512Assert.Equal("replacement", (await registry.TryInvokeAsync("test.external/value", null)).Result!.GetValue<string>()); 513Assert.Equal("other", (await registry.TryInvokeAsync("test.external/other", null)).Result!.GetValue<string>()); 619Assert.Equal("first-replacement", (await registry.TryInvokeAsync("test.external/first", null)).Result!.GetValue<string>()); 620Assert.Equal("second-replacement", (await registry.TryInvokeAsync("test.external/second", null)).Result!.GetValue<string>()); 631request.TrySetResult(args!["configure"]!.GetValue<string>()); 664var isFirst = args!["name"]!.GetValue<string>() == "first"; 665(isFirst ? firstRequest : secondRequest).TrySetResult(args["configure"]!.GetValue<string>()); 685Assert.Equal("guest_callback", firstArgs["configure"]!.GetValue<string>()); 686Assert.Equal("guest_callback", secondArgs["configure"]!.GetValue<string>()); 716relayId = args!["configure"]!.GetValue<string>();
HandleRegistryTests.cs (2)
171Assert.Equal("aspire/TestObject", json["$type"]!.GetValue<string>()); 173var handleId = json["$handle"]!.GetValue<string>();
JsonRpcCallbackInvokerTests.cs (1)
82Assert.Equal("responsive", result.GetValue<string>());
Aspire.Hosting.Tests (104)
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (13)
326Assert.Equal("normal-value", normalJsonValue.GetValue<string>()); 1320Assert.Equal("42", Assert.IsAssignableFrom<JsonValue>(snapshot.Properties["number"]).GetValue<string>()); 1321Assert.Equal(bool.TrueString, Assert.IsAssignableFrom<JsonValue>(snapshot.Properties["flag"]).GetValue<string>()); 1322Assert.Equal("one,two", Assert.IsAssignableFrom<JsonValue>(snapshot.Properties["list"]).GetValue<string>()); 1367Assert.Equal(42, Assert.IsAssignableFrom<JsonValue>(snapshot.Properties["number"]).GetValue<int>()); 1368Assert.True(Assert.IsAssignableFrom<JsonValue>(snapshot.Properties["flag"]).GetValue<bool>()); 1372value => Assert.Equal("one", value?.GetValue<string>()), 1373value => Assert.Equal("two", value?.GetValue<string>())); 1375Assert.Equal("localhost", nameValueObject["Host"]?.GetValue<string>()); 1376Assert.Equal("catalogdb", nameValueObject["DatabaseName"]?.GetValue<string>()); 1412Assert.Equal("true", Assert.IsAssignableFrom<JsonValue>(snapshot.Properties["terminal.enabled"]).GetValue<string>()); 1413Assert.Equal("0", Assert.IsAssignableFrom<JsonValue>(snapshot.Properties["terminal.replicaIndex"]).GetValue<string>()); 1414Assert.Equal("1", Assert.IsAssignableFrom<JsonValue>(snapshot.Properties["terminal.replicaCount"]).GetValue<string>());
DistributedApplicationBuilderTests.cs (9)
670Assert.Equal(42, section.Data["Count"]!.GetValue<int>()); 671Assert.True(section.Data["Enabled"]!.GetValue<bool>()); 672Assert.Equal(1.25, section.Data["Ratio"]!.GetValue<double>()); 675Assert.Equal("value", section.Data["Text"]!.GetValue<string>()); 716Assert.Equal(42, section.Data["Count"]!.GetValue<int>()); 717Assert.True(section.Data["Enabled"]!.GetValue<bool>()); 718Assert.Equal(1.25, section.Data["Ratio"]!.GetValue<double>()); 721Assert.Equal("value", section.Data["Text"]!.GetValue<string>()); 726Assert.Equal(42, System.Text.Json.Nodes.JsonNode.Parse(await File.ReadAllTextAsync(aspirePath))!["Resource:Count"]!.GetValue<int>());
DotnetProgramPublishingTests.cs (3)
165Assert.Equal("project.v0", manifest["type"]?.GetValue<string>()); 166Assert.Equal("program.csproj", manifest["path"]?.GetValue<string>()); 169manifest["args"]?.AsArray().Select(static value => value!.GetValue<string>()));
Orchestrator\ParameterProcessorTests.cs (12)
1447Assert.Equal("firstValue", savedValueNode?.GetValue<string>()); 1453Assert.Equal("secondValue", savedValueNode?.GetValue<string>()); 1480Assert.Equal("newValue", savedValueNode?.GetValue<string>()); 1636Assert.Equal("saved-value", stateManager.State[parameter.ConfigurationKey]?.GetValue<string>()); 1665Assert.Equal("form-value", stateManager.State[secondParameter.ConfigurationKey]?.GetValue<string>()); 1862Assert.Equal("Server=localhost;Database=mydb", valueNode?.GetValue<string>()); 1903Assert.Equal("myvalue", valueNode?.GetValue<string>()); 1947Assert.Equal("customvalue", valueNode?.GetValue<string>()); 1986Assert.Equal("savedValue", savedValueNode?.GetValue<string>()); 2004Assert.Equal("savedValue", savedValueNode?.GetValue<string>()); 2072Assert.Equal("programmaticValue", savedValueNode?.GetValue<string>()); 2226Assert.Equal("old-value", stateManager.State[configurationKey]?.GetValue<string>());
Publishing\DeploymentStateManagerTests.cs (67)
48Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 117Assert.Equal("value1", parametersCheck.Data["param1"]?.GetValue<string>()); 118Assert.Equal("azure-value1", azureCheck.Data["resource1"]?.GetValue<string>()); 146Assert.Equal($"value{i}", section.Data[$"key{i}"]?.GetValue<string>()); 165Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 186Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 199Assert.Equal("value1", section3.Data["key1"]?.GetValue<string>()); 200Assert.Equal("value2", section3.Data["key2"]?.GetValue<string>()); 238Assert.Equal("value1", parametersSection.Data["param1"]?.GetValue<string>()); 239Assert.Equal("azure-value1", azureSection.Data["resource1"]?.GetValue<string>()); 240Assert.Equal("value1", restartedParametersSection.Data["param1"]?.GetValue<string>()); 257Assert.Equal("value1", retrievedSection.Data["key1"]?.GetValue<string>()); 274Assert.Equal("nestedValue", verifySection.Data["nestedKey"]?.GetValue<string>()); 294Assert.Equal("value1", verify1.Data["key1"]?.GetValue<string>()); 295Assert.Equal("value2", verify2.Data["key2"]?.GetValue<string>()); 311Assert.Equal("value1", verify.Data[""]?.GetValue<string>()); 371Assert.Equal("topValue", verifyTop.Data["topKey"]?.GetValue<string>()); 372Assert.Equal("nestedValue", verifyNested.Data["nestedKey"]?.GetValue<string>()); 478Assert.True(migratedSection.Data["legacy"]?.GetValue<bool>()); 490Assert.True(currentSection.Data["legacy"]?.GetValue<bool>()); 491Assert.True(currentSection.Data["current"]?.GetValue<bool>()); 533Assert.Equal("legacy", legacyAfterRestart.Data["Value"]?.GetValue<string>()); 534Assert.Equal("current", replacementAfterRestart.Data["Value"]?.GetValue<string>()); 556Assert.Equal("committed", restartedSection.Data["Value"]?.GetValue<string>()); 594Assert.Equal("legacy", parameterSection.Data[""]?.GetValue<string>()); 621Assert.Equal("existing", section.Data[""]?.GetValue<string>()); 627Assert.Equal("existing", restartedSection.Data[""]?.GetValue<string>()); 658Assert.Equal("updated", restartedSection.Data[""]?.GetValue<string>()); 690Assert.Equal("updated", restartedSection.Data["Leaf"]?.GetValue<string>()); 720Assert.True(features["A"]?.GetValue<bool>()); 721Assert.True(features["B"]?.GetValue<bool>()); 754Assert.Equal("first-sandbox", migratedFirstSection.Data["SandboxId"]?.GetValue<string>()); 755Assert.True(migratedFirstSection.Data["Migrated"]?.GetValue<bool>()); 767Assert.True(restartedFirstSection.Data["Migrated"]?.GetValue<bool>()); 768Assert.Equal("second-sandbox", restartedSecondSection.Data["SandboxId"]?.GetValue<string>()); 773Assert.Equal("second-sandbox", secondSection.Data["SandboxId"]?.GetValue<string>()); 783Assert.Equal("first-sandbox", clearedFirstLegacySection.Data["SandboxId"]?.GetValue<string>()); 784Assert.Equal("second-sandbox", preservedSecondLegacySection.Data["SandboxId"]?.GetValue<string>()); 808Assert.Equal("current-subscription", currentAzureSection.Data["SubscriptionId"]?.GetValue<string>()); 813Assert.Equal("current-subscription", restartedAzureSection.Data["SubscriptionId"]?.GetValue<string>()); 814Assert.Equal("first-sandbox", restartedAzureSection.Data["Sandboxes"]?["first"]?["SandboxId"]?.GetValue<string>()); 815Assert.Equal("second-sandbox", restartedAzureSection.Data["Sandboxes"]?["second"]?["SandboxId"]?.GetValue<string>()); 851restartedAzureSection.Data["Sandboxes"]?["new"]?["SandboxId"]?.GetValue<string>()); 896restartedSandboxesSection.Data["first"]?["new"]?["SandboxId"]?.GetValue<string>()); 899restartedSandboxesSection.Data["second"]?["SandboxId"]?.GetValue<string>()); 935Assert.Equal("first-sandbox", restartedFirstSection.Data["SandboxId"]?.GetValue<string>()); 936Assert.True(restartedFirstSection.Data["Updated"]?.GetValue<bool>()); 937Assert.Equal("second-sandbox", restartedSecondSection.Data["SandboxId"]?.GetValue<string>()); 938Assert.True(restartedSecondSection.Data["Updated"]?.GetValue<bool>()); 968Assert.Equal("current-subscription", restartedAzureSection.Data["SubscriptionId"]?.GetValue<string>()); 969Assert.Equal("current-location", restartedAzureSection.Data["Location"]?.GetValue<string>()); 972Assert.Equal("current-subscription", currentAzureSection.Data["SubscriptionId"]?.GetValue<string>()); 973Assert.Equal("current-location", currentAzureSection.Data["Location"]?.GetValue<string>()); 1003Assert.Equal("sub", preservedLegacySection.Data["SubscriptionId"]?.GetValue<string>()); 1033Assert.Equal("current-sub", asyncEffectiveState["Azure"]?["SubscriptionId"]?.GetValue<string>()); 1034Assert.Equal("current-sub", syncEffectiveState["Azure"]?["SubscriptionId"]?.GetValue<string>()); 1035Assert.Equal("current-sub", migratedSection.Data["SubscriptionId"]?.GetValue<string>()); 1057Assert.Equal("current-sub", asyncEffectiveState["Azure"]?["SubscriptionId"]?.GetValue<string>()); 1058Assert.Equal("current-sub", syncEffectiveState["Azure"]?["SubscriptionId"]?.GetValue<string>()); 1059Assert.Equal("current-sub", restartedSection.Data["SubscriptionId"]?.GetValue<string>()); 1065Assert.Equal("current-sub", savedSection.Data["SubscriptionId"]?.GetValue<string>()); 1066Assert.Equal("westus", savedSection.Data["Location"]?.GetValue<string>()); 1084Assert.Equal("sub", currentSection.Data["SubscriptionId"]?.GetValue<string>()); 1135.Data["SandboxId"]?.GetValue<string>()); 1139.Data["SubscriptionId"]?.GetValue<string>()); 1176.Data["SandboxId"]?.GetValue<string>()); 1180.Data["SandboxId"]?.GetValue<string>());
ConfigurationSchemaGenerator (1)
ConfigSchemaEmitter.cs (1)
450if (propertyNodeType?.GetValueKind() == JsonValueKind.String && propertyNodeType.GetValue<string>() == "boolean")
dotnet-user-jwts (1)
Helpers\SigningKeysHandler.cs (1)
85var toRemove = signingKeys.SingleOrDefault(key => key["Issuer"].GetValue<string>() == issuer);
GenerateTemplateManifest (4)
TemplateRestorePlan.cs (4)
105symbol?["replaces"]?.GetValue<string>() is { Length: > 0 } replacement && 116foreach (var (name, symbol) in symbols.Where(s => included.Contains(s.Key) && s.Value?["type"]?.GetValue<string>() == "parameter")) 118string[] values = symbol!["datatype"]?.GetValue<string>() switch 121"choice" => symbol["choices"]!.AsArray().Select(c => c!["choice"]!.GetValue<string>()).ToArray(),
Infrastructure.Tests (188)
Pipelines\NixCliPackageTests.cs (1)
204return Assert.IsAssignableFrom<JsonValue>(value).GetValue<string>();
Pipelines\NpmCliPackageTests.cs (3)
362return jsonObject[propertyName]?.GetValue<string>() 368return jsonNode?.AsArray().Select(value => value?.GetValue<string>() ?? throw new InvalidOperationException("JSON array contains a null value.")).ToArray() 376property => property.Value?.GetValue<string>() ?? throw new InvalidOperationException($"JSON property '{property.Key}' is not a string."),
WorkflowScripts\AutoSecWorkflowTests.cs (184)
47Assert.Equal(0, result["exitCode"]!.GetValue<int>()); 48Assert.Equal("", result["stdout"]!.GetValue<string>()); 49Assert.Equal("", result["stderr"]!.GetValue<string>()); 50Assert.Equal(empty ? 0 : 1, result["counts"]!["alerts"]!.GetValue<int>()); 58Assert.True(alert["malware"]!.GetValue<bool>()); 59Assert.Equal(["< 1.2.3"], alert["vulnerable_ranges"]!.AsArray().Select(item => item!.GetValue<string>())); 75Assert.Equal(exitCode, result["exitCode"]!.GetValue<int>()); 76Assert.Equal("", result["stdout"]!.GetValue<string>()); 78result["stderr"]!.GetValue<string>().ReplaceLineEndings("\n")); 108Assert.True(result["failed"]!.GetValue<bool>()); 110Assert.Equal(endpoint, result["calls"]!.AsArray().Last()!.GetValue<string>()); 143Assert.False(result["failed"]!.GetValue<bool>()); 145Assert.Equal(["README.md", "extension/yarn.lock"], pr["files"]!.AsArray().Select(n => n!.GetValue<string>())); 146Assert.Equal(status == "removed" ? [] : [7], pr["covered_alerts"]!.AsArray().Select(n => n!.GetValue<int>())); 156Assert.Equal(calls, result["calls"]!.AsArray().Select(n => n!.GetValue<string>())); 180Assert.True(result["failed"]!.GetValue<bool>()); 191Assert.Equal("approve", decision!["decision"]!.GetValue<string>()); 193Assert.Equal([7], decision["fixedAlerts"]!.AsArray().Select(n => n!.GetValue<int>())); 195Assert.Equal("APPROVE", review!["event"]!.GetValue<string>()); 196Assert.Equal(101, review["pull_number"]!.GetValue<int>()); 197Assert.Equal(HeadSha, review["commit_id"]!.GetValue<string>()); 209Assert.Equal("approve", result["value"]![0]!["decision"]!.GetValue<string>()); 211Assert.Contains("(staged)", result["summary"]!.GetValue<string>(), StringComparison.Ordinal); 241Assert.Equal(["gate-evaluation-failed"], result["value"]![0]!["reasons"]!.AsArray().Select(item => item!.GetValue<string>())); 242Assert.Equal(["Auto-sec approval failed: gate-evaluation-failed."], result["failures"]!.AsArray().Select(item => item!.GetValue<string>())); 268Assert.Equal(breaking ? "skip" : "approve", result["value"]![0]!["decision"]!.GetValue<string>()); 269Assert.Equal(breaking ? ["breaking-change"] : [], result["value"]![0]!["reasons"]!.AsArray().Select(item => item!.GetValue<string>())); 272result["contentCalls"]!.AsArray().Select(item => item!.GetValue<string>())); 288Assert.Equal("approve", result["value"]![0]!["decision"]!.GetValue<string>()); 291result["contentCalls"]!.AsArray().Select(item => item!.GetValue<string>())); 318Assert.Equal(["gate-evaluation-failed"], result["value"]![0]!["reasons"]!.AsArray().Select(item => item!.GetValue<string>())); 342Assert.Equal([$"Auto-sec approval failed: {reason}."], result["failures"]!.AsArray().Select(n => n!.GetValue<string>())); 347Assert.Equal(phase == "summary" ? "auto-sec Dependabot approvals\nRequests: 1. Approved: 1. Skipped: 0.\n\n- #101: approve" : "", result["summary"]!.GetValue<string>()); 352Assert.Equal("skip", decision!["decision"]!.GetValue<string>()); 353Assert.Equal([reason], decision["reasons"]!.AsArray().Select(n => n!.GetValue<string>())); 355Assert.Equal($"auto-sec Dependabot approvals\nRequests: 1. Approved: 0. Skipped: 1.\n\n- #101: skip ({reason})", result["summary"]!.GetValue<string>()); 359result["info"]!.AsArray().Select(n => n!.GetValue<string>())); 413Assert.Equal(allowed ? "approve" : "skip", decision!["decision"]!.GetValue<string>()); 415decision["reasons"]!.AsArray().Select(n => n!.GetValue<string>())); 419Assert.All(comparisons, comparison => Assert.Equal($"{new string('b', 40)}...{HeadSha}", comparison!["basehead"]!.GetValue<string>())); 437Assert.Equal("approve", Assert.Single(unchanged["value"]!.AsArray())!["decision"]!.GetValue<string>()); 444Assert.Equal("skip", decision!["decision"]!.GetValue<string>()); 445Assert.Contains("non-version-manifest-edit", decision["reasons"]!.AsArray().Select(n => n!.GetValue<string>())); 708Assert.Equal("skip", decision!["decision"]!.GetValue<string>()); 711Assert.Equal(expectedReason, decision["reasons"]![0]!.GetValue<string>()); 759Assert.Equal(expected, result["value"]!.GetValue<bool>()); 780Assert.Equal(expected, result["value"]!.GetValue<bool>()); 837Assert.Equal(expected, result["value"]!.GetValue<bool>()); 1161Assert.Equal(expected, result["value"]!.GetValue<bool>()); 1307var failure = Assert.Single(result["failures"]!.AsArray())!.GetValue<string>(); 1342Assert.Equal(expected, result["value"]!.GetValue<bool>()); 1362Assert.Equal(3, result["value"]!["alerts"]!.GetValue<int>()); 1363Assert.Equal(5, result["value"]!["codeFindings"]!.GetValue<int>()); 1394Assert.Equal(accepted ? "true" : null, result["stepOutputs"]!["publication_ready"]?.GetValue<string>()); 1396Assert.Equal(accepted ? [output] : [], result["outputs"]!.AsArray().Select(item => item!.GetValue<string>())); 1397Assert.Equal(accepted ? ["aw-auto-sec-security-updates.patch"] : [], result["remaining"]!.AsArray().Select(item => item!.GetValue<string>())); 1436Assert.Single(result["failures"]!.AsArray())!.GetValue<string>()); 1456Assert.Single(result["failures"]!.AsArray())!.GetValue<string>()); 1507Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 1559Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 1623Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 1672var text = JsonNode.Parse(files[path]!.GetValue<string>())!.ToJsonString(new JsonSerializerOptions { WriteIndented = true }).ReplaceLineEndings("\n") + "\n"; 1678var head = JsonNode.Parse(heads["extension/package-lock.json"]!.GetValue<string>())!; 1700Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 1739Assert.Equal(["aw-auto-sec-security-updates.patch"], result["remaining"]!.AsArray().Select(v => v!.GetValue<string>())); 1740Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 1758Assert.Equal([output], result["outputs"]!.AsArray().Select(v => JsonNode.Parse(v!.GetValue<string>())!.ToJsonString())); 1759Assert.Equal(["aw-auto-sec-security-updates.patch"], result["remaining"]!.AsArray().Select(v => v!.GetValue<string>())); 1792Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 1794Assert.Equal(["aw-auto-sec-security-updates.patch"], result["remaining"]!.AsArray().Select(name => name!.GetValue<string>())); 1795var outputs = result["outputs"]!.AsArray().Select(line => JsonNode.Parse(line!.GetValue<string>())!).ToArray(); 1798item => Assert.Equal("create_pull_request", item["type"]!.GetValue<string>()), 1800item => Assert.Equal("noop", item["type"]!.GetValue<string>())); 1858Assert.Equal([$"auto-sec agent output scrub failed: {string.Join("; ", expected)}"], result["failures"]!.AsArray().Select(v => v!.GetValue<string>())); 1949output["body"] = output["body"]!.GetValue<string>().Replace("extension/package-lock.json", path, StringComparison.Ordinal); 1969Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 1977result["failures"]!.AsArray().Select(n => n!.GetValue<string>())); 2016output["body"] = output["body"]!.GetValue<string>().Replace("extension/package-lock.json", path, StringComparison.Ordinal); 2034Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2130Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2217Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2321Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2375Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2444Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2495Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2571output["body"] = output["body"]!.GetValue<string>().Replace( 2600Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2653Assert.Equal([$"auto-sec agent output scrub failed: {string.Join("; ", expected)}"], result["failures"]!.AsArray().Select(v => v!.GetValue<string>())); 2671Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2691Assert.Equal(["auto-sec agent output scrub failed: patch-artifacts unsupported-artifact"], result["failures"]!.AsArray().Select(v => v!.GetValue<string>())); 2741Assert.Equal(["auto-sec agent output scrub failed: patch-transport untrusted-base-commit"], result["failures"]!.AsArray().Select(v => v!.GetValue<string>())); 2751Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2770Assert.Equal(["auto-sec agent output scrub failed: aw-auto-sec-security-updates.patch invalid-base-commit"], result["failures"]!.AsArray().Select(v => v!.GetValue<string>())); 2813Assert.Equal(expected, result["value"]!.GetValue<bool>()); 2853Assert.Equal(expected, result["value"]!.GetValue<bool>()); 2933Assert.Equal(missing ? ["auto-sec agent output scrub failed: filesystem io-error"] : [], result["failures"]!.AsArray().Select(v => v!.GetValue<string>())); 2934Assert.Equal(missing ? null : "true", result["stepOutputs"]!["publication_ready"]?.GetValue<string>()); 2967Assert.Equal([repoScoped ? "aw-microsoft-aspire-auto-sec-security-updates.patch" : "aw-auto-sec-security-updates.patch"], result["remaining"]!.AsArray().Select(v => v!.GetValue<string>())); 2968Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 2992Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 3071var output = JsonNode.Parse(Assert.Single(result["outputs"]!.AsArray())!.GetValue<string>()); 3073Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 3101var output = JsonNode.Parse(Assert.Single(result["outputs"]!.AsArray())!.GetValue<string>()); 3103Assert.Equal("true", result["stepOutputs"]!["publication_ready"]!.GetValue<string>()); 3139Assert.Equal([$"auto-sec agent output scrub failed: {type} invalid-inputs"], result["failures"]!.AsArray().Select(v => v!.GetValue<string>())); 3215var failure = Assert.Single(result["failures"]!.AsArray())!.GetValue<string>(); 3251Assert.Equal(["auto-sec agent output scrub failed: filesystem io-error"], result["failures"]!.AsArray().Select(v => v!.GetValue<string>())); 3287var guarded = result["value"]!.GetValue<string>(); 3288Assert.Equal(guarded, result["repeated"]!.GetValue<string>()); 3321Assert.Equal("private-alert-123\n", unguarded["stdout"]!.GetValue<string>().ReplaceLineEndings("\n")); 3322Assert.Contains("private-range-malware", unguarded["stderr"]!.GetValue<string>()); 3323Assert.Equal(exitCode, unguarded["exitCode"]!.GetValue<int>()); 3329var guarded = result["value"]!.GetValue<string>(); 3338Assert.Equal("", quiet["stdout"]!.GetValue<string>()); 3339Assert.Equal("", quiet["stderr"]!.GetValue<string>()); 3340Assert.Equal(exitCode, quiet["exitCode"]!.GetValue<int>()); 3341Assert.Equal(guarded, result["repeated"]!.GetValue<string>()); 3349var steps = AgentSteps(result["value"]!.GetValue<string>()); 3370Assert.Equal("private-gateway\n", original["stdout"]!.GetValue<string>().ReplaceLineEndings("\n")); 3371Assert.Equal("private-gateway-error\n", original["stderr"]!.GetValue<string>().ReplaceLineEndings("\n")); 3372Assert.Equal(exitCode, original["exitCode"]!.GetValue<int>()); 3377var gateway = Assert.Single(AgentSteps(result["value"]!.GetValue<string>()), 3385Assert.Equal("::add-mask::fixture-gateway-id\n", quiet["stdout"]!.GetValue<string>().ReplaceLineEndings("\n")); 3386Assert.Equal("", quiet["stderr"]!.GetValue<string>()); 3387Assert.Equal(exitCode, quiet["exitCode"]!.GetValue<int>()); 3388Assert.Equal(result["value"]!.GetValue<string>(), result["repeated"]!.GetValue<string>()); 3405var guarded = result["value"]!.GetValue<string>(); 3406Assert.Equal(guarded, result["repeated"]!.GetValue<string>()); 3432var guarded = result["value"]!.GetValue<string>(); 3433Assert.Equal(guarded, result["repeated"]!.GetValue<string>()); 3448var guarded = result["value"]!.GetValue<string>(); 3449Assert.Equal(guarded, result["repeated"]!.GetValue<string>()); 3475var guarded = result["value"]!.GetValue<string>(); 3476Assert.Equal(guarded, result["repeated"]!.GetValue<string>()); 3537Assert.Equal("auto-sec publication guard: expected one guarded step condition", result["error"]!.GetValue<string>()); 3541Assert.StartsWith("auto-sec publication guard:", result["error"]!.GetValue<string>()); 3732Assert.Equal(expected, string.Join(",", result["value"]!.AsArray().Select(source => source!.GetValue<string>()))); 3755Assert.Equal(expected, string.Join(",", result["value"]!.AsArray().Select(source => source!.GetValue<string>()))); 3799Assert.Equal(expected, result["value"]!.GetValue<int>()); 3836Assert.Equal(expected, string.Join(",", result["value"]!.AsArray().Select(source => source!.GetValue<string>()))); 3895Assert.Equal("approve", decision!["decision"]!.GetValue<string>()); 3918Assert.Equal("approve", decision!["decision"]!.GetValue<string>()); 3919Assert.Equal([7, 8], decision["fixedAlerts"]!.AsArray().Select(n => n!.GetValue<int>())); 3943Assert.Equal("approve", decision!["decision"]!.GetValue<string>()); 3944Assert.Equal([7, 8], decision["fixedAlerts"]!.AsArray().Select(n => n!.GetValue<int>())); 3957Assert.Equal("skip", decision!["decision"]!.GetValue<string>()); 3958Assert.Equal("malware-requires-review", decision["reasons"]![0]!.GetValue<string>()); 3959var info = Assert.Single(result["info"]!.AsArray())!.GetValue<string>(); 3961Assert.EndsWith("- #101: skip (human-review-required, fixes-no-open-alert)", result["summary"]!.GetValue<string>(), StringComparison.Ordinal); 3988Assert.Equal("approve", decision!["decision"]!.GetValue<string>()); 3989Assert.Equal([7, 8], decision["fixedAlerts"]!.AsArray().Select(n => n!.GetValue<int>())); 4014result["value"]!.AsArray().Select(decision => decision!["decision"]!.GetValue<string>() == "approve" 4016: decision["reasons"]![0]!.GetValue<string>())); 4017Assert.Equal(Enumerable.Range(4, 10), result["reviews"]!.AsArray().Select(review => review!["pull_number"]!.GetValue<int>())); 4035Assert.Equal(Enumerable.Range(1, 10), result["reviews"]!.AsArray().Select(review => review!["pull_number"]!.GetValue<int>())); 4037result["failures"]!.AsArray().Select(n => n!.GetValue<string>())); 4038Assert.All(result["value"]!.AsArray(), decision => Assert.Equal("skip", decision!["decision"]!.GetValue<string>())); 4040result["value"]!.AsArray().Select(decision => Assert.Single(decision!["reasons"]!.AsArray())!.GetValue<string>())); 4041Assert.StartsWith("auto-sec Dependabot approvals\nRequests: 12. Approved: 0. Skipped: 12.", result["summary"]!.GetValue<string>(), StringComparison.Ordinal); 4136Assert.Equal(expected, result["value"]!.GetValue<bool>()); 4184Assert.Equal([1, 4, 9, 10], result["value"]!.AsArray().Select(n => n!.GetValue<int>())); 4209Assert.Equal(expected ? new[] { 1 } : Array.Empty<int>(), result["value"]!.AsArray().Select(n => n!.GetValue<int>())); 4271Assert.True(prefixMapped["value"]!["available_on_approved_feed"]!.GetValue<bool>()); 4278prefixMapped["urls"]!.AsArray().Select(url => url!.GetValue<string>())); 4279Assert.False(exactMapped["value"]!["available_on_approved_feed"]!.GetValue<bool>()); 4282exactMapped["urls"]!.AsArray().Select(url => url!.GetValue<string>())); 4318Assert.Equal(expectedCooldown, result["value"]!["cooldown_satisfied"]!.GetValue<bool>()); 4352Assert.False(nuget["value"]!["available_on_approved_feed"]!.GetValue<bool>()); 4353Assert.True(nuget["value"]!["cooldown_satisfied"]!.GetValue<bool>()); 4354Assert.True(npm["value"]!["available_on_approved_feed"]!.GetValue<bool>()); 4355Assert.False(npm["value"]!["cooldown_satisfied"]!.GetValue<bool>()); 4380Assert.Equal("2026-09-29T00:00:00Z", pip["value"]!["published_at"]!.GetValue<string>()); 4381Assert.False(pip["value"]!["cooldown_satisfied"]!.GetValue<bool>()); 4391Assert.Equal(1, result["value"]!["requests"]!.GetValue<int>()); 4400Assert.Equal(0, noPush["value"]!["requests"]!.GetValue<int>()); 4478Assert.Equal(["open"], result["calls"]!.AsArray().Select(item => item!.GetValue<string>())); 4482Assert.Equal("auto-sec create target gate failed: gate-evaluation-failed", Assert.Single(result["failures"]!.AsArray())!.GetValue<string>()); 4527Assert.Contains(reason == "missing-author" ? "wrong-author" : reason, failure!.GetValue<string>(), StringComparison.Ordinal); 4543result["value"]!["violations"]!.AsArray().Select(violation => violation!["reason"]!.GetValue<string>())); 4731Assert.Equal(0, result["exitCode"]!.GetValue<int>()); 4732Assert.Equal(existing ? "preserved" : OperatingSystem.IsWindows() ? "created\nappend" : "created 600\nappend", result["stdout"]!.GetValue<string>().ReplaceLineEndings("\n")); 4733Assert.Equal("", result["stderr"]!.GetValue<string>()); 4783if (request["mode"]?.GetValue<string>() is "agent-scrub" or "public-text-gate")
Microsoft.AspNetCore.OpenApi (7)
Extensions\JsonNodeSchemaExtensions.cs (6)
383var defaultValue = defaultNode.GetValue<string>(); 388if (serialized?.GetValue<string>() == defaultValue) 510!string.IsNullOrEmpty(schemaIdNode.GetValue<string>())); 597if (typeArray[i]?.GetValue<string>() == "null") 604schema[OpenApiSchemaKeywords.TypeKeyword] = typeArray[0]?.GetValue<string>(); 618if (Enum.TryParse<JsonSchemaType>(jsonNode?.GetValue<string>(), true, out var openApiSchemaType))
Services\Schemas\OpenApiSchemaService.cs (1)
282if (rawEnum[i]?.GetValue<string>() != memberNames[i])
Microsoft.Extensions.AI.Abstractions (8)
Utilities\AIJsonUtilities.Schema.Create.cs (7)
295string refUri = paramName!.GetValue<string>(); 346string typeValue = typeKeyWord.GetValue<string>()!; 367string typeValue = typeKeyWord.GetValue<string>()!; 582if (entry?.GetValue<string>() == propertyName) 724schemaType = typeNode.GetValue<string>(); 736string entryValue = entry.GetValue<string>(); 789entry.GetValue<string>() is string type)
Utilities\AIJsonUtilities.Schema.Transform.cs (1)
180string? description = schemaObj.TryGetPropertyValue(DescriptionPropertyName, out JsonNode? descriptionSchema) ? descriptionSchema?.GetValue<string>() : null;
Microsoft.Extensions.AI.Abstractions.Tests (1)
Contents\FunctionCallContentTests.cs (1)
111Assert.Equal(informationalOnly, informationalOnlyValue!.GetValue<bool>());
Microsoft.Extensions.AI.OpenAI (1)
OpenAIClientExtensions.cs (1)
92$"{descriptionNode.GetValue<string>()}{Environment.NewLine}{additionalDescription}" :
Microsoft.ML.AutoML (9)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (2)
18var schema = jValue["schema"].GetValue<string>(); 19var estimators = jValue["estimator"].GetValue<Dictionary<string, SweepableEstimator>>();
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
19var estimatorType = jsonObject["estimatorType"].GetValue<EstimatorType>(); 20var parameter = jsonObject["parameter"].GetValue<Parameter>();
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (2)
18var parameter = jNode["parameter"].GetValue<Parameter>(); 19var estimators = jNode["estimators"].GetValue<SweepableEstimator[]>();
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
18var currentSchema = jValue["currentSchema"].GetValue<string>(); 19var schema = jValue["schema"].GetValue<string>(); 20var estimators = jValue["estimator"].GetValue<Dictionary<string, SweepableEstimator>>();
Microsoft.ML.AutoML.SourceGenerator (20)
SearchSpaceGenerator.cs (20)
39var className = Utils.ToTitleCase(jNode["name"].GetValue<string>()); 43var optionName = Utils.ToTitleCase(t["name"].GetValue<string>()); 44string optionTypeName = t["type"].GetValue<string>() switch 69(_, "string") => $"\"{defaultToken.GetValue<string>()}\"", 70(_, "int") => $"{defaultToken.GetValue<int>().ToString(CultureInfo.InvariantCulture)}", 71(_, "double") => $"{defaultToken.GetValue<double>().ToString(CultureInfo.InvariantCulture)}", 72(_, "float") => $"{defaultToken.GetValue<float>().ToString(CultureInfo.InvariantCulture)}F", 73(_, "bool") => defaultToken.GetValue<bool>() ? "true" : "false", 74(_, "Anchor") => defaultToken.GetValue<string>(), 75(_, "ResizingKind") => defaultToken.GetValue<string>(), 76(_, "ColorBits") => defaultToken.GetValue<string>(), 77(_, "ColorsOrder") => defaultToken.GetValue<string>(), 78(_, "BertArchitecture") => defaultToken.GetValue<string>(), 79(_, "Microsoft.ML.Vision.ImageClassificationTrainer.Architecture") => defaultToken.GetValue<string>(), 80(_, "Microsoft.ML.Data.DataKind") => defaultToken.GetValue<string>(), 81(_, "Microsoft.ML.IDataView") => defaultToken.GetValue<string>(), 82(_, "Microsoft.ML.Transforms.Text.TextNormalizingEstimator.CaseMode") => defaultToken.GetValue<string>(), 97var minValue = searchSpaceNode["min"].GetValue<double>(); 98var maxValue = searchSpaceNode["max"].GetValue<double>(); 99var logBase = searchSpaceObject.ContainsKey("log_base") is false ? "false" : searchSpaceNode["log_base"].GetValue<bool>() ? "true" : "false";
Microsoft.NET.Build.Containers (5)
ImageConfig.cs (5)
70internal string[]? GetEntrypoint() => _config["config"]?["Entrypoint"]?.AsArray()?.Select(node => node!.GetValue<string>())?.ToArray(); 71private string[]? GetCmd() => _config["config"]?["Entrypoint"]?.AsArray()?.Select(node => node!.GetValue<string>())?.ToArray(); 289string[] val = entry.GetValue<string>().Split('=', 2); 337if (rootfs["type"]?.GetValue<string>() == "layers" && rootfs["diff_ids"] is JsonArray layers) 339return layers.Select(l => l!.GetValue<string>()).ToList();
Microsoft.TemplateEngine.Cli (13)
Alias\AliasRegistry.cs (2)
203result[property.Key] = new List<string>() { property.Value.GetValue<string>() }; 212values.Add(item.GetValue<string>());
HostSpecificTemplateData.cs (3)
33.Select(v => v!.GetValue<string>())); 59JsonValueKind.String => symbolProperty.Value.GetValue<string>(), 80else if (kind == JsonValueKind.String && bool.TryParse(isHiddenNode.GetValue<string>(), out bool hidden))
JExtensions.cs (5)
30return val.GetValue<string>(); 47return element.GetValue<string>(); 91return bool.TryParse(token.GetValue<string>(), out result); 210values.Add(item.GetValue<string>()); 262return int.TryParse(token.GetValue<string>(), out result);
PostActionProcessors\ChmodPostActionProcessor.cs (1)
30values[i] = valueArray[i]?.GetValue<string>() ?? "";
PostActionProcessors\PostActionProcessorBase.cs (2)
134paths = config.GetValue<string>().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); 145.Select(token => token!.GetValue<string>()).ToList();
Microsoft.TemplateEngine.Edge (19)
BuiltInManagedProvider\GlobalSettings.cs (1)
91package![nameof(TemplatePackageData.LastChangeTime)]?.GetValue<DateTime>() ?? default,
Constraints\ConstraintsExtensions.cs (2)
24return new[] { token.GetValue<string>() ?? throw new ConfigurationException(string.Format(LocalizableStrings.Constraint_Error_ArgumentHasEmptyString, args)) }; 36string? strValue = value.GetValue<string>();
parent\Shared\JExtensions.cs (8)
38return val.GetValue<string>(); 57return strVal.GetValue<string>(); 104return bool.TryParse(token.GetValue<string>(), out result); 139return int.TryParse(token.GetValue<string>(), out result); 305result[property.Key] = property.Value.GetValue<string>(); 382values.Add(item.GetValue<string>()); 407if (Guid.TryParse(item.GetValue<string>(), out Guid val)) 478string tokenValue = token.GetValue<string>();
Settings\SettingsStore.cs (3)
29ComponentGuidToAssemblyQualifiedName[entry.Key] = entry.Value.GetValue<string>(); 43ProbingPaths.Add(path.GetValue<string>()); 64if (Guid.TryParse(value.GetValue<string>(), out Guid id))
Settings\TemplateCache.cs (2)
92? localeToken!.GetValue<string>() 103mountPointInfo.Add(entry.Key, entry.Value.GetValue<DateTime>());
Settings\TemplateInfoReader.cs (3)
39classifications.Add(item.GetValue<string>()); 100tags.Add(item.Key, item.Value?.GetValue<string>() ?? string.Empty); 112if (item != null && Guid.TryParse(item.GetValue<string>(), out Guid id))
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (10)
LocalizationModelDeserializer.cs (1)
32.Select(p => p.Value?.GetValueKind() == JsonValueKind.String ? (p.Key, p.Value.GetValue<string>()) : throw new Exception(LocalizableStrings.Authoring_InvalidJsonElementInLocalizationFile))
Macros\BaseMacroConfig.cs (1)
127return val.GetValueKind() == JsonValueKind.String ? val.GetValue<string>() : val.ToJsonString();
parent\Shared\JExtensions.cs (8)
38return val.GetValue<string>(); 57return strVal.GetValue<string>(); 104return bool.TryParse(token.GetValue<string>(), out result); 139return int.TryParse(token.GetValue<string>(), out result); 305result[property.Key] = property.Value.GetValue<string>(); 382values.Add(item.GetValue<string>()); 407if (Guid.TryParse(item.GetValue<string>(), out Guid val)) 478string tokenValue = token.GetValue<string>();
Microsoft.TemplateEngine.Utils (8)
parent\Shared\JExtensions.cs (8)
38return val.GetValue<string>(); 57return strVal.GetValue<string>(); 104return bool.TryParse(token.GetValue<string>(), out result); 139return int.TryParse(token.GetValue<string>(), out result); 305result[property.Key] = property.Value.GetValue<string>(); 382values.Add(item.GetValue<string>()); 407if (Guid.TryParse(item.GetValue<string>(), out Guid val)) 478string tokenValue = token.GetValue<string>();
Microsoft.TemplateSearch.Common (8)
parent\Shared\JExtensions.cs (8)
38return val.GetValue<string>(); 57return strVal.GetValue<string>(); 104return bool.TryParse(token.GetValue<string>(), out result); 139return int.TryParse(token.GetValue<string>(), out result); 305result[property.Key] = property.Value.GetValue<string>(); 382values.Add(item.GetValue<string>()); 407if (Guid.TryParse(item.GetValue<string>(), out Guid val)) 478string tokenValue = token.GetValue<string>();
NativeIntegrations.DockerCompose (49)
ComposeModels.cs (14)
84get => Model["image"]?.GetValue<string>(); 97get => Model["build"] is JsonObject build ? new(build["context"]!.GetValue<string>(), build["dockerfile"]!.GetValue<string>()) : null; 109get => Model["container_name"]?.GetValue<string>(); 115get => Model["restart"]?.GetValue<string>(); 128get => Model["pull_policy"]?.GetValue<string>(); 169get => Model["name"]!.GetValue<string>(); 239get => model["description"]?.GetValue<string>(); 244get => model["defaultValue"]?.GetValue<string>(); 247if (value is not null && model["secret"]!.GetValue<bool>()) 345value["test"]!.AsArray().Select(part => part!.GetValue<string>()).ToArray(), 346value["interval"]?.GetValue<string>(), value["timeout"]?.GetValue<string>(), value["retries"]?.GetValue<int>());
DockerComposeEnvironment.cs (12)
121if (string.IsNullOrWhiteSpace(service["image"]?.GetValue<string>()) || 319var matches = rows.Where(row => row["Service"]?.GetValue<string>() == expected.Service).ToArray(); 320if (matches.Length != 1 || matches[0]["State"]?.GetValue<string>() != "running" || 321expected.Healthcheck && matches[0]["Health"]?.GetValue<string>() != "healthy" || 322!expected.Healthcheck && matches[0]["Health"]?.GetValue<string>() is not (null or "" or "healthy")) 331publisher["TargetPort"]?.GetValue<int>() == exposure.Target && publisher["Protocol"]?.GetValue<string>() == exposure.Protocol && 332publisher["URL"]?.GetValue<string>() == exposure.HostIp).ToArray(); 333if (publishers.Length != 1 || publishers[0]["PublishedPort"]?.GetValue<int>() is not (>= 1 and <= 65535) || 334exposure.Published is { } requested && publishers[0]["PublishedPort"]!.GetValue<int>() != requested) 338var published = publishers[0]["PublishedPort"]!.GetValue<int>(); 348["health"] = row["Health"]?.GetValue<string>() == "healthy" ? "healthy" : "not-configured", ["endpoints"] = endpoints
DockerComposeGenerator.cs (23)
33if (context.Model["schemaVersion"]?.GetValue<int>() != 1) 65var metadata = resource["configuration"]?["publish.computeEnvironment"]?.GetValue<string>(); 66var assignment = resource.ContainsKey("computeEnvironment") ? resource["computeEnvironment"]?.GetValue<string>() : metadata; 115var image = configuration["image"]?.GetValue<string>() ?? resource["image"]?.GetValue<string>(); 168if (endpoint["environmentVariable"]?.GetValue<string>() is { Length: > 0 } variable) 172if (serviceEnvironment.TryGetValue(variable, out var existing) && existing!.GetValue<string>() != target) 193if (endpoint["hostPort"]?.GetValue<int>() is > 0 and var hostPort) 205exposure["hostIp"]?.GetValue<string>() ?? "127.0.0.1", exposure["published"]?.GetValue<int>())); 381value ??= secret ? null : plan.Inputs["environment"]?[variable]?["defaultValue"]?.GetValue<string>() ?? 382model["parameterDefaults"]?[name]?.GetValue<string>(); 389value ??= Boolean(entry, "secret") ? null : entry["defaultValue"]?.GetValue<string>(); 425var source = environment["configuration"]?["publish.dockerComposeEnvironment"]?.GetValue<string>(); 447_ = configuredPort.GetValue<int>(); 453["name"] = ComposeJson.Literal(ComposeJson.Text(network.GetValue<string>())), ["external"] = true 467var hostPort = configuration["dashboardHostPort"]?.GetValue<int>(); 514var options = resource["configuration"]?["publish.dockerCompose"] is { } source ? JsonNode.Parse(source.GetValue<string>())!.AsObject() : new JsonObject(); 526_ = options[flag]!.GetValue<bool>(); 570internal static IEnumerable<string> Strings(JsonNode? value) => (value ?? throw new ArgumentException("Expected a JSON array.")).AsArray().Select(node => node!.GetValue<string>()); 571internal static string Text(JsonObject value, string property) => value[property]?.GetValue<string>() ?? throw new ArgumentException($"Missing string '{property}'."); 572internal static bool Boolean(JsonObject value, string property) => value[property]?.GetValue<bool>() ?? false; 573private static int Integer(JsonObject value, string property) => value[property]!.GetValue<int>();
sdk-tasks (1)
UpdateRuntimeConfig.cs (1)
58var name = framework["name"]!.GetValue<string>();
System.Text.Json (36)
System\Text\Json\Nodes\JsonArray.cs (2)
137/// Returns an enumerable that wraps calls to <see cref="JsonNode.GetValue{T}"/>. 145yield return item is null ? (T)(object?)null! : item.GetValue<T>();
System\Text\Json\Nodes\JsonNode.Operators.cs (33)
255public static explicit operator bool(JsonNode value) => value.GetValue<bool>(); 262public static explicit operator bool?(JsonNode? value) => value?.GetValue<bool>(); 269public static explicit operator byte(JsonNode value) => value.GetValue<byte>(); 276public static explicit operator byte?(JsonNode? value) => value?.GetValue<byte>(); 283public static explicit operator char(JsonNode value) => value.GetValue<char>(); 290public static explicit operator char?(JsonNode? value) => value?.GetValue<char>(); 297public static explicit operator DateTime(JsonNode value) => value.GetValue<DateTime>(); 304public static explicit operator DateTime?(JsonNode? value) => value?.GetValue<DateTime>(); 311public static explicit operator DateTimeOffset(JsonNode value) => value.GetValue<DateTimeOffset>(); 318public static explicit operator DateTimeOffset?(JsonNode? value) => value?.GetValue<DateTimeOffset>(); 325public static explicit operator decimal(JsonNode value) => value.GetValue<decimal>(); 332public static explicit operator decimal?(JsonNode? value) => value?.GetValue<decimal>(); 339public static explicit operator double(JsonNode value) => value.GetValue<double>(); 346public static explicit operator double?(JsonNode? value) => value?.GetValue<double>(); 353public static explicit operator Guid(JsonNode value) => value.GetValue<Guid>(); 360public static explicit operator Guid?(JsonNode? value) => value?.GetValue<Guid>(); 367public static explicit operator short(JsonNode value) => value.GetValue<short>(); 374public static explicit operator short?(JsonNode? value) => value?.GetValue<short>(); 381public static explicit operator int(JsonNode value) => value.GetValue<int>(); 388public static explicit operator int?(JsonNode? value) => value?.GetValue<int>(); 395public static explicit operator long(JsonNode value) => value.GetValue<long>(); 402public static explicit operator long?(JsonNode? value) => value?.GetValue<long>(); 410public static explicit operator sbyte(JsonNode value) => value.GetValue<sbyte>(); 418public static explicit operator sbyte?(JsonNode? value) => value?.GetValue<sbyte>(); 425public static explicit operator float(JsonNode value) => value.GetValue<float>(); 432public static explicit operator float?(JsonNode? value) => value?.GetValue<float>(); 439public static explicit operator string?(JsonNode? value) => value?.GetValue<string>(); 447public static explicit operator ushort(JsonNode value) => value.GetValue<ushort>(); 455public static explicit operator ushort?(JsonNode? value) => value?.GetValue<ushort>(); 463public static explicit operator uint(JsonNode value) => value.GetValue<uint>(); 471public static explicit operator uint?(JsonNode? value) => value?.GetValue<uint>(); 479public static explicit operator ulong(JsonNode value) => value.GetValue<ulong>(); 487public static explicit operator ulong?(JsonNode? value) => value?.GetValue<ulong>();
System\Text\Json\Nodes\JsonValue.cs (1)
32/// <seealso cref="JsonNode.GetValue{T}"></seealso>