5 writes to Contents
Microsoft.Extensions.AI (1)
Microsoft.Extensions.AI.Abstractions (1)
Microsoft.Extensions.AI.Abstractions.Tests (3)
114 references to Contents
Microsoft.Extensions.AI (11)
Microsoft.Extensions.AI.Abstractions (12)
Microsoft.Extensions.AI.Abstractions.Tests (53)
ChatCompletion\ChatMessageTests.cs (43)
19Assert.Empty(message.Contents);
22Assert.NotNull(message.Contents);
23Assert.Same(message.Contents, message.Contents);
24Assert.Empty(message.Contents);
39Assert.Same(message.Contents, message.Contents);
42Assert.Empty(message.Contents);
46Assert.Single(message.Contents);
47TextContent tc = Assert.IsType<TextContent>(message.Contents[0]);
79Assert.Same(message.Contents, message.Contents);
82Assert.Empty(message.Contents);
87Assert.Equal(messageCount, message.Contents.Count);
90TextContent tc = Assert.IsType<TextContent>(message.Contents[i]);
135TextContent textContent = Assert.IsType<TextContent>(message.Contents[3]);
143Assert.Same(textContent, message.Contents[3]);
151Assert.Empty(message.Contents);
156Assert.Single(message.Contents);
157TextContent textContent = Assert.IsType<TextContent>(message.Contents[0]);
170Assert.Equal(3, message.Contents.Count);
174Assert.Equal(4, message.Contents.Count);
178Assert.Equal(4, message.Contents.Count);
180message.Contents.RemoveAt(3);
181Assert.Equal(3, message.Contents.Count);
185Assert.Equal(4, message.Contents.Count);
193Assert.IsType<List<AIContent>>(new ChatMessage().Contents);
200Assert.Empty(message.Contents);
205Assert.Same(contents, message.Contents);
208Assert.Same(contents, message.Contents);
211Assert.NotNull(message.Contents);
212Assert.NotSame(contents, message.Contents);
213Assert.Empty(message.Contents);
309Assert.NotNull(deserializedMessage.Contents);
310Assert.Equal(items.Count, deserializedMessage.Contents.Count);
312var textContent = deserializedMessage.Contents[0] as TextContent;
319var imageContent = deserializedMessage.Contents[1] as ImageContent;
327var dataContent = deserializedMessage.Contents[2] as DataContent;
335var audioContent = deserializedMessage.Contents[3] as AudioContent;
343imageContent = deserializedMessage.Contents[4] as ImageContent;
351textContent = deserializedMessage.Contents[5] as TextContent;
358var functionCallContent = deserializedMessage.Contents[6] as FunctionCallContent;
366var functionResultContent = deserializedMessage.Contents[7] as FunctionResultContent;
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (10)
92Assert.Same(updates[7].Contents[0], Assert.Single(message.Contents));
102Assert.Equal("Hello", completion.Choices[0].Contents[0].ToString());
103Assert.Equal(", ", completion.Choices[0].Contents[1].ToString());
104Assert.Equal("world!", completion.Choices[0].Contents[2].ToString());
106Assert.Equal("Hey", completion.Choices[1].Contents[0].ToString());
107Assert.Equal(", ", completion.Choices[1].Contents[1].ToString());
108Assert.Equal("you!", completion.Choices[1].Contents[2].ToString());
182Assert.Equal(expected.Count + (gapLength * ((numSequences - 1) + (gapBeginningEnd ? 2 : 0))), message.Contents.Count);
184TextContent[] contents = message.Contents.OfType<TextContent>().ToArray();
209Assert.Equal("Hello, world!", Assert.IsType<TextContent>(Assert.Single(completion.Message.Contents)).Text);
Microsoft.Extensions.AI.AzureAIInference (4)
Microsoft.Extensions.AI.AzureAIInference.Tests (2)
Microsoft.Extensions.AI.Integration.Tests (6)
Microsoft.Extensions.AI.Ollama (1)
Microsoft.Extensions.AI.Ollama.Tests (1)
Microsoft.Extensions.AI.OpenAI (6)
Microsoft.Extensions.AI.OpenAI.Tests (4)
Microsoft.Extensions.AI.Tests (14)