yep
This commit is contained in:
@@ -1,25 +1,36 @@
|
||||
using Shogi.AcceptanceTests.TestSetup;
|
||||
using Shogi.Contracts.Api;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Shogi.AcceptanceTests;
|
||||
|
||||
public class AcceptanceTests : IClassFixture<MsalTestFixture>
|
||||
#pragma warning disable xUnit1033 // There is a bug which provides a false positive of xUnit1033.
|
||||
public class AcceptanceTests : IClassFixture<GuestTestFixture>
|
||||
#pragma warning restore xUnit1033
|
||||
{
|
||||
private readonly MsalTestFixture fixture;
|
||||
private readonly GuestTestFixture fixture;
|
||||
private readonly ITestOutputHelper console;
|
||||
|
||||
public AcceptanceTests(MsalTestFixture fixture, ITestOutputHelper console)
|
||||
public AcceptanceTests(GuestTestFixture fixture, ITestOutputHelper console)
|
||||
{
|
||||
this.fixture = fixture;
|
||||
this.console = console;
|
||||
}
|
||||
|
||||
private HttpClient Service => fixture.Service;
|
||||
|
||||
[Fact]
|
||||
public async Task CreateAndReadSession()
|
||||
{
|
||||
var response = await fixture.Service.GetAsync(new Uri("Game", UriKind.Relative));
|
||||
console.WriteLine(await response.Content.ReadAsStringAsync());
|
||||
console.WriteLine(response.Headers.WwwAuthenticate.ToString());
|
||||
response.IsSuccessStatusCode.Should().BeTrue(because: "AAT Client should be authorized.");
|
||||
var createResponse = await Service.PostAsJsonAsync(new Uri("Session", UriKind.Relative), new CreateSessionCommand { Name = "Acceptance Tests" });
|
||||
createResponse.StatusCode.Should().Be(HttpStatusCode.Created);
|
||||
var yep = await createResponse.Content.ReadAsStringAsync();
|
||||
console.WriteLine(yep);
|
||||
|
||||
var readAllResponse = await Service.GetFromJsonAsync<ReadAllSessionsResponse>(new Uri("Session", UriKind.Relative));
|
||||
readAllResponse.Should().NotBeNull();
|
||||
readAllResponse!.AllOtherSessions.Should().ContainSingle(session => session.Name == "Acceptance Tests" && session.PlayerCount == 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user