42 references to new
Microsoft.Extensions.AI.Abstractions.Tests (3)
Contents\FunctionCallContentTests.cs (1)
99AIFunctionArguments arguments = new()
Functions\AIFunctionArgumentsTests.cs (2)
17var args = new AIFunctionArguments(); 53var args = new AIFunctionArguments
Microsoft.Extensions.AI.Tests (39)
Functions\AIFunctionFactoryTest.cs (39)
46AssertExtensions.EqualFunctionCallResults("test test", await func.InvokeAsync(new() { ["a"] = "test" })); 49AssertExtensions.EqualFunctionCallResults("hello world", await func.InvokeAsync(new() { ["b"] = "hello", ["a"] = "world" })); 52AssertExtensions.EqualFunctionCallResults(3L, await func.InvokeAsync(new() { ["a"] = 1, ["b"] = 2L })); 60AssertExtensions.EqualFunctionCallResults("hello hello", await func.InvokeAsync(new() { ["a"] = "hello" })); 79AssertExtensions.EqualFunctionCallResults("hello", await funcNull.InvokeAsync(new() { ["text"] = "hello" })); 88AssertExtensions.EqualFunctionCallResults("custom", await funcValue.InvokeAsync(new() { ["text"] = "custom" })); 97AssertExtensions.EqualFunctionCallResults(10, await funcInt.InvokeAsync(new() { ["x"] = 5 })); 131var result = await func.InvokeAsync(new() 161var result = await func.InvokeAsync(new() 181var result = await func.InvokeAsync(new() 215AssertExtensions.EqualFunctionCallResults("test test", await func.InvokeAsync(new() { ["a"] = "test" })); 219AssertExtensions.EqualFunctionCallResults("hello world", await func.InvokeAsync(new() { ["b"] = "hello", ["a"] = "world" })); 224AssertExtensions.EqualFunctionCallResults(null, await func.InvokeAsync(new() { ["a"] = 1, ["b"] = 2L })); 230AssertExtensions.EqualFunctionCallResults(null, await func.InvokeAsync(new() { ["a"] = 1, ["b"] = 2L })); 235AssertExtensions.EqualFunctionCallResults(new int[] { 0, 1, 2, 3, 4 }, await func.InvokeAsync(new() { ["count"] = 5 }), JsonContext.Default.Options); 375var result = (JsonElement?)await func.InvokeAsync(new() 405AIFunctionArguments arguments = new() { ["myInteger"] = 42 }; 465var result = await func.InvokeAsync(new() { ["myInteger"] = 42 }); 493var result = (Tuple<MyFunctionTypeWithOneArg, MyArgumentType>?)await func.InvokeAsync(new() { Services = sp }); 604Exception e = await Assert.ThrowsAsync<ArgumentException>("arguments.Services", () => f.InvokeAsync(new() { ["myInteger"] = 1 }).AsTask()); 606var result = await f.InvokeAsync(new() { ["myInteger"] = 1, Services = sp }); 627Exception e = await Assert.ThrowsAsync<ArgumentException>("arguments.Services", () => f.InvokeAsync(new() { ["myInteger"] = 1 }).AsTask()); 629var result = await f.InvokeAsync(new() { ["myInteger"] = 1, Services = sp }); 649var result = await f.InvokeAsync(new() { ["myInteger"] = 1 }); 652result = await f.InvokeAsync(new() { ["myInteger"] = 1, Services = sp }); 686Exception e = await Assert.ThrowsAsync<ArgumentException>(() => f.InvokeAsync(new() { ["myInteger"] = 1 }).AsTask()); 689e = await Assert.ThrowsAsync<ArgumentException>(() => f.InvokeAsync(new() 696var result = await f.InvokeAsync(new() 720var result = await f.InvokeAsync(new() { Services = sp1 }); 727AIFunctionArguments args1 = new() { ["a"] = 42 }; 728AIFunctionArguments args2 = new() { ["a"] = 43 }; 760object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 783object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 806object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 829object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 852object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 875object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 898object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token); 922object? result = await f.InvokeAsync(new() { ["i"] = 42 }, cts.Token);