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