microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
dev

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

Tests/Microsoft.Teams.AI.Tests/FunctionTests.cs

76lines · modeblame

97371ee8Aamir Jawaid9 months ago1using Microsoft.Teams.AI.Annotations;
2
3namespace Microsoft.Teams.AI.Tests;
4
5public class FunctionTests
6{
7[Fact]
8public void Test_Function_GeneratesParametersSchema_FromDelegate()
9{
10// Arrange & Act
11var function = new Function(
12"test_function",
13"A test function",
14([Param("name")] string name, int age) => $"Hello {name}, age {age}"
15);
16
17// Assert
18Assert.NotNull(function.Parameters);
19}
20
21[Fact]
22public void Test_Function_GeneratesParametersSchema_WithParamAttribute()
23{
24// Arrange & Act
25var function = new Function(
26"pokemon_search",
27"Search for pokemon",
28([Param("pokemon_name")] string pokemonName) => $"Searching for {pokemonName}"
29);
30
31// Assert
32Assert.NotNull(function.Parameters);
33}
34
35[Fact]
36public void Test_Function_NoParameters_ReturnsNullSchema()
37{
38// Arrange & Act
39var function = new Function(
40"no_params_function",
41"A function with no parameters",
42() => "No params"
43);
44
45// Assert
46Assert.Null(function.Parameters);
47}
48
49[Fact]
50public void Test_Function_OptionalParameters_MarkedCorrectly()
51{
52// Arrange & Act
53var function = new Function(
54"optional_params_function",
55"A function with optional parameters",
56(string required, string optional = "default") => $"{required} {optional}"
57);
58
59// Assert
60Assert.NotNull(function.Parameters);
61}
62
63[Fact]
64public void Test_Function_MultipleParameters_GeneratesSchema()
65{
66// Arrange & Act
67var function = new Function(
68"multi_param_function",
69"A function with multiple parameters",
70(string name, int age, bool active) => $"{name} {age} {active}"
71);
72
73// Assert
74Assert.NotNull(function.Parameters);
75}
2846e4f6Alex Acebo8 months ago76}