Skip to content

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

Description

@sikutisa

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);
//}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions