1 type derived from DerivedAIContent
Microsoft.Extensions.AI.Abstractions.Tests (1)
Utilities\AIJsonUtilitiesTests.cs (1)
1915
private class LeafContent :
DerivedAIContent
4 instantiations of DerivedAIContent
Microsoft.Extensions.AI.Abstractions.Tests (4)
Utilities\AIJsonUtilitiesTests.cs (4)
1240
AIContent c = new
DerivedAIContent
{ DerivedValue = 42 };
1281
AIContent c = new
DerivedAIContent
();
1414
AIContent ac = new
DerivedAIContent
{ DerivedValue = 1 };
1466
AIContent unregistered = new
DerivedAIContent
{ DerivedValue = 99 };
22 references to DerivedAIContent
Microsoft.Extensions.AI.Abstractions.Tests (22)
Utilities\AIJsonUtilitiesTests.cs (22)
1238
options.AddAIContentType<
DerivedAIContent
>("derivativeContent");
1245
Assert.IsType<
DerivedAIContent
>(deserialized);
1251
Assert.Throws<InvalidOperationException>(() => AIJsonUtilities.DefaultOptions.AddAIContentType<
DerivedAIContent
>("derivativeContent"));
1278
options.AddAIContentType<
DerivedAIContent
>("text");
1279
options.AddAIContentType<
DerivedAIContent
>("audio");
1289
Assert.Throws<ArgumentNullException>("options", () => ((JsonSerializerOptions)null!).AddAIContentType<
DerivedAIContent
>("discriminator"));
1290
Assert.Throws<ArgumentNullException>("options", () => ((JsonSerializerOptions)null!).AddAIContentType(typeof(
DerivedAIContent
), "discriminator"));
1291
Assert.Throws<ArgumentNullException>("typeDiscriminatorId", () => options.AddAIContentType<
DerivedAIContent
>(null!));
1292
Assert.Throws<ArgumentNullException>("typeDiscriminatorId", () => options.AddAIContentType(typeof(
DerivedAIContent
), null!));
1316
var derivedAIContentTypes = options.GetTypeInfo(typeof(
DerivedAIContent
)).PolymorphismOptions!.DerivedTypes;
1322
DerivedAIContent
dc = new LeafContent { DerivedValue = 1, LeafValue = 42 };
1328
LeafContent deserializedDc = Assert.IsType<LeafContent>(JsonSerializer.Deserialize<
DerivedAIContent
>(json, options));
1403
options.AddAIContentType<
DerivedAIContent
>("derived");
1408
var derivedAIContentTypes = options.GetTypeInfo(typeof(
DerivedAIContent
)).PolymorphismOptions!.DerivedTypes;
1409
Assert.Contains(aiContentDerivedTypes, dt => dt.DerivedType == typeof(
DerivedAIContent
));
1417
DerivedAIContent
deserializedDc = Assert.IsType<
DerivedAIContent
>(JsonSerializer.Deserialize<AIContent>(json, options));
1421
DerivedAIContent
dc = new LeafContent { DerivedValue = 2, LeafValue = 42 };
1424
LeafContent deserializedLeaf = Assert.IsType<LeafContent>(JsonSerializer.Deserialize<
DerivedAIContent
>(json2, options));
1454
var derivedAIContentTypes = options.GetTypeInfo(typeof(
DerivedAIContent
)).PolymorphismOptions!.DerivedTypes;
1456
Assert.DoesNotContain(aiContentDerivedTypes, dt => dt.DerivedType == typeof(
DerivedAIContent
));
1942
[JsonSerializable(typeof(
DerivedAIContent
))]