-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related to: #199
- Loading branch information
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
test/AzureOpenAIProxy.AppHost.Tests/PlaygroundApp/Pages/AdminUpdateEventTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System.Net; | ||
|
||
using AzureOpenAIProxy.AppHost.Tests.Fixtures; | ||
|
||
using FluentAssertions; | ||
|
||
namespace AzureOpenAIProxy.AppHost.Tests.PlaygroundApp.Pages; | ||
|
||
public class AdminUpdateEventPageTests(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)); | ||
|
||
var eventId = Guid.NewGuid(); | ||
var expectedUrl = $"/admin/events/edit/{eventId}"; | ||
|
||
// Act | ||
var response = await httpClient.GetAsync(expectedUrl); | ||
|
||
// 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)); | ||
|
||
var eventId = Guid.NewGuid(); | ||
var expectedUrl = $"/admin/events/edit/{eventId}"; | ||
|
||
// Act | ||
var html = await httpClient.GetStringAsync(expectedUrl); | ||
|
||
// 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)); | ||
|
||
var eventId = Guid.NewGuid(); | ||
var expectedUrl = $"/admin/events/edit/{eventId}"; | ||
|
||
// Act | ||
var html = await httpClient.GetStringAsync(expectedUrl); | ||
|
||
// 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)); | ||
|
||
var eventId = Guid.NewGuid(); | ||
var expectedUrl = $"/admin/events/edit/{eventId}"; | ||
|
||
// Act | ||
var html = await httpClient.GetStringAsync(expectedUrl); | ||
|
||
// Assert | ||
html.Should().Contain(expected); | ||
} | ||
} |