Skip to content

Commit

Permalink
Removed integration project, replaced unit tests (leaderboardsgg#72)
Browse files Browse the repository at this point in the history
* Removed integration project, replaced unit tests

As I continued to improve Integration tests, I realized that they are
going to be essentially as effective, and (when using an in memory db)
barely slower than unit tests. Might as well save ourselves tons of
effort and have minimal tests that basically just test the API as if it
were a real client.

* Remove `Test` prefix from test fixture names

* Remove Ref to Integration Project in csproj

* Fixed tests that weren't working

Co-authored-by: Sim <[email protected]>
  • Loading branch information
RageCage64 and Sim authored Mar 26, 2022
1 parent 6089632 commit 28d0caf
Show file tree
Hide file tree
Showing 24 changed files with 115 additions and 795 deletions.
26 changes: 0 additions & 26 deletions LeaderboardBackend.Integration/HttpHelpers.cs

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
using LeaderboardBackend.Models.Entities;
using LeaderboardBackend.Models.Requests.Categories;
using LeaderboardBackend.Models.Requests.Leaderboards;
using LeaderboardBackend.Test.Lib;
using NUnit.Framework;
using System.Net;
using System.Net.Http;
using System.Net.Http.Json;
using System.Text.Json;
using System.Threading.Tasks;

namespace LeaderboardBackend.Integration;
namespace LeaderboardBackend.Test;

[TestFixture]
internal class Categories
Expand Down Expand Up @@ -37,11 +39,20 @@ public static async Task GetCategory_NoCategories()
[Test]
public static async Task CreateCategory_GetCategory()
{
CreateLeaderboardRequest createLeaderboardBody = new()
{
Name = Generators.GenerateRandomString(),
Slug = Generators.GenerateRandomString(),
};
HttpResponseMessage createLeaderboardResponse = await ApiClient.PostAsJsonAsync("/api/leaderboards", createLeaderboardBody, JsonSerializerOptions);
createLeaderboardResponse.EnsureSuccessStatusCode();
Leaderboard createdLeaderboard = await HttpHelpers.ReadFromResponseBody<Leaderboard>(createLeaderboardResponse, JsonSerializerOptions);

CreateCategoryRequest createBody = new()
{
Name = Generators.GenerateRandomString(),
Slug = Generators.GenerateRandomString(),
LeaderboardId = 1
LeaderboardId = createdLeaderboard.Id,
};
HttpResponseMessage createResponse = await ApiClient.PostAsJsonAsync("/api/categories", createBody, JsonSerializerOptions);
createResponse.EnsureSuccessStatusCode();
Expand Down
54 changes: 0 additions & 54 deletions LeaderboardBackend.Test/Controllers/CategoriesControllerTest.cs

This file was deleted.

76 changes: 0 additions & 76 deletions LeaderboardBackend.Test/Controllers/LeaderboardsControllerTest.cs

This file was deleted.

30 changes: 0 additions & 30 deletions LeaderboardBackend.Test/Controllers/RunsControllerTest.cs

This file was deleted.

Loading

0 comments on commit 28d0caf

Please sign in to comment.