187 writes to
aspire (2)
Configuration\ConfigurationService.cs (2)
161currentObject[part] = new JsonObject(); 169currentObject[finalKey] = value;
Aspire.Dashboard (1)
Otlp\Model\OtlpHelpers.cs (1)
153o[item.Key] = ConvertAnyValue(item.Value);
Aspire.Hosting (4)
Devcontainers\DevcontainerSettingsWriter.cs (3)
129portAttributes["label"] = label; 130portAttributes["protocol"] = protocol; 131portAttributes["onAutoForward"] = openBrowser ? "openBrowser" : "silent";
src\Shared\SecretsStore.cs (1)
59contents[secret.Key] = secret.Value;
Aspire.Hosting.Azure (13)
Provisioning\BicepUtilities.cs (2)
44parameters[parameter.Key] = new JsonObject() 71scope["resourceGroup"] = targetScope switch
Provisioning\Internal\DefaultProvisioningContextProvider.cs (3)
139azureSection["Location"] = _options.Location; 140azureSection["SubscriptionId"] = _options.SubscriptionId; 141azureSection["ResourceGroup"] = _options.ResourceGroup;
Provisioning\Internal\DefaultUserSecretsManager.cs (2)
109result[arrayKey] = array[i]?.DeepClone(); 115result[key] = kvp.Value?.DeepClone();
Provisioning\Provisioners\BicepProvisioner.cs (6)
213az["Tenant"] = context.Tenant.DefaultDomain; 224resourceConfig["Id"] = deployment.Id.ToString(); 227resourceConfig["Parameters"] = parameters.ToJsonString(); 232resourceConfig["Outputs"] = outputObj.ToJsonString(); 238resourceConfig["Scope"] = scope.ToJsonString(); 242resourceConfig["CheckSum"] = BicepUtilities.GetChecksum(resource, parameters, scope);
Aspire.Hosting.Azure.Tests (2)
AzureEventHubsExtensionsTests.cs (1)
402document["Custom"] = JsonValue.Create(42);
AzureServiceBusExtensionsTests.cs (1)
513document["Custom"] = JsonValue.Create(42);
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;
ConfigurationSchemaGenerator (22)
ConfigSchemaEmitter.cs (22)
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); 730jsonObject[key] = value;
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 (51)
Extensions\JsonNodeSchemaExtensions.cs (49)
88schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 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.TypeKeyword] = JsonSchemaType.String.ToString(); 157schema[OpenApiSchemaKeywords.FormatKeyword] = "uri"; 161schema[OpenApiSchemaKeywords.MinLengthKeyword] = stringLengthAttribute.MinimumLength; 162schema[OpenApiSchemaKeywords.MaxLengthKeyword] = stringLengthAttribute.MaximumLength; 182schema[OpenApiSchemaKeywords.DefaultKeyword] = null; 186schema[OpenApiSchemaKeywords.DefaultKeyword] = JsonSerializer.SerializeToNode(defaultValue, jsonTypeInfo); 219schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes | JsonSchemaType.Null).ToString(); 221schema[OpenApiSchemaKeywords.FormatKeyword] = openApiSchema.Format; 222schema[OpenApiConstants.SchemaId] = createSchemaReferenceId(context.TypeInfo); 239schema[OpenApiSchemaKeywords.MinimumKeyword] = minRouteConstraint.Min; 243schema[OpenApiSchemaKeywords.MaximumKeyword] = maxRouteConstraint.Max; 247schema[OpenApiSchemaKeywords.MinLengthKeyword] = minLengthRouteConstraint.MinLength; 251schema[OpenApiSchemaKeywords.MaxLengthKeyword] = maxLengthRouteConstraint.MaxLength; 255schema[OpenApiSchemaKeywords.MinimumKeyword] = rangeRouteConstraint.Min; 256schema[OpenApiSchemaKeywords.MaximumKeyword] = rangeRouteConstraint.Max; 260schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 261schema[OpenApiSchemaKeywords.FormatKeyword] = null; 262schema[OpenApiSchemaKeywords.PatternKeyword] = regexRouteConstraint.Constraint.ToString(); 266schema[OpenApiSchemaKeywords.MinLengthKeyword] = lengthRouteConstraint.MinLength; 267schema[OpenApiSchemaKeywords.MaxLengthKeyword] = lengthRouteConstraint.MaxLength; 271schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Number.ToString(); 272schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is FloatRouteConstraint ? "float" : "double"; 276schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Integer.ToString(); 277schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is LongRouteConstraint ? "int64" : "int32"; 281schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 282schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is GuidRouteConstraint ? "uuid" : null; 286schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Boolean.ToString(); 287schema[OpenApiSchemaKeywords.FormatKeyword] = null; 291schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 292schema[OpenApiSchemaKeywords.FormatKeyword] = null; 296schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 297schema[OpenApiSchemaKeywords.FormatKeyword] = "date-time"; 363schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes & ~JsonSchemaType.Null).ToString(); 408mappings[$"{discriminator}"] = $"{createSchemaReferenceId(context.TypeInfo)}{createSchemaReferenceId(jsonDerivedType)}"; 411schema[OpenApiSchemaKeywords.DiscriminatorKeyword] = polymorphismOptions.TypeDiscriminatorPropertyName; 412schema[OpenApiSchemaKeywords.DiscriminatorMappingKeyword] = mappings; 426schema[OpenApiConstants.SchemaId] = schemaReferenceId; 432schema[OpenApiConstants.SchemaId] = "Base"; 466schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes | JsonSchemaType.Null).ToString(); 484schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes | JsonSchemaType.Null).ToString();
Schemas\OpenApiJsonSchema.Helpers.cs (1)
165obj[key] = ReadJsonNode(ref reader);
Services\Schemas\OpenApiSchemaService.cs (1)
112schema[OpenApiSchemaKeywords.DescriptionKeyword] = descriptionAttribute.Description;
Microsoft.Extensions.AI.Abstractions (28)
Utilities\AIJsonUtilities.Schema.Create.cs (19)
132schema[SchemaPropertyName] = SchemaKeywordUri; 137schema[TitlePropertyName] = title; 142schema[DescriptionPropertyName] = description; 145schema[TypePropertyName] = "object"; // Method schemas always hardcode the type as "object". 146schema[PropertiesPropertyName] = parameterSchemas; 150schema[RequiredPropertyName] = requiredProperties; 283objSchema[RefPropertyName] = (JsonNode)refUri; 304obj[TypePropertyName] = new JsonArray { (JsonNode)numericType, (JsonNode)"null" }; 308obj[TypePropertyName] = (JsonNode)numericType; 325objSchema[TypePropertyName] = new JsonArray { (JsonNode)typeValue, (JsonNode)"null" }; 414obj[MinLengthStringPropertyName] ??= stringLengthAttribute.MinimumLength; 417obj[MaxLengthStringPropertyName] ??= stringLengthAttribute.MaximumLength; 425obj[MinLengthStringPropertyName] ??= minLengthAttribute.Length; 429obj[MinLengthCollectionPropertyName] ??= minLengthAttribute.Length; 438obj[MaxLengthStringPropertyName] ??= maxLengthAttribute.Length; 442obj[MaxLengthCollectionPropertyName] ??= maxLengthAttribute.Length; 496obj[MinRangePropertyName] ??= minNode; 510obj[MaxRangePropertyName] ??= maxNode; 685jsonObject[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)
159payload["MetricList"] = new JsonArray([.. metricNames]); 208item[questionPropertyName] = question.Text; 213item[answerPropertyName] = answer.Text; 218item[contextPropertyName] = normalizedPerTurnContext[index]; 243payload["MetricList"] = new JsonArray([.. metricNames]); 375payload["MetricList"] = new JsonArray([.. metricNames]);
Microsoft.Extensions.AI.OpenAI (1)
OpenAIClientExtensions.cs (1)
82schemaObj["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)
164root[project.Name] = projectJson; 167projectJson["Endpoints"] = endpointsJsonArray;
211 references to
aspire (4)
Configuration\ConfigurationService.cs (4)
159if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject) 164currentObject = currentObject[part]!.AsObject(); 188if (!currentObject.ContainsKey(part) || currentObject[part] is not JsonObject) 193currentObject = currentObject[part]!.AsObject();
Aspire.Cli.Tests (12)
Commands\ConfigCommandTests.cs (12)
47Assert.Equal("bar", settings["foo"]?.ToString()); 70Assert.True(settings["foo"] is JsonObject); 71var fooObject = settings["foo"]!.AsObject(); 72Assert.Equal("baz", fooObject["bar"]?.ToString()); 96Assert.True(settings["foo"] is JsonObject); 97var fooObject = settings["foo"]!.AsObject(); 98Assert.True(fooObject["bar"] is JsonObject); 99var barObject = fooObject["bar"]!.AsObject(); 100Assert.Equal("hello", barObject["baz"]?.ToString()); 128Assert.True(settings["foo"] is JsonObject); 129var fooObject = settings["foo"]!.AsObject(); 130Assert.Equal("nested", fooObject["bar"]?.ToString());
Aspire.Hosting (1)
Devcontainers\DevcontainerSettingsWriter.cs (1)
105let l = attrs["label"]?.ToString()
Aspire.Hosting.Azure (1)
Provisioning\JsonExtensions.cs (1)
12var node = obj[key];
Aspire.Hosting.Azure.Tests (50)
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()); 396Assert.Equal("test-rg", scope["resourceGroup"]?.ToString()); 414Assert.Null(scope["resourceGroup"]?.AsValue().GetValue<object>());
DefaultProvisioningContextProviderTests.cs (2)
144var azureSettings = userSecrets["Azure"] as JsonObject; 146Assert.NotNull(azureSettings["ResourceGroup"]);
DefaultUserSecretsManagerTests.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());
ProvisioningContextTests.cs (2)
158Assert.Equal("value", context.UserSecrets["test"]?.ToString()); 212Assert.Equal("test-id", loaded["Azure"]?["SubscriptionId"]?.ToString());
Aspire.Hosting.Redis.Tests (5)
RedisFunctionalTests.cs (5)
562var agreements = jo["agreements"]; 565Assert.False(agreements["analytics"]!.GetValue<bool>()); 566Assert.False(agreements["notifications"]!.GetValue<bool>()); 567Assert.False(agreements["encryption"]!.GetValue<bool>()); 568Assert.True(agreements["eula"]!.GetValue<bool>());
Aspire.Hosting.Tests (4)
KestrelConfigTests.cs (1)
304Assert.Equal(expectedEnv, manifest["env"]!.ToString());
Utils\ManifestUtils.cs (2)
34var resourceNode = obj[resource.Name]; 56var resourceNode = obj[r.Name];
WithEndpointTests.cs (1)
549Assert.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.Http.Extensions.Tests (4)
RequestDelegateFactoryTests.cs (2)
1390Assert.NotNull(deserializedResponseBody["$type"]); 1391Assert.Equal(nameof(JsonTodoChild), deserializedResponseBody["$type"]!.GetValue<string>());
RequestDelegateGenerator\RequestDelegateCreationTests.Responses.cs (2)
679Assert.NotNull(node["$type"]); 680Assert.Equal(nameof(JsonTodoChild), node["$type"]!.GetValue<string>());
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 (7)
Extensions\JsonNodeSchemaExtensions.cs (7)
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); 216if (underlyingType != null && MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && 360&& MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && 463&& MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes 481if (MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes &&
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
OperationTests.MinimalApis.cs (1)
269Assert.Equal("johndoe", userExample["username"].GetValue<string>());
Microsoft.AspNetCore.OpenApi.Tests (4)
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>());
Microsoft.Extensions.AI.Abstractions (3)
Utilities\AIJsonUtilities.Schema.Create.cs (3)
423if (obj[TypePropertyName] is JsonNode typeNode && typeNode.GetValueKind() is JsonValueKind.String && typeNode.GetValue<string>() is "string") 436if (obj[TypePropertyName] is JsonNode typeNode && typeNode.GetValueKind() is JsonValueKind.String && typeNode.GetValue<string>() is "string") 634if (ctx.TypeInfo.NumberHandling is not JsonNumberHandling.Strict && schema["type"] is JsonArray typeArray)
Microsoft.Extensions.AI.Abstractions.Tests (1)
Utilities\AIJsonUtilitiesTests.cs (1)
1281Assert.Equal(((JsonArray)schemaObj["required"]!).Count, ((JsonObject)props!).Count);
Microsoft.Extensions.AI.OpenAI (2)
OpenAIClientExtensions.cs (2)
73if (schemaObj[propName] is { } propNode) 82schemaObj["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(); 233var categories = jsonDocument!.Root["categories"]!.AsObject(); 258var properties = jsonDocument!.Root["properties"]!.AsObject()
ServiceBus.AppHost (1)
Program.cs (1)
36document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };
Shared.Tests (2)
JsonSchemaExporter\JsonSchemaExporterTests.cs (2)
61JsonValue type = Assert.IsAssignableFrom<JsonValue>(schema["type"]); 77JsonValue value = Assert.IsAssignableFrom<JsonValue>(schema["type"]);