Skip to content

Commit

Permalink
Update test method
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyoo committed Jul 11, 2024
1 parent 67d5922 commit cf63cda
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<SwashbuckleVersion>6.*</SwashbuckleVersion>

<CoverletVersion>6.*</CoverletVersion>
<FluentAssertionsVersion>6.*</FluentAssertionsVersion>
<MicrosoftTestSdkVersion>17.*</MicrosoftTestSdkVersion>
<SystemTextJsonVersion>8.*</SystemTextJsonVersion>
<XunitVersion>2.*</XunitVersion>
</PropertyGroup>
</Project>
26 changes: 26 additions & 0 deletions test/AzureOpenAIProxy.AppHost.Tests/AppHostProgramTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Net;

using FluentAssertions;

namespace AzureOpenAIProxy.Tests;

public class AppHostProgramTests
{
[Theory]
[InlineData("apiapp", "/health", HttpStatusCode.OK)]
[InlineData("playgroundapp", "/health", HttpStatusCode.OK)]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Healthy(string resourceName, string endpoint, HttpStatusCode statusCode)
{
// Arrange
var appHost = await DistributedApplicationTestingBuilder.CreateAsync<Projects.AzureOpenAIProxy_AppHost>();
await using var app = await appHost.BuildAsync();
await app.StartAsync();

// Act
var httpClient = app.CreateHttpClient(resourceName);
var response = await httpClient.GetAsync(endpoint);

// Assert
response.StatusCode.Should().Be(statusCode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSdkVersion)" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)">
<PrivateAssets>all</PrivateAssets>
Expand Down
22 changes: 0 additions & 22 deletions test/AzureOpenAIProxy.AppHost.Tests/WebTests.cs

This file was deleted.

0 comments on commit cf63cda

Please sign in to comment.