220 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 (10)
Provisioning\BicepUtilities.cs (2)
44parameters[parameter.Key] = new JsonObject() 71scope["resourceGroup"] = targetScope switch
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 (41)
Passkeys\DefaultPasskeyHandlerAssertionTest.cs (22)
58credentialJson["id"] = JsonNode.Parse(jsonValue); 74credentialJson["id"] = GetInvalidBase64UrlValue(base64UrlCredentialId); 109credentialJson["type"] = JsonNode.Parse(jsonValue); 124credentialJson["type"] = "unexpected-value"; 158credentialJson["response"] = JsonNode.Parse(jsonValue); 191originalOptionsJson["challenge"] = GetInvalidBase64UrlValue(base64UrlChallenge); 210originalOptionsJson["challenge"] = JsonNode.Parse(jsonValue); 496clientDataJson["type"] = JsonNode.Parse(jsonValue); 514clientDataJson["type"] = value; 548clientDataJson["challenge"] = JsonNode.Parse(jsonValue); 563clientDataJson["challenge"] = ""; 579clientDataJson["challenge"] = GetInvalidBase64UrlValue(base64UrlChallenge); 601clientDataJson["challenge"] = Base64Url.EncodeToString(modifiedChallenge); 635clientDataJson["origin"] = JsonNode.Parse(jsonValue); 650clientDataJson["origin"] = ""; 672clientDataJson["origin"] = returnedOrigin; 689clientDataJson["tokenBinding"] = JsonNode.Parse(jsonValue); 704clientDataJson["tokenBinding"] = JsonNode.Parse("{}"); 720clientDataJson["tokenBinding"] = JsonNode.Parse(""" 739optionsJson["userVerification"] = "required"; 757optionsJson["userVerification"] = "discouraged"; 775optionsJson["userVerification"] = "required";
Passkeys\DefaultPasskeyHandlerAttestationTest.cs (19)
58credentialJson["id"] = JsonNode.Parse(jsonValue); 74credentialJson["id"] = GetInvalidBase64UrlValue(base64UrlCredentialId); 109credentialJson["type"] = JsonNode.Parse(jsonValue); 124credentialJson["type"] = "unexpected-value"; 158credentialJson["response"] = JsonNode.Parse(jsonValue); 381originalOptionsJson["challenge"] = GetInvalidBase64UrlValue(base64UrlChallenge); 400originalOptionsJson["challenge"] = JsonNode.Parse(jsonValue); 534clientDataJson["type"] = JsonNode.Parse(jsonValue); 552clientDataJson["type"] = value; 586clientDataJson["challenge"] = JsonNode.Parse(jsonValue); 601clientDataJson["challenge"] = ""; 617clientDataJson["challenge"] = GetInvalidBase64UrlValue(base64UrlChallenge); 639clientDataJson["challenge"] = Base64Url.EncodeToString(modifiedChallenge); 673clientDataJson["origin"] = JsonNode.Parse(jsonValue); 688clientDataJson["origin"] = ""; 710clientDataJson["origin"] = returnedOrigin; 727clientDataJson["tokenBinding"] = JsonNode.Parse(jsonValue); 742clientDataJson["tokenBinding"] = JsonNode.Parse("{}"); 758clientDataJson["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"; 104schema[OpenApiSchemaKeywords.MinimumKeyword] = minDecimal; 108schema[OpenApiSchemaKeywords.MaximumKeyword] = maxDecimal; 113schema[OpenApiSchemaKeywords.PatternKeyword] = regularExpressionAttribute.Pattern; 119schema[key] = maxLengthAttribute.Length; 125schema[key] = minLengthAttribute.Length; 131schema[$"min{targetKeySuffix}"] = lengthAttribute.MinimumLength; 132schema[$"max{targetKeySuffix}"] = lengthAttribute.MaximumLength; 136schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 137schema[OpenApiSchemaKeywords.FormatKeyword] = "uri"; 141schema[OpenApiSchemaKeywords.MinLengthKeyword] = stringLengthAttribute.MinimumLength; 142schema[OpenApiSchemaKeywords.MaxLengthKeyword] = stringLengthAttribute.MaximumLength; 162schema[OpenApiSchemaKeywords.DefaultKeyword] = null; 166schema[OpenApiSchemaKeywords.DefaultKeyword] = JsonSerializer.SerializeToNode(defaultValue, jsonTypeInfo); 199schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes | JsonSchemaType.Null).ToString(); 201schema[OpenApiSchemaKeywords.FormatKeyword] = openApiSchema.Format; 202schema[OpenApiConstants.SchemaId] = createSchemaReferenceId(context.TypeInfo); 219schema[OpenApiSchemaKeywords.MinimumKeyword] = minRouteConstraint.Min; 223schema[OpenApiSchemaKeywords.MaximumKeyword] = maxRouteConstraint.Max; 227schema[OpenApiSchemaKeywords.MinLengthKeyword] = minLengthRouteConstraint.MinLength; 231schema[OpenApiSchemaKeywords.MaxLengthKeyword] = maxLengthRouteConstraint.MaxLength; 235schema[OpenApiSchemaKeywords.MinimumKeyword] = rangeRouteConstraint.Min; 236schema[OpenApiSchemaKeywords.MaximumKeyword] = rangeRouteConstraint.Max; 240schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 241schema[OpenApiSchemaKeywords.FormatKeyword] = null; 242schema[OpenApiSchemaKeywords.PatternKeyword] = regexRouteConstraint.Constraint.ToString(); 246schema[OpenApiSchemaKeywords.MinLengthKeyword] = lengthRouteConstraint.MinLength; 247schema[OpenApiSchemaKeywords.MaxLengthKeyword] = lengthRouteConstraint.MaxLength; 251schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Number.ToString(); 252schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is FloatRouteConstraint ? "float" : "double"; 256schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Integer.ToString(); 257schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is LongRouteConstraint ? "int64" : "int32"; 261schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 262schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is GuidRouteConstraint ? "uuid" : null; 266schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.Boolean.ToString(); 267schema[OpenApiSchemaKeywords.FormatKeyword] = null; 271schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 272schema[OpenApiSchemaKeywords.FormatKeyword] = null; 276schema[OpenApiSchemaKeywords.TypeKeyword] = JsonSchemaType.String.ToString(); 277schema[OpenApiSchemaKeywords.FormatKeyword] = "date-time"; 343schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes & ~JsonSchemaType.Null).ToString(); 388mappings[$"{discriminator}"] = $"{createSchemaReferenceId(context.TypeInfo)}{createSchemaReferenceId(jsonDerivedType)}"; 391schema[OpenApiSchemaKeywords.DiscriminatorKeyword] = polymorphismOptions.TypeDiscriminatorPropertyName; 392schema[OpenApiSchemaKeywords.DiscriminatorMappingKeyword] = mappings; 406schema[OpenApiConstants.SchemaId] = schemaReferenceId; 412schema[OpenApiConstants.SchemaId] = "Base"; 446schema[OpenApiSchemaKeywords.TypeKeyword] = (schemaTypes | JsonSchemaType.Null).ToString(); 464schema[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 (41)
Utilities\AIJsonUtilities.Schema.Create.cs (32)
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; 307obj[TypePropertyName] = numericType; 389obj[MinLengthStringPropertyName] ??= stringLengthAttribute.MinimumLength; 392obj[MaxLengthStringPropertyName] ??= stringLengthAttribute.MaximumLength; 400obj[MinLengthStringPropertyName] ??= minLengthAttribute.Length; 404obj[MinLengthCollectionPropertyName] ??= minLengthAttribute.Length; 413obj[MaxLengthStringPropertyName] ??= maxLengthAttribute.Length; 417obj[MaxLengthCollectionPropertyName] ??= maxLengthAttribute.Length; 466obj[MinExclusiveRangePropertyName] ??= minNode; 471obj[MinRangePropertyName] ??= minNode; 480obj[MaxExclusiveRangePropertyName] ??= maxNode; 485obj[MaxRangePropertyName] ??= maxNode; 505obj[MinLengthStringPropertyName] ??= lengthAttribute.MinimumLength; 508obj[MaxLengthStringPropertyName] ??= lengthAttribute.MaximumLength; 514obj[MinLengthCollectionPropertyName] ??= lengthAttribute.MinimumLength; 517obj[MaxLengthCollectionPropertyName] ??= lengthAttribute.MaximumLength; 528obj[EnumPropertyName] = enumArray; 542(JsonObject)(obj[NotPropertyName] = new JsonObject()); 548notObj[EnumPropertyName] = enumArray; 574obj[FormatPropertyName] ??= "date-time"; 578obj[FormatPropertyName] ??= "date"; 582obj[FormatPropertyName] ??= "time"; 586obj[FormatPropertyName] ??= "email"; 590obj[FormatPropertyName] ??= "uri"; 594obj[FormatPropertyName] ??= "uri"; 595obj[ContentMediaTypePropertyName] ??= "image/*";
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)
86schemaObj["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);
MSBuild (18)
JsonOutputFormatter.cs (17)
40propertiesNode[property] = getProperty(property); 43_topLevelNode["Properties"] = propertiesNode; 62jsonItem["Identity"] = item.GetMetadataValue("Identity"); 70jsonItem[metadatumName] = item.GetMetadataValue(metadatumName); 76itemsNode[itemName] = itemArray; 79_topLevelNode["Items"] = itemsNode; 98jsonItem["Identity"] = item.GetMetadataValue("Identity"); 101jsonItem[metadatum.Name] = metadatum.EvaluatedValue; 111jsonItem[metadatumName] = item.GetMetadataValue(metadatumName); 117itemsNode[itemName] = itemArray; 120_topLevelNode["Items"] = itemsNode; 137targetResults["Result"] = targetResult.ResultCode.ToString(); 142jsonItem["Identity"] = item.GetMetadata("Identity"); 150jsonItem[metadatumName] = item.GetMetadata(metadatumName); 156targetResults["Items"] = outputArray; 157targetResultsNode[targetName] = targetResults; 160_topLevelNode["TargetResults"] = targetResultsNode;
XMake.cs (1)
4735jsonNode[featureName] = Features.CheckFeatureAvailability(featureName).ToString();
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;
233 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)
48Assert.Equal("bar", settings["foo"]?.ToString()); 71Assert.True(settings["foo"] is JsonObject); 72var fooObject = settings["foo"]!.AsObject(); 73Assert.Equal("baz", fooObject["bar"]?.ToString()); 97Assert.True(settings["foo"] is JsonObject); 98var fooObject = settings["foo"]!.AsObject(); 99Assert.True(fooObject["bar"] is JsonObject); 100var barObject = fooObject["bar"]!.AsObject(); 101Assert.Equal("hello", barObject["baz"]?.ToString()); 129Assert.True(settings["foo"] is JsonObject); 130var fooObject = settings["foo"]!.AsObject(); 131Assert.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 (49)
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)
133var azureSettings = userSecrets["Azure"] as JsonObject; 135Assert.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 (1)
158Assert.Equal("value", context.UserSecrets["test"]?.ToString());
Aspire.Hosting.Redis.Tests (5)
RedisFunctionalTests.cs (5)
563var agreements = jo["agreements"]; 566Assert.False(agreements["analytics"]!.GetValue<bool>()); 567Assert.False(agreements["notifications"]!.GetValue<bool>()); 568Assert.False(agreements["encryption"]!.GetValue<bool>()); 569Assert.True(agreements["eula"]!.GetValue<bool>());
Aspire.Hosting.Tests (4)
KestrelConfigTests.cs (1)
305Assert.Equal(expectedEnv, manifest["env"]!.ToString());
Utils\ManifestUtils.cs (2)
35var resourceNode = obj[resource.Name]; 57var resourceNode = obj[r.Name];
WithEndpointTests.cs (1)
550Assert.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 (54)
Passkeys\DefaultPasskeyHandlerAssertionTest.cs (19)
73var base64UrlCredentialId = (string)credentialJson["id"]!; 190var base64UrlChallenge = (string)originalOptionsJson["challenge"]!; 225var response = credentialJson["response"]!.AsObject(); 245credentialJson["response"]!["clientDataJSON"] = JsonNode.Parse(jsonValue); 260credentialJson["response"]!["clientDataJSON"] = ""; 275var response = credentialJson["response"]!.AsObject(); 295credentialJson["response"]!["authenticatorData"] = JsonNode.Parse(jsonValue); 310var base64UrlAuthenticatorData = (string)credentialJson["response"]!["authenticatorData"]!; 311credentialJson["response"]!["authenticatorData"] = GetInvalidBase64UrlValue(base64UrlAuthenticatorData); 327credentialJson["response"]!["authenticatorData"] = ""; 342var response = credentialJson["response"]!.AsObject(); 362credentialJson["response"]!["signature"] = JsonNode.Parse(jsonValue); 377var base64UrlSignature = (string)credentialJson["response"]!["signature"]!; 378credentialJson["response"]!["signature"] = GetInvalidBase64UrlValue(base64UrlSignature); 394credentialJson["response"]!["signature"] = ""; 428credentialJson["response"]!["userHandle"] = JsonNode.Parse(jsonValue); 443credentialJson["response"]!["userHandle"] = null; 462credentialJson["response"]!["userHandle"] = Base64Url.EncodeToString(Encoding.UTF8.GetBytes(newUserId)); 578var base64UrlChallenge = (string)clientDataJson["challenge"]!;
Passkeys\DefaultPasskeyHandlerAttestationTest.cs (19)
73var base64UrlCredentialId = (string)credentialJson["id"]!; 173var rp = originalOptionsJson["rp"]!.AsObject(); 193originalOptionsJson["rp"]!["name"] = JsonNode.Parse(jsonValue); 224var user = originalOptionsJson["user"]!.AsObject(); 241var base64UrlUserId = (string)originalOptionsJson["user"]!["id"]!; 242originalOptionsJson["user"]!["id"] = GetInvalidBase64UrlValue(base64UrlUserId); 261originalOptionsJson["user"]!["id"] = JsonNode.Parse(jsonValue); 276var user = originalOptionsJson["user"]!.AsObject(); 296originalOptionsJson["user"]!["name"] = JsonNode.Parse(jsonValue); 311var user = originalOptionsJson["user"]!.AsObject(); 331originalOptionsJson["user"]!["displayName"] = JsonNode.Parse(jsonValue); 380var base64UrlChallenge = (string)originalOptionsJson["challenge"]!; 415var response = credentialJson["response"]!.AsObject(); 435credentialJson["response"]!["clientDataJSON"] = JsonNode.Parse(jsonValue); 450credentialJson["response"]!["clientDataJSON"] = ""; 465var response = credentialJson["response"]!.AsObject(); 485credentialJson["response"]!["attestationObject"] = JsonNode.Parse(jsonValue); 500credentialJson["response"]!["attestationObject"] = ""; 616var base64UrlChallenge = (string)clientDataJson["challenge"]!;
SignInManagerTest.cs (16)
1421var challenge = Base64Url.DecodeFromChars(optionsJson["challenge"].ToString()); 1426Assert.Equal(identityOptions.Passkey.ServerDomain, optionsJson["rp"]["id"].ToString()); 1427Assert.Equal(identityOptions.Passkey.ServerDomain, optionsJson["rp"]["name"].ToString()); 1429Assert.Equal((uint)identityOptions.Passkey.Timeout.TotalMilliseconds, (uint)optionsJson["timeout"]); 1430Assert.Equal(creationArgs.Attestation, optionsJson["attestation"].ToString()); 1433optionsJson["authenticatorSelection"]["authenticatorAttachment"].ToString()); 1436optionsJson["authenticatorSelection"]["residentKey"].ToString()); 1439optionsJson["authenticatorSelection"]["userVerification"].ToString()); 1440Assert.True((bool)optionsJson["extensions"]["my.bool.extension"]); 1441Assert.Equal("value", optionsJson["extensions"]["my.object.extension"]["key"].ToString()); 1477var challenge = Base64Url.DecodeFromChars(optionsJson["challenge"].ToString()); 1481Assert.Equal(identityOptions.Passkey.ServerDomain, optionsJson["rpId"].ToString()); 1483Assert.Equal((uint)identityOptions.Passkey.Timeout.TotalMilliseconds, (uint)optionsJson["timeout"]); 1484Assert.Equal(requestArgs.UserVerification, optionsJson["userVerification"].ToString()); 1485Assert.True((bool)optionsJson["extensions"]["my.bool.extension"]); 1486Assert.Equal("value", optionsJson["extensions"]["my.object.extension"]["key"].ToString());
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)
117var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 123var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 129var isArray = MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && schemaTypes.HasFlag(JsonSchemaType.Array); 196if (underlyingType != null && MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && 340&& MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes && 443&& MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes 461if (MapJsonNodeToSchemaType(schema[OpenApiSchemaKeywords.TypeKeyword]) is { } schemaTypes &&
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
OperationTests.MinimalApis.cs (1)
269Assert.Equal("johndoe", userExample["username"].GetValue<string>());
Microsoft.Extensions.AI.Abstractions (6)
Utilities\AIJsonUtilities.Schema.Create.cs (6)
398if (obj[TypePropertyName] is JsonNode typeNode && typeNode.GetValueKind() is JsonValueKind.String && typeNode.GetValue<string>() is "string") 411if (obj[TypePropertyName] is JsonNode typeNode && typeNode.GetValueKind() is JsonValueKind.String && typeNode.GetValue<string>() is "string") 501if (obj[TypePropertyName] is JsonNode typeNode && typeNode.GetValueKind() is JsonValueKind.String && typeNode.GetValue<string>() is "string") 537JsonNode? notNode = obj[NotPropertyName]; 544if (notObj[EnumPropertyName] is null) 608if (ctx.TypeInfo.NumberHandling is not JsonNumberHandling.Strict && schema["type"] is JsonArray { Count: 2 } typeArray)
Microsoft.Extensions.AI.Abstractions.Tests (1)
Utilities\AIJsonUtilitiesTests.cs (1)
1273Assert.Equal(((JsonArray)schemaObj["required"]!).Count, ((JsonObject)props!).Count);
Microsoft.Extensions.AI.OpenAI (2)
OpenAIClientExtensions.cs (2)
77if (schemaObj[propName] is { } propNode) 86schemaObj["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";
MSBuild (4)
JsonOutputFormatter.cs (4)
35ErrorUtilities.VerifyThrow(_topLevelNode["Properties"] is null, "Should not add multiple lists of properties to the json format."); 53ErrorUtilities.VerifyThrow(_topLevelNode["Items"] is null, "Should not add multiple lists of items to the json format."); 89ErrorUtilities.VerifyThrow(_topLevelNode["Items"] is null, "Should not add multiple lists of items to the json format."); 130ErrorUtilities.VerifyThrow(_topLevelNode["TargetResults"] is null, "Should not add multiple lists of target results to the json format.");
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"]);