283 writes to
aspire (34)
Agents\ClaudeCode\ClaudeCodeAgentEnvironmentScanner.cs (4)
280config["mcpServers"] = new JsonObject(); 286servers[AspireServerName] = new JsonObject 321config["mcpServers"] = new JsonObject(); 327servers["playwright"] = new JsonObject
Agents\CopilotCli\CopilotCliAgentEnvironmentScanner.cs (4)
242config["mcpServers"] = new JsonObject(); 248servers[AspireServerName] = new JsonObject 297config["mcpServers"] = new JsonObject(); 303servers["playwright"] = new JsonObject
Agents\DeprecatedMcpCommandScanner.cs (2)
227aspire["args"] = new JsonArray("agent", "mcp"); 241aspire["command"] = new JsonArray("aspire", "agent", "mcp");
Agents\OpenCode\OpenCodeAgentEnvironmentScanner.cs (4)
228config["mcp"] = new JsonObject(); 234mcp[AspireServerName] = new JsonObject 276config["mcp"] = new JsonObject(); 282mcp["playwright"] = new JsonObject
Agents\VsCode\VsCodeAgentEnvironmentScanner.cs (4)
313config["servers"] = new JsonObject(); 319servers[AspireServerName] = new JsonObject 361config["servers"] = new JsonObject(); 367servers["playwright"] = new JsonObject
Configuration\ConfigurationService.cs (2)
199currentObject[part] = new JsonObject(); 207currentObject[finalKey] = value;
Projects\FallbackProjectParser.cs (10)
131packageObj["Identity"] = JsonValue.Create(pkg.Identity); 132packageObj["Version"] = JsonValue.Create(pkg.Version); 135itemsObject["PackageReference"] = packageRefArray; 142projectObj["Identity"] = JsonValue.Create(proj.Identity); 143projectObj["FullPath"] = JsonValue.Create(proj.FullPath); 146itemsObject["ProjectReference"] = projectRefArray; 148rootObject["Items"] = itemsObject; 152propertiesObject["AspireHostingSDKVersion"] = JsonValue.Create(aspireHostingSdkVersion); 153rootObject["Properties"] = propertiesObject; 156rootObject["Fallback"] = JsonValue.Create(true);
src\Shared\ConsoleLogs\SharedAIHelpers.cs (4)
224attributesObj[attr.Key!] = context.AddValue(attrValue, id => $@"Duplicate of attribute ""{id.Key}"" for span {OtlpHelpers.ToShortenedId(id.SpanId)}", (SpanId: spanId, attr.Key)); 286traceData["dashboard_link"] = GetDashboardLinkObject(dashboardBaseUrl, DashboardUrls.TraceDetailUrl(traceId), traceId); 588attributesObject[attr.Key!] = context.AddValue(attrValue, id => $@"Duplicate of attribute ""{id.Key}"" for log entry {id.LogId}", (LogId: logId, attr.Key)); 607log["dashboard_link"] = GetDashboardLinkObject(dashboardBaseUrl, DashboardUrls.StructuredLogsUrl(logEntryId: logId), $"log_id: {logId}");
Aspire.Dashboard (9)
Model\Assistant\AIHelpers.cs (3)
72urlObj["display_name"] = u.DisplayProperties.DisplayName; 119resourceObj["dashboard_link"] = SharedAIHelpers.GetDashboardLinkObject(dashboardBaseUrl, DashboardUrls.ResourcesUrl(resource: resource.Name), resourceName); 129resourceObj["environment_variables"] = envVarsArray;
Model\GenAI\GenAIItemPartViewModel.cs (1)
100jsonObject[kvp.Key] = JsonNode.Parse(kvp.Value.GetRawText());
Otlp\Model\OtlpHelpers.cs (1)
149o[item.Key] = ConvertAnyValue(item.Value);
src\Shared\ConsoleLogs\SharedAIHelpers.cs (4)
224attributesObj[attr.Key!] = context.AddValue(attrValue, id => $@"Duplicate of attribute ""{id.Key}"" for span {OtlpHelpers.ToShortenedId(id.SpanId)}", (SpanId: spanId, attr.Key)); 286traceData["dashboard_link"] = GetDashboardLinkObject(dashboardBaseUrl, DashboardUrls.TraceDetailUrl(traceId), traceId); 588attributesObject[attr.Key!] = context.AddValue(attrValue, id => $@"Duplicate of attribute ""{id.Key}"" for log entry {id.LogId}", (LogId: logId, attr.Key)); 607log["dashboard_link"] = GetDashboardLinkObject(dashboardBaseUrl, DashboardUrls.StructuredLogsUrl(logEntryId: logId), $"log_id: {logId}");
Aspire.Hosting (18)
Ats\AtsError.cs (5)
53obj["capability"] = Capability; 58obj["details"] = Details.ToJsonObject(); 100obj["parameter"] = Parameter; 105obj["expected"] = Expected; 110obj["actual"] = Actual;
Dashboard\DashboardEventHandlers.cs (2)
263frameworkObj["version"] = netCoreVersion; 266frameworkObj["version"] = aspNetCoreVersion;
Devcontainers\DevcontainerSettingsWriter.cs (3)
177portAttributes["label"] = label; 178portAttributes["protocol"] = protocol; 179portAttributes["onAutoForward"] = openBrowser ? "openBrowser" : "silent";
Pipelines\DeploymentStateSection.cs (1)
56Data[RootValueKey] = JsonValue.Create(value);
Pipelines\Internal\DeploymentStateManagerBase.cs (2)
296current[segment] = nextObj; 307current[segments[^1]] = value;
Pipelines\Internal\JsonFlattener.cs (4)
47current[key] = newObject; 56current[keys[^1]] = kvp.Value?.DeepClone(); 87result[arrayKey] = array[i]?.DeepClone(); 93result[key] = kvp.Value?.DeepClone();
UserSecrets\UserSecretsManagerFactory.cs (1)
183contents[secret.Key] = secret.Value;
Aspire.Hosting.Azure (13)
Provisioning\BicepUtilities.cs (2)
45parameters[parameter.Key] = new JsonObject() 72scope["resourceGroup"] = targetScope switch
Provisioning\Internal\BaseProvisioningContextProvider.cs (6)
115azureStateSection.Data["ResourceGroup"] = resourceGroupName; 165azureSection["Location"] = _options.Location; 166azureSection["SubscriptionId"] = _options.SubscriptionId; 167azureSection["ResourceGroup"] = resourceGroupName; 170azureSection["TenantId"] = _options.TenantId; 174azureSection["AllowResourceGroupCreation"] = _options.AllowResourceGroupCreation.Value;
Provisioning\Provisioners\BicepProvisioner.cs (5)
245stateSection.Data["Id"] = deployment.Id.ToString(); 248stateSection.Data["Parameters"] = parameters.ToJsonString(); 253stateSection.Data["Outputs"] = outputObj.ToJsonString(); 259stateSection.Data["Scope"] = scope.ToJsonString(); 263stateSection.Data["CheckSum"] = BicepUtilities.GetChecksum(resource, parameters, scope);
Aspire.Hosting.Azure.Tests (4)
AzureEventHubsExtensionsTests.cs (1)
402document["Custom"] = JsonValue.Create(42);
AzureServiceBusExtensionsTests.cs (1)
513document["Custom"] = JsonValue.Create(42);
ProvisioningContextTests.cs (1)
203azureSection.Data["SubscriptionId"] = "test-id";
ProvisioningTestHelpers.cs (1)
629_state[section.SectionName] = section.Data;
Aspire.Hosting.Tests (19)
Orchestrator\ParameterProcessorTests.cs (1)
1614_unflattenedState[section.SectionName] = section.Data.DeepClone().AsObject();
Publishing\DeploymentStateManagerTests.cs (18)
41section1.Data["key1"] = "value1"; 60section1.Data["key1"] = "value1"; 70section2.Data["key2"] = "value2"; 89parametersSection.Data["param1"] = "value1"; 90azureSection.Data["resource1"] = "azure-value1"; 118section.Data[$"key{sectionIndex}"] = $"value{sectionIndex}"; 141section1.Data["key1"] = "value1"; 162section1.Data["key1"] = "value1"; 175section2.Data["key2"] = "value2"; 227section.Data["key1"] = "value1"; 244section.Data["nestedKey"] = "nestedValue"; 262section1.Data["key1"] = "value1"; 263section2.Data["key2"] = "value2"; 298section1.Data["key1"] = "value1"; 307section2.Data["key2"] = "value2"; 339topLevel.Data["topKey"] = "topValue"; 340nested.Data["nestedKey"] = "nestedValue"; 359section.Data["key"] = "value";
Aspire.Hosting.Yarp (5)
YarpJsonConfigGeneratorBuilder.cs (5)
84var jsonProxyConfig = jsonObject["ReverseProxy"] = new JsonObject(); 85jsonProxyConfig["Clusters"] = AddClusters(); 86jsonProxyConfig["Routes"] = AddRoutes(); 102routesNode[route.RouteId] = node; 116routesNode[cluster.ClusterId] = node;
aspire-server (1)
Ats\AtsCallbackProxyFactory.cs (1)
276args["$cancellationToken"] = tokenId;
ConfigurationSchemaGenerator (21)
ConfigSchemaEmitter.cs (21)
63categoryNode["$ref"] = "#/definitions/logLevelThreshold"; 67parent["definitions"] = new JsonObject 120currentNode["type"] = "object"; 126currentNode[propertiesName] = propertiesNode; 241currentNode["type"] = "object"; 247currentNode["properties"] = propertiesNode; 318currentNode["type"] = typeName; 320currentNode[containerName] = containerNode; 445propertyNode["description"] = description; 459propertyNode["default"] = true; 463propertyNode["default"] = false; 591propertyNode["type"] = "string"; 592propertyNode["pattern"] = TimeSpanRegex; 608propertyNode["enum"] = enumNode; 612propertyNode["type"] = "string"; 613propertyNode["format"] = "uri"; 620propertyNode["type"] = new JsonArray { "number", "string" }; 624propertyNode["type"] = "string"; 625propertyNode["format"] = "uuid"; 630propertyNode["oneOf"] = new JsonArray 649propertyNode["type"] = GetParsableTypeName(parsable);
dotnet-user-jwts (2)
Helpers\JwtAuthenticationSchemeSettings.cs (2)
34schemes[SchemeName] = settingsObject; 46config[AuthenticationKey] = new JsonObject
Microsoft.AspNetCore.Identity.Test (36)
Passkeys\PasskeyHandlerAssertionTest.cs (18)
58credentialJson["id"] = JsonNode.Parse(jsonValue); 74credentialJson["id"] = GetInvalidBase64UrlValue(base64UrlCredentialId); 109credentialJson["type"] = JsonNode.Parse(jsonValue); 124credentialJson["type"] = "unexpected-value"; 158credentialJson["response"] = JsonNode.Parse(jsonValue); 192assertionStateJson["challenge"] = JsonNode.Parse(jsonValue); 478clientDataJson["type"] = JsonNode.Parse(jsonValue); 496clientDataJson["type"] = value; 530clientDataJson["challenge"] = JsonNode.Parse(jsonValue); 545clientDataJson["challenge"] = ""; 561clientDataJson["challenge"] = GetInvalidBase64UrlValue(base64UrlChallenge); 579clientDataJson["challenge"] = Base64Url.EncodeToString(challenge); 613clientDataJson["origin"] = JsonNode.Parse(jsonValue); 628clientDataJson["origin"] = ""; 650clientDataJson["origin"] = returnedOrigin; 667clientDataJson["tokenBinding"] = JsonNode.Parse(jsonValue); 682clientDataJson["tokenBinding"] = JsonNode.Parse("{}"); 698clientDataJson["tokenBinding"] = JsonNode.Parse("""
Passkeys\PasskeyHandlerAttestationTest.cs (18)
58credentialJson["id"] = JsonNode.Parse(jsonValue); 74credentialJson["id"] = GetInvalidBase64UrlValue(base64UrlCredentialId); 109credentialJson["type"] = JsonNode.Parse(jsonValue); 124credentialJson["type"] = "unexpected-value"; 158credentialJson["response"] = JsonNode.Parse(jsonValue); 313attestationStateJson["challenge"] = JsonNode.Parse(jsonValue); 447clientDataJson["type"] = JsonNode.Parse(jsonValue); 465clientDataJson["type"] = value; 499clientDataJson["challenge"] = JsonNode.Parse(jsonValue); 514clientDataJson["challenge"] = ""; 530clientDataJson["challenge"] = GetInvalidBase64UrlValue(base64UrlChallenge); 548clientDataJson["challenge"] = Base64Url.EncodeToString(challenge); 582clientDataJson["origin"] = JsonNode.Parse(jsonValue); 597clientDataJson["origin"] = ""; 619clientDataJson["origin"] = returnedOrigin; 636clientDataJson["tokenBinding"] = JsonNode.Parse(jsonValue); 651clientDataJson["tokenBinding"] = JsonNode.Parse("{}"); 667clientDataJson["tokenBinding"] = JsonNode.Parse("""
Microsoft.AspNetCore.JsonPatch.SystemTextJson (1)
Internal\JsonObjectAdapter.cs (1)
22obj[segment] = value != null ? JsonSerializer.SerializeToNode(value, serializerOptions) : GetJsonNull();
Microsoft.AspNetCore.OpenApi (54)
Extensions\JsonNodeSchemaExtensions.cs (48)
89schema[OpenApiSchemaKeywords.FormatKeyword] = "byte"; 124schema[rangeAttribute.MinimumIsExclusive ? OpenApiSchemaKeywords.ExclusiveMinimum : OpenApiSchemaKeywords.MinimumKeyword] = minValue; 128schema[rangeAttribute.MaximumIsExclusive ? OpenApiSchemaKeywords.ExclusiveMaximum : OpenApiSchemaKeywords.MaximumKeyword] = maxValue; 133schema[OpenApiSchemaKeywords.PatternKeyword] = regularExpressionAttribute.Pattern; 139schema[key] = maxLengthAttribute.Length; 145schema[key] = minLengthAttribute.Length; 151schema[$"min{targetKeySuffix}"] = lengthAttribute.MinimumLength; 152schema[$"max{targetKeySuffix}"] = lengthAttribute.MaximumLength; 156schema[OpenApiSchemaKeywords.FormatKeyword] = "uri"; 160schema[OpenApiSchemaKeywords.MinLengthKeyword] = stringLengthAttribute.MinimumLength; 161schema[OpenApiSchemaKeywords.MaxLengthKeyword] = stringLengthAttribute.MaximumLength; 185schema[schemaAttribute] = null; 189schema[schemaAttribute] = JsonSerializer.SerializeToNode(defaultValue, jsonTypeInfo); 217schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes | JsonSchemaType.Null).ToString(); 219schema[OpenApiSchemaKeywords.FormatKeyword] = openApiSchema.Format; 220schema[OpenApiConstants.SchemaId] = createSchemaReferenceId(context.TypeInfo); 237schema[OpenApiSchemaKeywords.MinimumKeyword] = minRouteConstraint.Min; 241schema[OpenApiSchemaKeywords.MaximumKeyword] = maxRouteConstraint.Max; 245schema[OpenApiSchemaKeywords.MinLengthKeyword] = minLengthRouteConstraint.MinLength; 249schema[OpenApiSchemaKeywords.MaxLengthKeyword] = maxLengthRouteConstraint.MaxLength; 253schema[OpenApiSchemaKeywords.MinimumKeyword] = rangeRouteConstraint.Min; 254schema[OpenApiSchemaKeywords.MaximumKeyword] = rangeRouteConstraint.Max; 258schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 259schema[OpenApiSchemaKeywords.FormatKeyword] = null; 260schema[OpenApiSchemaKeywords.PatternKeyword] = regexRouteConstraint.Constraint.ToString(); 264schema[OpenApiSchemaKeywords.MinLengthKeyword] = lengthRouteConstraint.MinLength; 265schema[OpenApiSchemaKeywords.MaxLengthKeyword] = lengthRouteConstraint.MaxLength; 269schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Number.ToString(); 270schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is FloatRouteConstraint ? "float" : "double"; 274schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Integer.ToString(); 275schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is LongRouteConstraint ? "int64" : "int32"; 279schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 280schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is GuidRouteConstraint ? "uuid" : null; 284schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Boolean.ToString(); 285schema[OpenApiSchemaKeywords.FormatKeyword] = null; 289schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 290schema[OpenApiSchemaKeywords.FormatKeyword] = null; 294schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 295schema[OpenApiSchemaKeywords.FormatKeyword] = "date-time"; 364schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes & ~JsonSchemaType.Null).ToString(); 409mappings[$"{discriminator}"] = $"{createSchemaReferenceId(context.TypeInfo)}{createSchemaReferenceId(jsonDerivedType)}"; 412schema[OpenApiSchemaKeywords.DiscriminatorKeyword] = polymorphismOptions.TypeDiscriminatorPropertyName; 413schema[OpenApiSchemaKeywords.DiscriminatorMappingKeyword] = mappings; 427schema[OpenApiConstants.SchemaId] = schemaReferenceId; 433schema[OpenApiConstants.SchemaId] = "Base"; 493schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes | JsonSchemaType.Null).ToString(); 499schema[OpenApiConstants.NullableProperty] = true; 522schema[OpenApiSchemaKeywords.TypeKeyword] = typeArray[0]?.GetValue<string>();
Schemas\OpenApiJsonSchema.Helpers.cs (1)
165obj[key] = ReadJsonNode(ref reader);
Services\Schemas\OpenApiSchemaService.cs (5)
105schema[OpenApiSchemaKeywords.DescriptionKeyword] = typeDescriptionAttribute.Description; 123schema[OpenApiSchemaKeywords.DescriptionKeyword] = descriptionAttribute.Description; 130schema[OpenApiConstants.RefDescriptionAnnotation] = descriptionAttribute.Description; 497newObject[property.Key] = processedValue?.DeepClone(); 501newObject[property.Key] = null;
Microsoft.Extensions.AI.Abstractions (46)
Utilities\AIJsonUtilities.Schema.Create.cs (37)
145schema[SchemaPropertyName] = SchemaKeywordUri; 150schema[TitlePropertyName] = title; 155schema[DescriptionPropertyName] = description; 158schema[TypePropertyName] = "object"; // Method schemas always hardcode the type as "object". 159schema[PropertiesPropertyName] = parameterSchemas; 163schema[RequiredPropertyName] = requiredProperties; 292objSchema[RefPropertyName] = (JsonNode)refUri; 319obj[TypePropertyName] = new JsonArray { (JsonNode)numericType, (JsonNode)"null" }; 323obj[TypePropertyName] = (JsonNode)numericType; 340objSchema[TypePropertyName] = new JsonArray { (JsonNode)typeValue, (JsonNode)"null" }; 361objSchema[TypePropertyName] = new JsonArray { (JsonNode)typeValue, (JsonNode)"null" }; 449obj[MinLengthStringPropertyName] ??= stringLengthAttribute.MinimumLength; 452obj[MaxLengthStringPropertyName] ??= stringLengthAttribute.MaximumLength; 461obj[MinLengthStringPropertyName] ??= minLengthAttribute.Length; 465obj[MinLengthCollectionPropertyName] ??= minLengthAttribute.Length; 475obj[MaxLengthStringPropertyName] ??= maxLengthAttribute.Length; 479obj[MaxLengthCollectionPropertyName] ??= maxLengthAttribute.Length; 529obj[MinExclusiveRangePropertyName] ??= minNode; 534obj[MinRangePropertyName] ??= minNode; 543obj[MaxExclusiveRangePropertyName] ??= maxNode; 548obj[MaxRangePropertyName] ??= maxNode; 567requiredArray ??= (JsonArray)(requiredSchemaObj[RequiredPropertyName] = new JsonArray()); 604obj[MinLengthStringPropertyName] ??= lengthAttribute.MinimumLength; 607obj[MaxLengthStringPropertyName] ??= lengthAttribute.MaximumLength; 613obj[MinLengthCollectionPropertyName] ??= lengthAttribute.MinimumLength; 616obj[MaxLengthCollectionPropertyName] ??= lengthAttribute.MaximumLength; 627obj[EnumPropertyName] = enumArray; 642(JsonObject)(obj[NotPropertyName] = new JsonObject()); 648notObj[EnumPropertyName] = enumArray; 661obj[FormatPropertyName] ??= "date-time"; 665obj[FormatPropertyName] ??= "date"; 669obj[FormatPropertyName] ??= "time"; 673obj[FormatPropertyName] ??= "email"; 677obj[FormatPropertyName] ??= "uri"; 681obj[FormatPropertyName] ??= "uri"; 682obj[ContentMediaTypePropertyName] ??= "image/*"; 824jsonObject[entry.Key] = entry.Value;
Utilities\AIJsonUtilities.Schema.Transform.cs (9)
75properties[prop.Key] = TransformSchemaCore(prop.Value, transformOptions, path); 85schemaObj[ItemsPropertyName] = TransformSchemaCore(itemsSchema, transformOptions, path); 93schemaObj[AdditionalPropertiesPropertyName] = TransformSchemaCore(additionalProps, transformOptions, path); 100schemaObj[NotPropertyName] = TransformSchemaCore(notSchema, transformOptions, path); 130schemaObj[AdditionalPropertiesPropertyName] = (JsonNode)false; 141schemaObj[RequiredPropertyName] = requiredProps; 172schemaObj["type"] = (JsonNode)foundType; 173schemaObj["nullable"] = (JsonNode)true; 185schemaObj[DescriptionPropertyName] = description;
Microsoft.Extensions.AI.Evaluation.Quality (1)
AIToolExtensions.cs (1)
34functionJsonNode["functionReturnValueSchema"] =
Microsoft.Extensions.AI.Evaluation.Safety (6)
ContentSafetyServicePayloadUtilities.cs (6)
157payload["MetricList"] = new JsonArray([.. metricNames]); 204item[questionPropertyName] = question.Text; 209item[answerPropertyName] = answer.Text; 214item[contextPropertyName] = normalizedPerTurnContext[index]; 239payload["MetricList"] = new JsonArray([.. metricNames]); 371payload["MetricList"] = new JsonArray([.. metricNames]);
Microsoft.Extensions.AI.OpenAI (1)
OpenAIClientExtensions.cs (1)
88schemaObj["description"] = schemaObj["description"] is { } descriptionNode && descriptionNode.GetValueKind() == JsonValueKind.String ?
Microsoft.ML.AutoML (9)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (2)
27jsonObject["schema"] = value.Schema.ToString(); 28jsonObject["estimators"] = JsonValue.Create(value.Estimators);
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
30jObject["estimatorType"] = JsonValue.Create(value.EstimatorType); 31jObject["parameter"] = JsonValue.Create(value.Parameter);
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (2)
30jNode["parameter"] = JsonValue.Create(parameter); 31jNode["estimators"] = JsonValue.Create(estimators);
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
28jsonObject["schema"] = value.Schema.ToString(); 29jsonObject["currentSchema"] = value.CurrentParameter["_SCHEMA_"].AsType<string>(); 30jsonObject["estimators"] = JsonValue.Create(value.Estimators);
System.Text.Json (1)
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (1)
36jObject[propertyName] = jNodeValue;
TestProject.AppHost (2)
TestProgram.cs (2)
176root[project.Name] = projectJson; 179projectJson["Endpoints"] = endpointsJsonArray;
379 references to
aspire (21)
Agents\ClaudeCode\ClaudeCodeAgentEnvironmentScanner.cs (4)
278if (!config.ContainsKey("mcpServers") || config["mcpServers"] is not JsonObject) 283var servers = config["mcpServers"]!.AsObject(); 319if (!config.ContainsKey("mcpServers") || config["mcpServers"] is not JsonObject) 324var servers = config["mcpServers"]!.AsObject();
Agents\CopilotCli\CopilotCliAgentEnvironmentScanner.cs (4)
240if (!config.ContainsKey("mcpServers") || config["mcpServers"] is not JsonObject) 245var servers = config["mcpServers"]!.AsObject(); 295if (!config.ContainsKey("mcpServers") || config["mcpServers"] is not JsonObject) 300var servers = config["mcpServers"]!.AsObject();
Agents\OpenCode\OpenCodeAgentEnvironmentScanner.cs (4)
226if (!config.ContainsKey("mcp") || config["mcp"] is not JsonObject) 231var mcp = config["mcp"]!.AsObject(); 274if (!config.ContainsKey("mcp") || config["mcp"] is not JsonObject) 279var mcp = config["mcp"]!.AsObject();
Agents\VsCode\VsCodeAgentEnvironmentScanner.cs (4)
311if (!config.ContainsKey("servers") || config["servers"] is not JsonObject) 316var servers = config["servers"]!.AsObject(); 359if (!config.ContainsKey("servers") || config["servers"] is not JsonObject) 364var servers = config["servers"]!.AsObject();
Configuration\ConfigurationService.cs (5)
197if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject) 202currentObject = currentObject[part]!.AsObject(); 227if (settings.ContainsKey(partialKey) && settings[partialKey] is not JsonObject) 251if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject) 256currentObject = currentObject[part]!.AsObject();
Aspire.Cli.Tests (78)
Agents\CopilotCliAgentEnvironmentScannerTests.cs (9)
62var servers = config["mcpServers"]?.AsObject(); 66var aspireServer = servers["aspire"]?.AsObject(); 68Assert.Equal("local", aspireServer["type"]?.GetValue<string>()); 69Assert.Equal("aspire", aspireServer["command"]?.GetValue<string>()); 71var args = aspireServer["args"]?.AsArray(); 78var env = aspireServer["env"]?.AsObject(); 81Assert.Equal("${DOTNET_ROOT}", env["DOTNET_ROOT"]?.GetValue<string>()); 84var tools = aspireServer["tools"]?.AsArray(); 122var servers = config["mcpServers"]?.AsObject();
Agents\VsCodeAgentEnvironmentScannerTests.cs (12)
148var servers = config["servers"]?.AsObject(); 152var aspireServer = servers["aspire"]?.AsObject(); 154Assert.Equal("stdio", aspireServer["type"]?.GetValue<string>()); 155Assert.Equal("aspire", aspireServer["command"]?.GetValue<string>()); 157var args = aspireServer["args"]?.AsArray(); 200var servers = config["servers"]?.AsObject(); 247Assert.Equal("stdio", aspireServer["type"]?.GetValue<string>()); 248Assert.Equal("aspire", aspireServer["command"]?.GetValue<string>()); 278var servers = config["servers"]?.AsObject(); 285var playwrightServer = servers["playwright"]?.AsObject(); 287Assert.Equal("stdio", playwrightServer["type"]?.GetValue<string>()); 288Assert.Equal("npx", playwrightServer["command"]?.GetValue<string>());
Commands\ConfigCommandTests.cs (12)
77Assert.Equal("bar", settings["foo"]?.ToString()); 100Assert.True(settings["foo"] is JsonObject); 101var fooObject = settings["foo"]!.AsObject(); 102Assert.Equal("baz", fooObject["bar"]?.ToString()); 126Assert.True(settings["foo"] is JsonObject); 127var fooObject = settings["foo"]!.AsObject(); 128Assert.True(fooObject["bar"] is JsonObject); 129var barObject = fooObject["bar"]!.AsObject(); 130Assert.Equal("hello", barObject["baz"]?.ToString()); 158Assert.True(settings["foo"] is JsonObject); 159var fooObject = settings["foo"]!.AsObject(); 160Assert.Equal("nested", fooObject["bar"]?.ToString());
Mcp\ListStructuredLogsToolTests.cs (17)
200Assert.Equal("api-service-instance-1", firstLog["resource_name"]?.GetValue<string>()); 201Assert.Equal(42, firstLog["log_id"]?.GetValue<long>()); 202var firstLogAttributes = firstLog["attributes"]?.AsObject(); 208var firstDashboardLink = firstLog["dashboard_link"]?.AsObject(); 210Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=42", firstDashboardLink["url"]?.GetValue<string>()); 211Assert.Equal("log_id: 42", firstDashboardLink["text"]?.GetValue<string>()); 216Assert.Equal("api-service-instance-2", secondLog["resource_name"]?.GetValue<string>()); 217Assert.Equal(43, secondLog["log_id"]?.GetValue<long>()); 218var secondLogAttributes = secondLog["attributes"]?.AsObject(); 222var secondDashboardLink = secondLog["dashboard_link"]?.AsObject(); 224Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=43", secondDashboardLink["url"]?.GetValue<string>()); 225Assert.Equal("log_id: 43", secondDashboardLink["text"]?.GetValue<string>()); 230Assert.Equal("worker-service", thirdLog["resource_name"]?.GetValue<string>()); 231Assert.Equal(44, thirdLog["log_id"]?.GetValue<long>()); 233var thirdDashboardLink = thirdLog["dashboard_link"]?.AsObject(); 235Assert.Equal("http://localhost:18888/structuredlogs?logEntryId=44", thirdDashboardLink["url"]?.GetValue<string>()); 236Assert.Equal("log_id: 44", thirdDashboardLink["text"]?.GetValue<string>());
Mcp\ListTracesToolTests.cs (17)
173Assert.Equal("abc123d", firstTrace["trace_id"]?.GetValue<string>()); 176var spans = firstTrace["spans"]?.AsArray(); 181var firstDashboardLink = firstTrace["dashboard_link"]?.AsObject(); 183Assert.Equal("http://localhost:18888/traces/detail/abc123d", firstDashboardLink["url"]?.GetValue<string>()); 184Assert.Equal("abc123d", firstDashboardLink["text"]?.GetValue<string>()); 189Assert.Equal("api-service-instance-1", serverSpan["source"]?.GetValue<string>()); 190Assert.Null(serverSpan["destination"]); 195Assert.Equal("api-service-instance-2", clientSpan["source"]?.GetValue<string>()); 196Assert.Equal("catalog-service", clientSpan["destination"]?.GetValue<string>()); 201Assert.Equal("xyz789a", secondTrace["trace_id"]?.GetValue<string>()); 203var secondDashboardLink = secondTrace["dashboard_link"]?.AsObject(); 205Assert.Equal("http://localhost:18888/traces/detail/xyz789a", secondDashboardLink["url"]?.GetValue<string>()); 206Assert.Equal("xyz789a", secondDashboardLink["text"]?.GetValue<string>()); 209var secondTraceSpans = secondTrace["spans"]?.AsArray(); 216Assert.Equal("Internal", internalSpan["kind"]?.GetValue<string>()); 217Assert.Equal("worker-service", internalSpan["source"]?.GetValue<string>()); 218Assert.Null(internalSpan["destination"]);
Projects\ProjectUpdaterTests.cs (11)
477itemsAndProperties["Items"]!["PackageReference"]!.AsArray().Clear(); // Then clear it 484itemsAndProperties["Items"]!["PackageReference"]!.AsArray().Clear(); // Then clear it 2560properties = root["Properties"]!.AsObject(); 2575items = root["Items"]!.AsObject(); 2594var items = root["Items"]!.AsObject(); 2595var packageReferences = items["PackageReference"]!.AsArray(); 2610var items = root["Items"]!.AsObject(); 2611var packageReferences = items["PackageReference"]!.AsArray(); 2626var items = root["Items"]!.AsObject(); 2627var projectReferences = items["ProjectReference"]!.AsArray(); 2643properties = root["Properties"]!.AsObject();
Aspire.Dashboard (10)
Model\GenAI\GenAISchemaHelpers.cs (6)
23Type = ParseTypeValue(schemaObj["type"]), 24Description = schemaObj["description"]?.GetValue<string>() 28if (schemaObj["properties"] is JsonObject propsObj) 45if (schemaObj["items"] is JsonObject itemsObj) 51if (schemaObj["required"] is JsonArray requiredArray) 64if (schemaObj["enum"] is JsonArray enumArray)
Model\GenAI\GenAIVisualizerDialogViewModel.cs (4)
102Type = obj["type"]?.GetValue<string>() ?? "function", 103Name = obj["name"]?.GetValue<string>(), 104Description = obj["description"]?.GetValue<string>() 108if (obj["parameters"] is JsonObject paramsObj)
Aspire.Dashboard.Tests (20)
Integration\McpConfigurationTests.cs (14)
60Assert.Equal("promptString", input["type"]?.GetValue<string>()); 61Assert.Equal("Enter x-mcp-api-key", input["description"]?.GetValue<string>()); 62Assert.True(input["password"]?.GetValue<bool>()); 65var servers = parsed["servers"]; 71Assert.Equal("http://localhost:23052/mcp", dashboard["url"]?.GetValue<string>()); 74var headers = dashboard["headers"]; 118var inputsArray = parsed["inputs"]?.AsArray(); 125Assert.Equal("promptString", input["type"]?.GetValue<string>()); 126Assert.Equal("Enter x-mcp-api-key", input["description"]?.GetValue<string>()); 127Assert.True(input["password"]?.GetValue<bool>()); 130var headers = parsed["headers"]; 165var servers = parsed["servers"]; 171Assert.Equal("http://localhost:23052/mcp", dashboard["url"]?.GetValue<string>()); 174Assert.Null(dashboard["headers"]);
Integration\McpServiceTests.cs (5)
45var tools = jsonResponse["result"]!["tools"]!.AsArray(); 119var tools = jsonResponse["result"]!["tools"]!.AsArray(); 143var tools = jsonResponse["result"]!["tools"]!.AsArray(); 179var tools = jsonResponse["result"]!["tools"]!.AsArray(); 239var tools = jsonResponse["result"]!["tools"]!.AsArray();
Integration\StartupTests.cs (1)
427var tools = jsonResponse["result"]!["tools"]!.AsArray();
Aspire.Hosting (8)
Dashboard\DashboardEventHandlers.cs (7)
159if (configJson["runtimeOptions"]?.AsObject() is { } runtimeOptions && 160runtimeOptions["frameworks"]?.AsArray() is { } frameworks) 165frameworkObj["name"]?.GetValue<string>() is { } name && 166frameworkObj["version"]?.GetValue<string>() is { } version) 252if (configJson["runtimeOptions"]?.AsObject() is { } runtimeOptions && 253runtimeOptions["frameworks"]?.AsArray() is { } frameworks) 258frameworkObj["name"]?.GetValue<string>() is { } name)
Devcontainers\DevcontainerSettingsWriter.cs (1)
148let l = attrs["label"]?.ToString()
Aspire.Hosting.Azure (12)
AzureBicepResource.cs (10)
388if (responseObj["error"] is JsonObject errorObj) 390var code = errorObj["code"]?.ToString(); 391var message = errorObj["message"]?.ToString(); 395if (errorObj["details"] is JsonArray detailsArray && detailsArray.Count > 0) 408if (responseObj["properties"]?["error"] is JsonObject deploymentErrorObj) 410var code = deploymentErrorObj["code"]?.ToString(); 411var message = deploymentErrorObj["message"]?.ToString(); 433var detailCode = detailObj["code"]?.ToString(); 434var detailMessage = detailObj["message"]?.ToString(); 436if (detailObj["details"] is JsonArray nestedDetailsArray && nestedDetailsArray.Count > 0)
Provisioning\JsonExtensions.cs (2)
15var node = jsonObj[key]; 26node = jsonObj[key];
Aspire.Hosting.Azure.Tests (23)
AzureEventHubsExtensionsTests.cs (1)
398document["UserConfig"]!["LoggingConfig"] = new JsonObject { ["Type"] = "Console" };
AzureInfrastructureExtensionsTests.cs (2)
28Assert.Equal("azure.bicep.v0", manifest["type"]?.ToString()); 29Assert.Equal("infrastructure1.module.bicep", manifest["path"]?.ToString());
AzureServiceBusExtensionsTests.cs (1)
509document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };
BicepUtilitiesTests.cs (11)
26Assert.Equal("david", parameters["name"]?["value"]?.ToString()); 62Assert.Equal("john", parameters["name"]?["value"]?.ToString()); 63Assert.Equal(20, parameters["age"]?["value"]?.GetValue<int>()); 64Assert.Equal(["a", "b", "c"], parameters["values"]?["value"]?.AsArray()?.Select(v => v?.ToString()) ?? []); 65Assert.Equal("connection string", parameters["conn"]?["value"]?.ToString()); 66Assert.Equal("value", parameters["jsonObj"]?["value"]?["key"]?.ToString()); 67Assert.Equal("paramValue", parameters["param"]?["value"]?.ToString()); 68Assert.Equal("paramValue/1", parameters["expr"]?["value"]?.ToString()); 69Assert.Equal("http://localhost:1023", parameters["endpoint"]?["value"]?.ToString()); 346Assert.Equal("test-rg", scope["resourceGroup"]?.ToString()); 364Assert.Null(scope["resourceGroup"]?.AsValue().GetValue<object>());
JsonExtensionsTests.cs (7)
23Assert.Equal("TestValue", retrievedNode["TestProperty"]!.GetValue<string>()); 37Assert.Same(rootJson["NewProperty"], newNode); 53Assert.NotNull(rootJson["Level1"]); 54Assert.NotNull(rootJson["Level1"]!["Level2"]); 55Assert.NotNull(rootJson["Level1"]!["Level2"]!["Level3"]); 56Assert.NotNull(rootJson["Level1"]!["Level2"]!["Level3"]!["Level4"]); 57Assert.Same(deeply, rootJson["Level1"]!["Level2"]!["Level3"]!["Level4"]);
ProvisioningContextTests.cs (1)
210Assert.Equal("test-id", loadedSection.Data["SubscriptionId"]?.ToString());
Aspire.Hosting.JavaScript.Tests (1)
AddViteAppTests.cs (1)
225Assert.Equal("container.v1", manifest["type"]?.ToString());
Aspire.Hosting.Redis.Tests (5)
RedisFunctionalTests.cs (5)
574var agreements = jo["agreements"]; 577Assert.False(agreements["analytics"]!.GetValue<bool>()); 578Assert.False(agreements["notifications"]!.GetValue<bool>()); 579Assert.False(agreements["encryption"]!.GetValue<bool>()); 580Assert.True(agreements["eula"]!.GetValue<bool>());
Aspire.Hosting.RemoteHost.Tests (22)
AtsMarshallerTests.cs (10)
390Assert.NotNull(jsonObj["$handle"]); 391Assert.NotNull(jsonObj["$type"]); 393var typeId = jsonObj["$type"]!.GetValue<string>(); 409Assert.NotNull(jsonObj["$handle"]); 410Assert.NotNull(jsonObj["$type"]); 412var typeId = jsonObj["$type"]!.GetValue<string>(); 428Assert.NotNull(jsonObj["$handle"]); 429Assert.NotNull(jsonObj["$type"]); 559Assert.Equal("test", jsonObj["name"]?.GetValue<string>()); 560Assert.Equal(10, jsonObj["count"]?.GetValue<int>());
CallbackProxyTests.cs (4)
128Assert.Equal("hello-world", args["p0"]?.GetValue<string>()); 145Assert.Equal("test-name", args["p0"]?.GetValue<string>()); 146Assert.Equal(42, args["p1"]?.GetValue<int>()); 178Assert.Equal("test", args["p0"]?.GetValue<string>());
CapabilityDispatcherTests.cs (3)
336var nestedHandleId = handleRef["$handle"]!.GetValue<string>(); 337var nestedTypeId = handleRef["$type"]!.GetValue<string>(); 633Assert.Equal("hello from C#", callbackArgs["p0"]?.GetValue<string>());
HandleRegistryTests.cs (4)
172Assert.NotNull(json["$handle"]); 173Assert.NotNull(json["$type"]); 174Assert.Equal("aspire/TestObject", json["$type"]!.GetValue<string>()); 176var handleId = json["$handle"]!.GetValue<string>();
ReferenceExpressionRefTests.cs (1)
252((JsonObject)json["$expr"]!)["valueProviders"] = providersArray;
Aspire.Hosting.Tests (50)
JsonFlattenerTests.cs (31)
36Assert.Equal("existing-flat-value", result["Azure:SubscriptionId"]!.ToString()); 37Assert.Equal("microsoft.onmicrosoft.com", result["Azure:Tenant"]!.ToString()); 38Assert.Equal("/subscriptions/123/deployments/MyStorage", result["Azure:Deployments:MyStorage:Id"]!.ToString()); 39Assert.Equal("{ \"param\": \"value\" }", result["Azure:Deployments:MyStorage:Parameters"]!.ToString()); 61Assert.Equal("07268dd7-4c50-434b-b1ff-67b8164edb41", result["Azure:SubscriptionId"]!.ToString()); 62Assert.Equal("microsoft.onmicrosoft.com", result["Azure:Tenant"]!.ToString()); 63Assert.Equal("eastus2", result["Azure:Location"]!.ToString()); 102Assert.Equal("nested-value", result["Level1:Level2:Level3:DeepValue"]!.ToString()); 126Assert.Equal("text", result["StringValue"]!.ToString()); 127Assert.Equal("42", result["NumberValue"]!.ToString()); 128Assert.Equal("true", result["BoolValue"]!.ToString()); 129Assert.Null(result["NullValue"]); 130Assert.Equal("inner-text", result["Nested:InnerString"]!.ToString()); 131Assert.Null(result["Nested:InnerNull"]); 149Assert.Equal("value1", result["SimpleArray:0"]!.ToString()); 150Assert.Equal("value2", result["SimpleArray:1"]!.ToString()); 151Assert.Equal("value3", result["SimpleArray:2"]!.ToString()); 153Assert.Equal("1", result["NumberArray:0"]!.ToString()); 154Assert.Equal("2", result["NumberArray:1"]!.ToString()); 155Assert.Equal("3", result["NumberArray:2"]!.ToString()); 157Assert.Equal("text", result["MixedArray:0"]!.ToString()); 158Assert.Equal("42", result["MixedArray:1"]!.ToString()); 159Assert.Equal("true", result["MixedArray:2"]!.ToString()); 160Assert.Null(result["MixedArray:3"]); 189Assert.Equal("Item1", result["ObjectArray:0:Name"]!.ToString()); 190Assert.Equal("Value1", result["ObjectArray:0:Value"]!.ToString()); 191Assert.Equal("Item2", result["ObjectArray:1:Name"]!.ToString()); 192Assert.Equal("Value2", result["ObjectArray:1:Value"]!.ToString()); 194Assert.Equal("1", result["NestedConfig:Items:0:Id"]!.ToString()); 195Assert.Equal("true", result["NestedConfig:Items:0:Settings:Enabled"]!.ToString()); 213Assert.Equal("test", result["OtherValue"]!.ToString());
KestrelConfigTests.cs (1)
298Assert.Equal(expectedEnv, manifest["env"]!.ToString());
Publishing\DeploymentStateManagerTests.cs (15)
48Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 101Assert.Equal("value1", parametersCheck.Data["param1"]?.GetValue<string>()); 102Assert.Equal("azure-value1", azureCheck.Data["resource1"]?.GetValue<string>()); 130Assert.Equal($"value{i}", section.Data[$"key{i}"]?.GetValue<string>()); 149Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 170Assert.Equal("value1", section2.Data["key1"]?.GetValue<string>()); 183Assert.Equal("value1", section3.Data["key1"]?.GetValue<string>()); 184Assert.Equal("value2", section3.Data["key2"]?.GetValue<string>()); 234Assert.Equal("value1", retrievedSection.Data["key1"]?.GetValue<string>()); 251Assert.Equal("nestedValue", verifySection.Data["nestedKey"]?.GetValue<string>()); 271Assert.Equal("value1", verify1.Data["key1"]?.GetValue<string>()); 272Assert.Equal("value2", verify2.Data["key2"]?.GetValue<string>()); 288Assert.Equal("value1", verify.Data[""]?.GetValue<string>()); 348Assert.Equal("topValue", verifyTop.Data["topKey"]?.GetValue<string>()); 349Assert.Equal("nestedValue", verifyNested.Data["nestedKey"]?.GetValue<string>());
Utils\ManifestUtils.cs (2)
41var resourceNode = obj[resource.Name]; 67var resourceNode = obj[r.Name];
WithEndpointTests.cs (1)
527Assert.Equal(expectedEnv, manifest["env"]!.ToString());
ConfigurationSchemaGenerator (11)
ConfigSchemaEmitter.cs (11)
119var backupTypeNode = currentNode["type"]; 123if (currentNode[propertiesName] is not JsonObject propertiesNode) 132if (propertiesNode[pathSegment] is not JsonObject pathSegmentNode) 147backupCasingOfPathSegmentName = propertiesNode[pathSegment].GetPropertyName(); 174var existingValue = propertiesNode[pathSegment]; 240var backupTypeNode = currentNode["type"]; 244if (currentNode["properties"] is not JsonObject propertiesNode) 284var backupPropertyNode = currentNode[property.ConfigurationKeyName]; 315var backupTypeNode = currentNode["type"]; 316var backupContainerNode = currentNode[containerName]; 449var propertyNodeType = propertyNode["type"];
dotnet-user-jwts (6)
Helpers\JwtAuthenticationSchemeSettings.cs (4)
28if (config[AuthenticationKey] is JsonObject authentication) 30if (authentication[SchemesKey] is JsonObject schemes) 70if (config[AuthenticationKey] is JsonObject authentication && 71authentication[SchemesKey] is JsonObject schemes)
Helpers\SigningKeysHandler.cs (2)
82var signingKeys = secrets[signkingKeysPropertyName].AsArray(); 85var toRemove = signingKeys.SingleOrDefault(key => key["Issuer"].GetValue<string>() == issuer);
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (28)
UserJwtsTests.cs (28)
113Assert.Equal("dotnet-user-jwts", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue<string>()); 116Assert.Equal("new-issuer", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue<string>()); 130Assert.Equal("dotnet-user-jwts", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue<string>()); 133Assert.Equal("new-issuer", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue<string>()); 304Assert.Equal("baz", fooField["Bar"].GetValue<string>()); 521var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray()); 522Assert.Equal(32, signingKey["Length"].GetValue<int>()); 523Assert.True(Convert.TryFromBase64String(signingKey["Value"].GetValue<string>(), new byte[32], out var _)); 525Assert.Equal("baz", fooField["Bar"].GetValue<string>()); 549var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray()); 550Assert.Equal(32, signingKey["Length"].GetValue<int>()); 551Assert.True(Convert.TryFromBase64String(signingKey["Value"].GetValue<string>(), new byte[32], out var _)); 553Assert.Equal("baz", fooField["Bar"].GetValue<string>()); 588var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray()); 589Assert.Equal(32, signingKey["Length"].GetValue<int>()); 590Assert.True(Convert.TryFromBase64String(signingKey["Value"].GetValue<string>(), new byte[32], out var _)); 591Assert.Equal("test-issuer", signingKey["Issuer"].GetValue<string>()); 610var signingKeys = secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray(); 612Assert.NotNull(signingKeys.SingleOrDefault(signingKey => signingKey["Issuer"].GetValue<string>() == "test-issuer")); 613Assert.NotNull(signingKeys.SingleOrDefault(signingKey => signingKey["Issuer"].GetValue<string>() == "test-issuer-2")); 631var signingKey1 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray()); 632Assert.Equal("test-issuer", signingKey1["Issuer"].GetValue<string>()); 633Assert.Equal(32, signingKey1["Length"].GetValue<int>()); 634Assert.True(Convert.TryFromBase64String(signingKey1["Value"].GetValue<string>(), new byte[32], out var _)); 635var signingKey2 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme-2")].AsArray()); 636Assert.Equal("test-issuer", signingKey2["Issuer"].GetValue<string>()); 637Assert.Equal(32, signingKey2["Length"].GetValue<int>()); 638Assert.True(Convert.TryFromBase64String(signingKey2["Value"].GetValue<string>(), new byte[32], out var _));
Microsoft.AspNetCore.Identity.Test (34)
Passkeys\PasskeyHandlerAssertionTest.cs (19)
73var base64UrlCredentialId = (string)credentialJson["id"]!; 207var response = credentialJson["response"]!.AsObject(); 227credentialJson["response"]!["clientDataJSON"] = JsonNode.Parse(jsonValue); 242credentialJson["response"]!["clientDataJSON"] = ""; 257var response = credentialJson["response"]!.AsObject(); 277credentialJson["response"]!["authenticatorData"] = JsonNode.Parse(jsonValue); 292var base64UrlAuthenticatorData = (string)credentialJson["response"]!["authenticatorData"]!; 293credentialJson["response"]!["authenticatorData"] = GetInvalidBase64UrlValue(base64UrlAuthenticatorData); 309credentialJson["response"]!["authenticatorData"] = ""; 324var response = credentialJson["response"]!.AsObject(); 344credentialJson["response"]!["signature"] = JsonNode.Parse(jsonValue); 359var base64UrlSignature = (string)credentialJson["response"]!["signature"]!; 360credentialJson["response"]!["signature"] = GetInvalidBase64UrlValue(base64UrlSignature); 376credentialJson["response"]!["signature"] = ""; 410credentialJson["response"]!["userHandle"] = JsonNode.Parse(jsonValue); 425credentialJson["response"]!["userHandle"] = null; 444credentialJson["response"]!["userHandle"] = Base64Url.EncodeToString(Encoding.UTF8.GetBytes(newUserId)); 560var base64UrlChallenge = (string)clientDataJson["challenge"]!; 577var challenge = Base64Url.DecodeFromChars((string)clientDataJson["challenge"]!);
Passkeys\PasskeyHandlerAttestationTest.cs (15)
73var base64UrlCredentialId = (string)credentialJson["id"]!; 173var user = attestationStateJson["userEntity"]!.AsObject(); 193attestationStateJson["userEntity"]!["id"] = JsonNode.Parse(jsonValue); 208var user = attestationStateJson["userEntity"]!.AsObject(); 228attestationStateJson["userEntity"]!["name"] = JsonNode.Parse(jsonValue); 243var user = attestationStateJson["userEntity"]!.AsObject(); 263attestationStateJson["userEntity"]!["displayName"] = JsonNode.Parse(jsonValue); 328var response = credentialJson["response"]!.AsObject(); 348credentialJson["response"]!["clientDataJSON"] = JsonNode.Parse(jsonValue); 363credentialJson["response"]!["clientDataJSON"] = ""; 378var response = credentialJson["response"]!.AsObject(); 398credentialJson["response"]!["attestationObject"] = JsonNode.Parse(jsonValue); 413credentialJson["response"]!["attestationObject"] = ""; 529var base64UrlChallenge = (string)clientDataJson["challenge"]!; 546var challenge = Base64Url.DecodeFromChars((string)clientDataJson["challenge"]!);
Microsoft.AspNetCore.JsonPatch.SystemTextJson.Tests (8)
JsonPatchDocumentJObjectTest.cs (8)
27Assert.Equal("foo@baz.com", model.CustomData["Emails"][1].GetValue<string>()); 58Assert.Equal("Bar Baz", model.CustomData["Name"].GetValue<string>()); 74Assert.Equal("foo@bar.com", model.CustomData["UserName"].GetValue<string>()); 107Assert.Equal("Bar", model.CustomData["LastName"].GetValue<string>()); 123Assert.Equal("Foo", model.CustomData["Name"].GetValue<string>()); 140Assert.Null(model.CustomData["Name"]); 156Assert.Equal("foo@baz.com", model.CustomData["Email"].GetValue<string>()); 172Assert.Null(model.CustomData["Email"]);
Microsoft.AspNetCore.OpenApi (8)
Extensions\JsonNodeSchemaExtensions.cs (8)
137var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 143var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 149var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 214if (underlyingType != null && MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && 361&& MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && 454if (schema[OpenApiConstants.SchemaId] is JsonNode schemaIdNode 490if (MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && 511schema[OpenApiSchemaKeywords.TypeKeyword] is JsonArray typeArray)
Microsoft.AspNetCore.OpenApi.Tests (5)
Extensions\JsonNodeSchemaExtensionsTests.cs (4)
120Assert.Equal(minimum, schema["exclusiveMinimum"].GetValue<decimal>()); 121Assert.Equal(maximum, schema["exclusiveMaximum"].GetValue<decimal>()); 127Assert.Equal(minimum, schema["minimum"].GetValue<decimal>()); 128Assert.Equal(maximum, schema["maximum"].GetValue<decimal>());
Integration\OpenApiDocumentIntegrationTests.cs (1)
159var @ref = parent[OpenApiSchemaKeywords.RefKeyword];
Microsoft.Extensions.AI.Abstractions (3)
Utilities\AIJsonUtilities.Schema.Create.cs (3)
637JsonNode? notNode = obj[NotPropertyName]; 644if (notObj[EnumPropertyName] is null) 773if (ctx.TypeInfo.NumberHandling is not JsonNumberHandling.Strict && schema["type"] is JsonArray typeArray)
Microsoft.Extensions.AI.Abstractions.Tests (1)
Utilities\AIJsonUtilitiesTests.cs (1)
1606Assert.Equal(((JsonArray)schemaObj["required"]!).Count, ((JsonObject)props!).Count);
Microsoft.Extensions.AI.OpenAI (2)
OpenAIClientExtensions.cs (2)
79if (schemaObj[propName] is { } propNode) 88schemaObj["description"] = schemaObj["description"] is { } descriptionNode && descriptionNode.GetValueKind() == JsonValueKind.String ?
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 (10)
SearchSpaceGenerator.cs (10)
39var className = Utils.ToTitleCase(jNode["name"].GetValue<string>()); 40var searchSpaceJArray = jNode["search_space"].AsArray(); 43var optionName = Utils.ToTitleCase(t["name"].GetValue<string>()); 44string optionTypeName = t["type"].GetValue<string>() switch 65var defaultToken = t.AsObject().ContainsKey("default") ? t["default"] : null; 86var searchSpaceNode = t.AsObject().ContainsKey("search_space") ? t["search_space"] : null; 96var minToken = searchSpaceNode["min"]; 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";
Roslyn.VisualStudio.Next.UnitTests (3)
UnifiedSettings\UnifiedSettingsTests.cs (3)
132var categories = jsonDocument!.Root["categories"]!.AsObject(); 232var categories = jsonDocument!.Root["categories"]!.AsObject(); 256var properties = jsonDocument!.Root["properties"]!.AsObject().SelectAsArray(
ServiceBus.AppHost (1)
Program.cs (1)
36document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };