mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 16:08:38 +00:00
Re-do formatting
This commit is contained in:
parent
95a1fd35a5
commit
173addfd03
74 changed files with 1286 additions and 905 deletions
|
@ -6,12 +6,15 @@ using System.Threading.Tasks;
|
|||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using Xunit;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Tests {
|
||||
public class MatchTests : LighthouseTest {
|
||||
namespace LBPUnion.ProjectLighthouse.Tests
|
||||
{
|
||||
public class MatchTests : LighthouseTest
|
||||
{
|
||||
private static readonly SemaphoreSlim semaphore = new(1, 1);
|
||||
|
||||
[DatabaseFact]
|
||||
public async Task ShouldRejectEmptyData() {
|
||||
public async Task ShouldRejectEmptyData()
|
||||
{
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
await semaphore.WaitAsync();
|
||||
|
||||
|
@ -22,16 +25,13 @@ namespace LBPUnion.ProjectLighthouse.Tests {
|
|||
}
|
||||
|
||||
[DatabaseFact]
|
||||
public async Task ShouldReturnOk() {
|
||||
public async Task ShouldReturnOk()
|
||||
{
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
await semaphore.WaitAsync();
|
||||
|
||||
HttpResponseMessage result = await this.AuthenticatedUploadDataRequest(
|
||||
"LITTLEBIGPLANETPS3_XML/match",
|
||||
Encoding.ASCII.GetBytes("[UpdateMyPlayerData,[\"Player\":\"1984\"]]"),
|
||||
loginResult.AuthTicket
|
||||
);
|
||||
|
||||
HttpResponseMessage result = await this.AuthenticatedUploadDataRequest
|
||||
("LITTLEBIGPLANETPS3_XML/match", Encoding.ASCII.GetBytes("[UpdateMyPlayerData,[\"Player\":\"1984\"]]"), loginResult.AuthTicket);
|
||||
|
||||
semaphore.Release();
|
||||
Assert.True(result.IsSuccessStatusCode);
|
||||
|
@ -39,23 +39,21 @@ namespace LBPUnion.ProjectLighthouse.Tests {
|
|||
public async Task<int> GetPlayerCount() => Convert.ToInt32(await this.Client.GetStringAsync("LITTLEBIGPLANETPS3_XML/totalPlayerCount"));
|
||||
|
||||
[DatabaseFact]
|
||||
public async Task ShouldIncrementPlayerCount() {
|
||||
public async Task ShouldIncrementPlayerCount()
|
||||
{
|
||||
LoginResult loginResult = await this.Authenticate(new Random().Next());
|
||||
|
||||
await semaphore.WaitAsync();
|
||||
|
||||
int oldPlayerCount = await this.GetPlayerCount();
|
||||
|
||||
HttpResponseMessage result = await this.AuthenticatedUploadDataRequest(
|
||||
"LITTLEBIGPLANETPS3_XML/match",
|
||||
Encoding.ASCII.GetBytes("[UpdateMyPlayerData,[\"Player\":\"1984\"]]"),
|
||||
loginResult.AuthTicket
|
||||
);
|
||||
|
||||
HttpResponseMessage result = await this.AuthenticatedUploadDataRequest
|
||||
("LITTLEBIGPLANETPS3_XML/match", Encoding.ASCII.GetBytes("[UpdateMyPlayerData,[\"Player\":\"1984\"]]"), loginResult.AuthTicket);
|
||||
|
||||
Assert.True(result.IsSuccessStatusCode);
|
||||
|
||||
int playerCount = await this.GetPlayerCount();
|
||||
|
||||
|
||||
semaphore.Release();
|
||||
Assert.Equal(oldPlayerCount + 1, playerCount);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue