Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppHost 테스트들 중 NewEventPage에 대한 중복 테스트 제거 #336

Open
sikutisa opened this issue Dec 10, 2024 · 0 comments
Open

Comments

@sikutisa
Copy link
Contributor

PlaygoundApp의 AdminNewEvent 페이지에 대한 AppHost의 테스트가 아래와 같이 중복해서 작성돼 있습니다.
하나는 제거해도 될 것 같아 보입니다.

using System.Net;
using AzureOpenAIProxy.AppHost.Tests.Fixtures;
using FluentAssertions;
namespace AzureOpenAIProxy.AppHost.Tests.PlaygroundApp.Pages;
public class AdminNewEventPageTests(AspireAppHostFixture host) : IClassFixture<AspireAppHostFixture>
{
[Fact]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_OK()
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("playgroundapp");
await host.ResourceNotificationService.WaitForResourceAsync("playgroundapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// Act
var response = await httpClient.GetAsync("/admin/events/new");
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
}
[Theory]
[InlineData("_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css")]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_CSS_Elements(string expected)
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("playgroundapp");
await host.ResourceNotificationService.WaitForResourceAsync("playgroundapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// Act
var html = await httpClient.GetStringAsync("/admin/events/new");
// Assert
html.Should().Contain(expected);
}
[Theory]
[InlineData("_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js")]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_JavaScript_Elements(string expected)
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("playgroundapp");
await host.ResourceNotificationService.WaitForResourceAsync("playgroundapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// Act
var html = await httpClient.GetStringAsync("/admin/events/new");
// Assert
html.Should().Contain(expected);
}
[Theory]
[InlineData("<div class=\"fluent-tooltip-provider\" style=\"display: fixed;\"></div>")]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_HTML_Elements(string expected)
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("playgroundapp");
await host.ResourceNotificationService.WaitForResourceAsync("playgroundapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// Act
var html = await httpClient.GetStringAsync("/admin/events/new");
// Assert
html.Should().Contain(expected);
}
}

using System.Net;
using AzureOpenAIProxy.AppHost.Tests.Fixtures;
using FluentAssertions;
namespace AzureOpenAIProxy.AppHost.Tests.PlaygroundApp.Pages;
public class NewEventDetailsPageTests(AspireAppHostFixture host) : IClassFixture<AspireAppHostFixture>
{
[Fact]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_OK()
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("playgroundapp");
await host.ResourceNotificationService.WaitForResourceAsync("playgroundapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// Act
var response = await httpClient.GetAsync("/admin/events/new");
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
}
[Theory]
[InlineData("_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css")]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_CSS_Elements(string expected)
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("playgroundapp");
await host.ResourceNotificationService.WaitForResourceAsync("playgroundapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// Act
var html = await httpClient.GetStringAsync("/admin/events/new");
// Assert
html.Should().Contain(expected);
}
[Theory]
[InlineData("_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js")]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_JavaScript_Elements(string expected)
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("playgroundapp");
await host.ResourceNotificationService.WaitForResourceAsync("playgroundapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// Act
var html = await httpClient.GetStringAsync("/admin/events/new");
// Assert
html.Should().Contain(expected);
}
//[Theory]
//[InlineData("<div class=\"fluent-tooltip-provider\"></div>")]
//public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_HTML_Elements(string expected)
//{
// // Arrange
// using var httpClient = host.App!.CreateHttpClient("playgroundapp");
// await host.ResourceNotificationService.WaitForResourceAsync("playgroundapp", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// // Act
// var html = await httpClient.GetStringAsync("/admin/events/new");
// // Assert
// html.Should().Contain(expected);
//}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant