Massive organization of classes and namespaces

This commit is contained in:
jvyden 2022-05-15 16:45:00 -04:00
commit c345eeebb9
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
218 changed files with 468 additions and 342 deletions

View file

@ -0,0 +1,69 @@
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.PlayerData;
using LBPUnion.ProjectLighthouse.Tests;
using Xunit;
namespace ProjectLighthouse.Tests.GameApiTests.Tests;
public class UploadTests : LighthouseServerTest
{
public UploadTests()
{
string assetsDirectory = Path.Combine(Environment.CurrentDirectory, "r");
if (Directory.Exists(assetsDirectory)) Directory.Delete(assetsDirectory, true);
}
[Fact]
public async Task ShouldNotAcceptScript()
{
LoginResult loginResult = await this.Authenticate();
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestScript.ff", loginResult.AuthTicket);
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
Assert.False(response.IsSuccessStatusCode);
}
[Fact]
public async Task ShouldNotAcceptFarc()
{
LoginResult loginResult = await this.Authenticate();
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestFarc.farc", loginResult.AuthTicket);
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
Assert.False(response.IsSuccessStatusCode);
}
[Fact]
public async Task ShouldNotAcceptGarbage()
{
LoginResult loginResult = await this.Authenticate();
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestGarbage.bin", loginResult.AuthTicket);
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
Assert.False(response.IsSuccessStatusCode);
}
[Fact]
public async Task ShouldAcceptTexture()
{
LoginResult loginResult = await this.Authenticate();
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestTexture.tex", loginResult.AuthTicket);
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
Assert.True(response.IsSuccessStatusCode);
}
[Fact]
public async Task ShouldAcceptLevel()
{
LoginResult loginResult = await this.Authenticate();
HttpResponseMessage response = await this.AuthenticatedUploadFileEndpointRequest("ExampleFiles/TestLevel.lvl", loginResult.AuthTicket);
Assert.False(response.StatusCode == HttpStatusCode.Forbidden);
Assert.True(response.IsSuccessStatusCode);
}
}