Skip to content

Commit

Permalink
add more
Browse files Browse the repository at this point in the history
  • Loading branch information
kuojianlu committed Jan 8, 2024
1 parent b97425f commit 453a652
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,24 @@ namespace Microsoft.Teams.AI.Tests.AITests
public class OpenAIModelTests
{
[Fact]
public void Test_Constructor_InvalidAzureEndpoint()
public void Test_Constructor_OpenAI()
{
// Arrange
var options = new OpenAIModelOptions("test-key", "test-model");

// Act
try
{
new OpenAIModel(options);
}
catch (Exception ex)

Check warning on line 29 in dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI.Tests/AITests/OpenAIModelTests.cs

View workflow job for this annotation

GitHub Actions / Build/Test/Lint (6.0)

Modify 'Test_Constructor_OpenAI' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 29 in dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI.Tests/AITests/OpenAIModelTests.cs

View workflow job for this annotation

GitHub Actions / Build/Test/Lint (7.0)

Modify 'Test_Constructor_OpenAI' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 29 in dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI.Tests/AITests/OpenAIModelTests.cs

View workflow job for this annotation

GitHub Actions / Analyze

Modify 'Test_Constructor_OpenAI' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)
{
Assert.Fail($"Expected no exception, but got: {ex.Message}");
}
}

[Fact]
public void Test_Constructor_AzureOpenAI_InvalidAzureEndpoint()
{
// Arrange
var options = new AzureOpenAIModelOptions("test-key", "test-deployment", "https://test.openai.azure.com/");
Expand All @@ -30,7 +47,7 @@ public void Test_Constructor_InvalidAzureEndpoint()
}

[Fact]
public void Test_Constructor_InvalidAzureApiVersion()
public void Test_Constructor_AzureOpenAI_InvalidAzureApiVersion()
{
// Arrange
var options = new AzureOpenAIModelOptions("test-key", "test-deployment", "https://test.openai.azure.com/");
Expand All @@ -43,7 +60,14 @@ public void Test_Constructor_InvalidAzureApiVersion()
foreach (var version in versions)
{
options.AzureApiVersion = version;
new OpenAIModel(options);
try
{
new OpenAIModel(options);
}
catch (Exception ex)

Check warning on line 67 in dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI.Tests/AITests/OpenAIModelTests.cs

View workflow job for this annotation

GitHub Actions / Build/Test/Lint (6.0)

Modify 'Test_Constructor_AzureOpenAI_InvalidAzureApiVersion' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 67 in dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI.Tests/AITests/OpenAIModelTests.cs

View workflow job for this annotation

GitHub Actions / Build/Test/Lint (7.0)

Modify 'Test_Constructor_AzureOpenAI_InvalidAzureApiVersion' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 67 in dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI.Tests/AITests/OpenAIModelTests.cs

View workflow job for this annotation

GitHub Actions / Analyze

Modify 'Test_Constructor_AzureOpenAI_InvalidAzureApiVersion' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)
{
Assert.Fail($"Expected no exception, but got: {ex.Message}");
}
}
options.AzureApiVersion = "2023-12-01-preview";
Exception exception = Assert.Throws<ArgumentException>(() => new OpenAIModel(options));
Expand Down

0 comments on commit 453a652

Please sign in to comment.