367 instantiations of TextContent
DotNetInvocationHostedAgent (1)
Microsoft.Extensions.AI (2)
Microsoft.Extensions.AI.Abstractions (7)
Microsoft.Extensions.AI.Abstractions.Tests (69)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (10)
767new() { Contents = [new TextContent("D") { Annotations = [new()] }] },
768new() { Contents = [new TextContent("E") { Annotations = [new()] }] },
769new() { Contents = [new TextContent("F") { Annotations = [new()] }] },
770new() { Contents = [new TextContent("G") { Annotations = [] }] },
771new() { Contents = [new TextContent("H") { Annotations = [] }] },
772new() { Contents = [new TextContent("I") { Annotations = [new()] }] },
773new() { Contents = [new TextContent("J") { Annotations = [new()] }] },
775new() { Contents = [new TextContent("L") { Annotations = [new()] }] },
778new() { Contents = [new TextContent("O") { Annotations = [new()] }] },
779new() { Contents = [new TextContent("P") { Annotations = [new()] }] },
Microsoft.Extensions.AI.Evaluation (1)
Microsoft.Extensions.AI.Evaluation.Integration.Tests (6)
Microsoft.Extensions.AI.Evaluation.NLP (2)
Microsoft.Extensions.AI.Evaluation.Quality (4)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (9)
Microsoft.Extensions.AI.Integration.Tests (4)
Microsoft.Extensions.AI.OpenAI (13)
Microsoft.Extensions.AI.OpenAI.Tests (30)
OpenAIConversionTests.cs (13)
730new TextContent("Hi there!"),
799new TextContent("Hi there!"),
850new TextContent("Hello, "),
853new TextContent("World"),
854new TextContent("!"),
858new TextContent("Hi!"),
1219new TextContent("I'll call a function."),
1490var mcpToolResult = new McpServerToolResultContent("call_123") { Outputs = isError ? [new ErrorContent("error")] : [new TextContent("sunny")] };
1521new TextContent("Here's an image and some text."),
1590new TextContent("I'll process this complex data."),
1845new TextContent("Processing your request..."),
2086new TextContent("Third message with function call"),
2121new TextContent("I'll call a function"),
Microsoft.Extensions.AI.Stabilization.Tests (7)
Microsoft.Extensions.AI.Tests (55)
ChatCompletion\FunctionInvokingChatClientTests.cs (5)
984new ChatMessage(ChatRole.Assistant, [new TextContent("extra"), new FunctionCallContent("callId1", "Func1"), new TextContent("stuff")]),
988new ChatMessage(ChatRole.Assistant, [new FunctionCallContent("callId3", "VoidReturn", arguments: new Dictionary<string, object?> { { "i", 43 } }), new TextContent("more")]),
1198updates = [new() { Contents = [new TextContent("OK bye")] }];
1362? [new TextContent($"The search results were '{string.Join(", ", frcs.Select(frc => frc.Result))}'")]
Functions\AIFunctionFactoryTest.cs (18)
1162AIFunctionFactory.Create(() => (AIContent)new TextContent("text")),
1163AIFunctionFactory.Create(async () => (AIContent)new TextContent("text")),
1164AIFunctionFactory.Create(async ValueTask<AIContent> () => (AIContent)new TextContent("text")),
1165AIFunctionFactory.Create(() => new TextContent("text")),
1166AIFunctionFactory.Create(async () => new TextContent("text")),
1167AIFunctionFactory.Create(async ValueTask<AIContent> () => new TextContent("text")),
1179AIFunctionFactory.Create(() => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1180AIFunctionFactory.Create(async () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1181AIFunctionFactory.Create(async ValueTask<IEnumerable<AIContent>> () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1186AIFunctionFactory.Create(() => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1187AIFunctionFactory.Create(async () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1188AIFunctionFactory.Create(async ValueTask<AIContent[]> () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1193AIFunctionFactory.Create(() => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1194AIFunctionFactory.Create(async () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1195AIFunctionFactory.Create(async ValueTask<List<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1200AIFunctionFactory.Create(() => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1201AIFunctionFactory.Create(async () => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
1202AIFunctionFactory.Create(async ValueTask<IList<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
Microsoft.Extensions.DataIngestion (1)
Microsoft.Extensions.DocumentExtraction.Abstractions.Tests (10)
Microsoft.Extensions.DocumentExtraction.Tests (4)
Microsoft.Extensions.Documents.Abstractions.Tests (142)
DocumentTableElementTests.cs (18)
17ExtractionDocumentTextElement leaf = new(new TextContent("L|R"));
34ExtractionDocumentTextElement text = new(new TextContent("A|<&"));
62ExtractionDocumentTableCell wide = new(new ExtractionDocumentTextElement(new TextContent("wide")), 2, 3);
63ExtractionDocumentTableCell corner = new(new ExtractionDocumentTextElement(new TextContent("corner")), role: "rowHeader");
73ExtractionDocumentTableCell small = new(new ExtractionDocumentTextElement(new TextContent("small")));
103ExtractionDocumentTableElement table = new(new TextContent("stored table"), 2, 3);
128ExtractionDocumentTableElement table = new(new TextContent("stored table"), rowCount, columnCount);
144ExtractionDocumentTextElement text = new(new TextContent("candidate"));
167table.Cells[0, 1] = new ExtractionDocumentTableCell(new ExtractionDocumentTextElement(new TextContent("one")));
168table.Cells[1, 0] = new ExtractionDocumentTableCell(new ExtractionDocumentTextElement(new TextContent("two")));
183table.Cells[0, 0] = new ExtractionDocumentTableCell(new ExtractionDocumentTextElement(new TextContent("left|right")));
192table.Cells[0, 0] = new ExtractionDocumentTableCell(new ExtractionDocumentTextElement(new TextContent("semantic cell")));
202ExtractionDocumentTableCell anchor = new(new ExtractionDocumentTextElement(new TextContent("MERGED_A<&")), 2, 2, "columnHeader");
204table.Cells[2, 0] = new ExtractionDocumentTableCell(new ExtractionDocumentTextElement(new TextContent("B")), role: "rowHeader");
235ExtractionDocumentTextElement text = new(new TextContent(" INV0ICE 1O0? <&| "), role: "heading");
259ExtractionDocumentTextElement text = new(new TextContent("A|<"));
307ExtractionDocumentTextElement text = new(new TextContent("INV0ICE 1O0?"));
389ExtractionDocumentTextElement text = new(new TextContent("mapped A"));
DocumentTextElementTests.cs (9)
16ExtractionDocumentTextElement element = new(new TextContent("stored markdown"), role: "pageFooter");
34ExtractionDocumentTextElement element = new(new TextContent("**citation** [1]"), role: role);
57Assert.Throws<ArgumentException>(nameof(role), () => new ExtractionDocumentTextElement(new TextContent("markdown"), role: role));
63ExtractionDocumentTextElement heading = new(new TextContent("Title"), role: "heading") { HeadingLevel = 1 };
64ExtractionDocumentTextElement pageHeader = new(new TextContent("Title"), role: "pageHeader");
65ExtractionDocumentTextElement custom = new(new TextContent("ordinary **text**"), role: "VendorHeading") { HeadingLevel = 10 };
91ExtractionDocumentTextElement element = new(new TextContent("header"), role: "heading")
105ExtractionDocumentTextElement element = new(new TextContent("header"), role: "heading")
119ExtractionDocumentTextElement element = new(new TextContent("header"), role: "heading")
326 references to TextContent
Microsoft.AspNetCore.Components.AI (3)
Microsoft.Extensions.AI (3)
Microsoft.Extensions.AI.Abstractions (24)
Microsoft.Extensions.AI.Abstractions.Tests (84)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (20)
674TextContent[] contents = message.Contents.OfType<TextContent>().ToArray();
710Assert.Equal("ABC", Assert.IsType<TextContent>(message.Contents[0]).Text);
712Assert.Equal("GH", Assert.IsType<TextContent>(message.Contents[2]).Text);
714Assert.Equal("K", Assert.IsType<TextContent>(message.Contents[4]).Text);
716Assert.Equal("MN", Assert.IsType<TextContent>(message.Contents[6]).Text);
785Assert.Equal("ABC", Assert.IsType<TextContent>(message.Contents[0]).Text);
786Assert.Equal("D", Assert.IsType<TextContent>(message.Contents[1]).Text);
787Assert.Equal("E", Assert.IsType<TextContent>(message.Contents[2]).Text);
788Assert.Equal("F", Assert.IsType<TextContent>(message.Contents[3]).Text);
789Assert.Equal("GH", Assert.IsType<TextContent>(message.Contents[4]).Text);
790Assert.Equal("I", Assert.IsType<TextContent>(message.Contents[5]).Text);
791Assert.Equal("J", Assert.IsType<TextContent>(message.Contents[6]).Text);
792Assert.Equal("K", Assert.IsType<TextContent>(message.Contents[7]).Text);
793Assert.Equal("L", Assert.IsType<TextContent>(message.Contents[8]).Text);
794Assert.Equal("MN", Assert.IsType<TextContent>(message.Contents[9]).Text);
795Assert.Equal("O", Assert.IsType<TextContent>(message.Contents[10]).Text);
796Assert.Equal("P", Assert.IsType<TextContent>(message.Contents[11]).Text);
816Assert.Equal("Hello, world!", Assert.IsType<TextContent>(Assert.Single(Assert.Single(response.Messages).Contents)).Text);
957Assert.IsType<TextContent>(message.Contents[0]).Text);
Microsoft.Extensions.AI.Evaluation (11)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (10)
Microsoft.Extensions.AI.Evaluation.Safety (6)
Microsoft.Extensions.AI.Integration.Tests (8)
Microsoft.Extensions.AI.OpenAI (9)
Microsoft.Extensions.AI.OpenAI.Tests (31)
Microsoft.Extensions.AI.Stabilization.Tests (11)
Microsoft.Extensions.AI.Tests (11)
Microsoft.Extensions.DocumentExtraction.Abstractions.Tests (15)
Microsoft.Extensions.DocumentExtraction.Tests (4)
Microsoft.Extensions.Documents.Abstractions (3)
Microsoft.Extensions.Documents.Abstractions.Tests (93)
DocumentElementTests.cs (12)
22Assert.Equal("semantic paragraph", Assert.IsType<TextContent>(Assert.Single(section.Elements).Content).Text);
30Assert.Equal("stored markdown", Assert.IsType<TextContent>(element.Content).Text);
34Assert.Equal("updated markdown", Assert.IsType<TextContent>(element.Content).Text);
171Assert.Equal("", Assert.IsType<TextContent>(element.Content).Text);
214Assert.Equal("visible", Assert.IsType<TextContent>(text.Content).Text);
225Assert.Equal("", Assert.IsType<TextContent>(text.Content).Text);
229Assert.Equal("", Assert.IsType<TextContent>(text.Content).Text);
258Assert.DoesNotContain(native.Marker, Assert.IsType<TextContent>(text.Content).Text, StringComparison.Ordinal);
259Assert.DoesNotContain("RAW_BODY_ONLY_91", Assert.IsType<TextContent>(text.Content).Text, StringComparison.Ordinal);
262Assert.Equal("", Assert.IsType<TextContent>(image.Content).Text);
263Assert.Equal("visible **text**", Assert.IsType<TextContent>(text.Content).Text);
265Assert.Equal("extension", Assert.IsType<TextContent>(extension.Content).Text);
DocumentTableElementTests.cs (15)
28Assert.Equal("L|R", Assert.IsType<TextContent>(leaf.Content).Text);
48Assert.Equal("A|<&", Assert.IsType<TextContent>(text.Content).Text);
105Assert.Equal("stored table", Assert.IsType<TextContent>(table.Content).Text);
133Assert.Equal("stored table", Assert.IsType<TextContent>(table.Content).Text);
175Assert.Equal("one", Assert.IsType<TextContent>(table.Cells[0, 1]!.Content!.Content).Text);
176Assert.Equal("two", Assert.IsType<TextContent>(table.Cells[1, 0]!.Content!.Content).Text);
185Assert.Equal("left|right", Assert.IsType<TextContent>(table.Cells[0, 0]!.Content!.Content).Text);
195Assert.Equal("semantic cell", Assert.IsType<TextContent>(table.Cells[0, 0]!.Content!.Content).Text);
211Assert.Equal("MERGED_A<&", Assert.IsType<TextContent>(anchor.Content!.Content).Text);
243Assert.Equal(" INV0ICE 1O0? <&| ", Assert.IsType<TextContent>(text.Content).Text);
244Assert.Equal(" INV0ICE 1O0? <&| ", Assert.IsType<TextContent>(text.Content).Text);
272Assert.Equal("A|<", Assert.IsType<TextContent>(text.Content).Text);
323Assert.Equal("INV0ICE 1O0?", Assert.IsType<TextContent>(text.Content).Text);
410Assert.Equal("mapped A", Assert.IsType<TextContent>(text.Content).Text);
411Assert.Equal("mapped A", Assert.IsType<TextContent>(text.Content).Text);
DocumentTests.StandardContent.cs (30)
20TextContent payload = new(markdown);
24Assert.Same(markdown, Assert.IsType<TextContent>(document.Content).Text);
26Assert.Equal("**changed**", Assert.IsType<TextContent>(document.Content).Text);
38Assert.Same(markdown, Assert.IsType<TextContent>(section.Content).Text);
48TextContent payload = new(markdown);
66Assert.Equal("updated", Assert.IsType<TextContent>(text.Content).Text);
72TextContent first = new("**first**");
81document.EnumerateContent().Select(element => Assert.IsType<TextContent>(element.Content).Text));
84document.EnumerateContent().Select(element => Assert.IsType<TextContent>(element.Content).Text));
95Assert.Equal("", Assert.IsType<TextContent>(document.Content).Text);
96Assert.Equal("", Assert.IsType<TextContent>(section.Content).Text);
99Assert.Equal("", Assert.IsType<TextContent>(section.Content).Text);
102Assert.Equal("child", Assert.IsType<TextContent>(Assert.Single(document.EnumerateContent()).Content).Text);
116Assert.Equal("first", Assert.IsType<TextContent>(section.Elements[0].Content).Text);
129Assert.Equal("custom|value", Assert.IsType<TextContent>(custom.Content).Text);
139Assert.Equal("cell|value", Assert.IsType<TextContent>(cellContent.Content).Text);
146TextContent payload = new(markdown);
157Assert.Equal("**OCR**", Assert.IsType<TextContent>(text.Content).Text);
175Assert.Equal("root introduction", Assert.IsType<TextContent>(document.Content).Text);
176Assert.Equal("section introduction", Assert.IsType<TextContent>(section.Content).Text);
180Assert.Equal("leaf|value", Assert.IsType<TextContent>(cellText.Content).Text);
183Assert.Equal("edited", Assert.IsType<TextContent>(table.Cells[0, 0]!.Content!.Content).Text);
184Assert.Equal("edited", Assert.IsType<TextContent>(cellText.Content).Text);
185Assert.Equal("table caption", Assert.IsType<TextContent>(table.Content).Text);
236TextContent payload = new("first");
245Assert.Equal("second", Assert.IsType<TextContent>(text.Content).Text);
249Assert.Equal("second", Assert.IsType<TextContent>(text.Content).Text);
390TextContent shared = new("same|payload");
418Assert.Equal("changed", Assert.IsType<TextContent>(first.Content).Text);
419Assert.Equal("changed", Assert.IsType<TextContent>(second.Content).Text);