46 references to new
Microsoft.Extensions.AI.Abstractions.Tests (3)
Contents\FunctionCallContentTests..cs (1)
99
AIFunctionArguments arguments =
new
()
Functions\AIFunctionArgumentsTests.cs (2)
17
var args = new
AIFunctionArguments
();
53
var args = new
AIFunctionArguments
Microsoft.Extensions.AI.Tests (43)
Functions\AIFunctionFactoryTest.cs (43)
42
AssertExtensions.EqualFunctionCallResults("test test", await func.InvokeAsync(
new
() { ["a"] = "test" }));
45
AssertExtensions.EqualFunctionCallResults("hello world", await func.InvokeAsync(
new
() { ["b"] = "hello", ["a"] = "world" }));
48
AssertExtensions.EqualFunctionCallResults(3L, await func.InvokeAsync(
new
() { ["a"] = 1, ["b"] = 2L }));
56
AssertExtensions.EqualFunctionCallResults("hello hello", await func.InvokeAsync(
new
() { ["a"] = "hello" }));
102
AssertExtensions.EqualFunctionCallResults("test test", await func.InvokeAsync(
new
() { ["a"] = "test" }));
105
AssertExtensions.EqualFunctionCallResults("hello world", await func.InvokeAsync(
new
() { ["b"] = "hello", ["a"] = "world" }));
109
AssertExtensions.EqualFunctionCallResults(null, await func.InvokeAsync(
new
() { ["a"] = 1, ["b"] = 2L }));
114
AssertExtensions.EqualFunctionCallResults(null, await func.InvokeAsync(
new
() { ["a"] = 1, ["b"] = 2L }));
118
AssertExtensions.EqualFunctionCallResults(new int[] { 0, 1, 2, 3, 4 }, await func.InvokeAsync(
new
() { ["count"] = 5 }), JsonContext.Default.Options);
222
var result = (JsonElement?)await func.InvokeAsync(
new
()
237
AIFunctionArguments arguments =
new
() { ["myInteger"] = 42 };
295
var result = await func.InvokeAsync(
new
() { ["myInteger"] = 42 });
316
await Assert.ThrowsAsync<ArgumentException>("arguments", () => func.InvokeAsync(
new
()).AsTask());
317
await Assert.ThrowsAsync<ArgumentException>("arguments", () => func.InvokeAsync(
new
() { Services = sp }).AsTask());
329
Assert.Contains("456", (await func.InvokeAsync(
new
()))?.ToString());
330
Assert.Contains("456", (await func.InvokeAsync(
new
() { Services = sp }))?.ToString());
340
await Assert.ThrowsAsync<ArgumentNullException>("arguments.Services", () => func.InvokeAsync(
new
()).AsTask());
341
await Assert.ThrowsAsync<ArgumentException>("arguments", () => func.InvokeAsync(
new
() { Services = new ServiceCollection().BuildServiceProvider() }).AsTask());
342
Assert.Contains("123", (await func.InvokeAsync(
new
() { Services = sp }))?.ToString());
347
Assert.Contains("456", (await func.InvokeAsync(
new
()))?.ToString());
348
Assert.Contains("123", (await func.InvokeAsync(
new
() { Services = sp }))?.ToString());
371
var result = (Tuple<MyFunctionTypeWithOneArg, MyArgumentType>?)await func.InvokeAsync(
new
() { Services = sp });
401
await Assert.ThrowsAsync<InvalidOperationException>(async () => await func.InvokeAsync(
new
() { Services = sp }));
493
Exception e = await Assert.ThrowsAsync<ArgumentNullException>("arguments.Services", () => f.InvokeAsync(
new
() { ["myInteger"] = 1 }).AsTask());
496
var result = await f.InvokeAsync(
new
() { ["myInteger"] = 1, Services = sp });
514
Exception e = await Assert.ThrowsAsync<ArgumentNullException>("arguments.Services", () => f.InvokeAsync(
new
() { ["myInteger"] = 1 }).AsTask());
517
var result = await f.InvokeAsync(
new
() { ["myInteger"] = 1, Services = sp });
536
var result = await f.InvokeAsync(
new
() { ["myInteger"] = 1 });
539
result = await f.InvokeAsync(
new
() { ["myInteger"] = 1, Services = sp });
573
Exception e = await Assert.ThrowsAsync<ArgumentException>(() => f.InvokeAsync(
new
() { ["myInteger"] = 1 }).AsTask());
576
e = await Assert.ThrowsAsync<ArgumentException>(() => f.InvokeAsync(
new
()
583
var result = await f.InvokeAsync(
new
()
607
var result = await f.InvokeAsync(
new
() { Services = sp1 });
614
AIFunctionArguments args1 =
new
() { ["a"] = 42 };
615
AIFunctionArguments args2 =
new
() { ["a"] = 43 };
647
object? result = await f.InvokeAsync(
new
() { ["i"] = 42 }, cts.Token);
670
object? result = await f.InvokeAsync(
new
() { ["i"] = 42 }, cts.Token);
693
object? result = await f.InvokeAsync(
new
() { ["i"] = 42 }, cts.Token);
716
object? result = await f.InvokeAsync(
new
() { ["i"] = 42 }, cts.Token);
739
object? result = await f.InvokeAsync(
new
() { ["i"] = 42 }, cts.Token);
762
object? result = await f.InvokeAsync(
new
() { ["i"] = 42 }, cts.Token);
785
object? result = await f.InvokeAsync(
new
() { ["i"] = 42 }, cts.Token);
808
object? result = await f.InvokeAsync(
new
() { ["i"] = 42 }, cts.Token);