Skip to content

Commit

Permalink
Remove unnecessary static keywords from Categories tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zysim committed Jan 24, 2025
1 parent 77cbeb1 commit 409025f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 173 deletions.
18 changes: 9 additions & 9 deletions LeaderboardBackend.Test/Categories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public async Task CreateCategory_BadData(string? name, string? slug, object sort
}

[Test]
public static async Task UpdateCategory_OK()
public async Task UpdateCategory_OK()
{
IServiceScope scope = _factory.Services.CreateScope();
ApplicationContext context = scope.ServiceProvider.GetRequiredService<ApplicationContext>();
Expand Down Expand Up @@ -336,7 +336,7 @@ public static async Task UpdateCategory_OK()
}

[Test]
public static async Task UpdateCategory_Unauthenticated()
public async Task UpdateCategory_Unauthenticated()
{
IServiceScope scope = _factory.Services.CreateScope();
ApplicationContext context = scope.ServiceProvider.GetRequiredService<ApplicationContext>();
Expand Down Expand Up @@ -373,7 +373,7 @@ await FluentActions.Awaiting(() => _apiClient.Patch(
[TestCase(UserRole.Banned)]
[TestCase(UserRole.Confirmed)]
[TestCase(UserRole.Registered)]
public static async Task UpdateCategory_BadRole(UserRole role)
public async Task UpdateCategory_BadRole(UserRole role)
{
IServiceScope scope = _factory.Services.CreateScope();
IUserService userService = scope.ServiceProvider.GetRequiredService<IUserService>();
Expand Down Expand Up @@ -422,7 +422,7 @@ await FluentActions.Awaiting(() => _apiClient.Patch(
}

[Test]
public static async Task UpdateCategory_CategoryNotFound() =>
public async Task UpdateCategory_CategoryNotFound() =>
await FluentActions.Awaiting(() => _apiClient.Patch(
$"category/{int.MaxValue}",
new()
Expand All @@ -436,7 +436,7 @@ await FluentActions.Awaiting(() => _apiClient.Patch(
)).Should().ThrowAsync<RequestFailureException>().Where(e => e.Response.StatusCode == HttpStatusCode.NotFound);

[Test]
public static async Task UpdateCategory_Conflict()
public async Task UpdateCategory_Conflict()
{
IServiceScope scope = _factory.Services.CreateScope();
ApplicationContext context = scope.ServiceProvider.GetRequiredService<ApplicationContext>();
Expand Down Expand Up @@ -486,7 +486,7 @@ public static async Task UpdateCategory_Conflict()
}

[Test]
public static async Task UpdateCategory_NoConflictBecauseOldCatIsDeleted()
public async Task UpdateCategory_NoConflictBecauseOldCatIsDeleted()
{
IServiceScope scope = _factory.Services.CreateScope();
ApplicationContext context = scope.ServiceProvider.GetRequiredService<ApplicationContext>();
Expand Down Expand Up @@ -533,7 +533,7 @@ await FluentActions.Awaiting(() => _apiClient.Patch(
}

[Test]
public static async Task UpdateCategory_NoConflictBecauseDifferentLeaderboard()
public async Task UpdateCategory_NoConflictBecauseDifferentLeaderboard()
{
IServiceScope scope = _factory.Services.CreateScope();
ApplicationContext context = scope.ServiceProvider.GetRequiredService<ApplicationContext>();
Expand Down Expand Up @@ -590,7 +590,7 @@ await FluentActions.Awaiting(() => _apiClient.Patch(
[TestCase(1, "b.b")]
[TestCase(2, "b")]
[TestCase(3, null)]
public static async Task UpdateCategory_BadData(int index, string? slug)
public async Task UpdateCategory_BadData(int index, string? slug)
{
IServiceScope scope = _factory.Services.CreateScope();
ApplicationContext context = scope.ServiceProvider.GetRequiredService<ApplicationContext>();
Expand Down Expand Up @@ -893,7 +893,7 @@ public async Task RestoreCategory_Unauthenticated()
context.ChangeTracker.Clear();

await FluentActions.Awaiting(() => _apiClient.Put<CategoryViewModel>(
"category/1/restore",
$"category/{cat.Id}/restore",
new() { }
)).Should().ThrowAsync<RequestFailureException>().Where(e => e.Response.StatusCode == HttpStatusCode.Unauthorized);

Expand Down
165 changes: 1 addition & 164 deletions LeaderboardBackend/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CategoryConflictDetails"
"$ref": "#/components/schemas/CategoryViewModelConflictDetails"
}
}
}
Expand Down Expand Up @@ -1374,106 +1374,6 @@
},
"components": {
"schemas": {
"Category": {
"required": [
"name",
"slug"
],
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "The unique identifier of the `Category`.\n\r\nGenerated on creation.",
"format": "int64"
},
"leaderboardId": {
"type": "integer",
"description": "The ID of the `Leaderboard` the `Category` is a part of.",
"format": "int64"
},
"leaderboard": {
"$ref": "#/components/schemas/Leaderboard"
},
"name": {
"minLength": 1,
"type": "string",
"description": "The display name of the `Category`.",
"example": "Foo Bar Baz%"
},
"slug": {
"maxLength": 80,
"minLength": 2,
"pattern": "^[a-zA-Z0-9\\-_]*$",
"type": "string",
"description": "The URL-scoped unique identifier of the `Category`.\n\r\nMust be [2, 25] in length and consist only of alphanumeric characters and hyphens.",
"example": "foo-bar-baz"
},
"info": {
"type": "string",
"description": "Information pertaining to the `Category`.",
"example": "Video proof is required."
},
"sortDirection": {
"$ref": "#/components/schemas/SortDirection"
},
"type": {
"$ref": "#/components/schemas/RunType"
},
"createdAt": {
"type": "string",
"description": "The time the Category was created.",
"format": "date-time",
"example": "1984-01-01T00:00:00Z"
},
"updatedAt": {
"type": "string",
"description": "The last time the Category was updated or null.",
"format": "date-time",
"nullable": true,
"example": "1984-01-01T00:00:00Z"
},
"deletedAt": {
"type": "string",
"description": "The time at which the Category was deleted, or null if the Category has not been deleted.",
"format": "date-time",
"nullable": true,
"example": "1984-01-01T00:00:00Z"
}
},
"additionalProperties": false,
"description": "Represents a `Category` tied to a `Leaderboard`."
},
"CategoryConflictDetails": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
},
"conflicting": {
"$ref": "#/components/schemas/Category"
}
},
"additionalProperties": { },
"description": "A fake ProblemDetails subclass used for deserialization and documentation. Do not instantiate!"
},
"CategoryViewModel": {
"required": [
"createdAt",
Expand Down Expand Up @@ -1674,69 +1574,6 @@
"additionalProperties": false,
"description": "This request object is sent when creating a `Run`."
},
"Leaderboard": {
"required": [
"name",
"slug"
],
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "The unique identifier of the `Leaderboard`.\n\r\nGenerated on creation.",
"format": "int64"
},
"name": {
"minLength": 1,
"type": "string",
"description": "The display name of the `Leaderboard`.",
"example": "Foo Bar"
},
"slug": {
"maxLength": 80,
"minLength": 2,
"pattern": "^[a-zA-Z0-9\\-_]*$",
"type": "string",
"description": "The URL-scoped unique identifier of the `Leaderboard`.\n\r\nMust be [2, 80] in length and consist only of alphanumeric characters and hyphens.",
"example": "foo-bar"
},
"info": {
"type": "string",
"description": "The general information for the Leaderboard.",
"example": "Timer starts on selecting New Game and ends when the final boss is beaten."
},
"createdAt": {
"type": "string",
"description": "The time the Leaderboard was created.",
"format": "date-time",
"example": "1984-01-01T00:00:00Z"
},
"updatedAt": {
"type": "string",
"description": "The last time the Leaderboard was updated or null.",
"format": "date-time",
"nullable": true,
"example": "1984-01-01T00:00:00Z"
},
"deletedAt": {
"type": "string",
"description": "The time at which the Leaderboard was deleted, or null if the Leaderboard has not been deleted.",
"format": "date-time",
"nullable": true,
"example": "1984-01-01T00:00:00Z"
},
"categories": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Category"
},
"description": "A collection of `Category` entities for the `Leaderboard`.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Represents a collection of `Category` entities."
},
"LeaderboardViewModel": {
"required": [
"createdAt",
Expand Down

0 comments on commit 409025f

Please sign in to comment.