Enable more analyzers, drop log-and-rethrow in file activities and apply dotnet format
Use invariant culture when formatting ids, put cancellation tokens last in endpoint handlers, remove the CS8618 pragmas and keep only the analyzer overrides that still apply.
This commit is contained in:
@@ -4,8 +4,8 @@ using Musify.Api.DataTransferObjects;
|
||||
using Musify.Api.DataTransferObjects.Albums;
|
||||
using Musify.Api.Tests.TestSupport;
|
||||
using Musify.Application.Albums.Responses;
|
||||
using Musify.Application.Pictures.Responses;
|
||||
using Musify.Application.Contracts;
|
||||
using Musify.Application.Pictures.Responses;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
@@ -64,7 +65,7 @@ public sealed class ApiTestFixture : WebApplicationFactory<Program>, IAsyncLifet
|
||||
public HttpClient CreateAuthenticatedClient(long userId, string userName = "test-user")
|
||||
{
|
||||
var client = CreateClient();
|
||||
client.DefaultRequestHeaders.Add(FakeAuthenticationHandler.UserIdHeader, userId.ToString());
|
||||
client.DefaultRequestHeaders.Add(FakeAuthenticationHandler.UserIdHeader, userId.ToString(CultureInfo.InvariantCulture));
|
||||
client.DefaultRequestHeaders.Add("X-Test-User-Name", userName);
|
||||
return client;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using Musify.Application.Genres;
|
||||
using Musify.Application.Genres.Responses;
|
||||
using Musify.Domain.ValueObjects;
|
||||
using Xunit;
|
||||
using Musify.Application.Genres.Responses;
|
||||
|
||||
namespace Musify.Application.Tests.Genres;
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ public abstract class HandlerTestBase : IAsyncLifetime
|
||||
|
||||
public async ValueTask InitializeAsync() => database = await TestDatabase.CreateAsync();
|
||||
|
||||
public ValueTask DisposeAsync() => database.DisposeAsync();
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
return database.DisposeAsync();
|
||||
}
|
||||
|
||||
protected static ILogger<T> NoOpLogger<T>() => NullLogger<T>.Instance;
|
||||
|
||||
|
||||
+8
-2
@@ -18,7 +18,10 @@ public sealed class DeleteRoutingSlipBuilderTests(InfrastructureTestFixture fixt
|
||||
{
|
||||
var album = await SeedAlbumAsync(new EntityPictures
|
||||
{
|
||||
OriginalName = "original.webp", SmallName = "small.webp", MediumName = "medium.webp", LargeName = "large.webp"
|
||||
OriginalName = "original.webp",
|
||||
SmallName = "small.webp",
|
||||
MediumName = "medium.webp",
|
||||
LargeName = "large.webp"
|
||||
});
|
||||
await using var database = fixture.CreateDatabase();
|
||||
|
||||
@@ -116,7 +119,10 @@ public sealed class DeleteRoutingSlipBuilderTests(InfrastructureTestFixture fixt
|
||||
var track = await SeedTrackAsync(
|
||||
new TrackPictures
|
||||
{
|
||||
OriginalName = "original.webp", SmallName = "s.webp", MediumName = "m.webp", LargeName = "l.webp",
|
||||
OriginalName = "original.webp",
|
||||
SmallName = "s.webp",
|
||||
MediumName = "m.webp",
|
||||
LargeName = "l.webp",
|
||||
ProcessingStatus = ProcessingStatus.Completed
|
||||
},
|
||||
new TrackAudio { OriginalName = "audio.mp3", FolderName = "folder", TranscodeStatus = ProcessingStatus.Completed });
|
||||
|
||||
@@ -18,6 +18,8 @@ public sealed class InfrastructureTestFixture : IAsyncLifetime
|
||||
public const string S3SecretKey = "musify-test-secret";
|
||||
public const string S3Bucket = "musify-test-bucket";
|
||||
|
||||
private static readonly string[] S3Actions = ["Admin", "Read", "Write"];
|
||||
|
||||
private readonly PostgreSqlContainer postgres = new PostgreSqlBuilder("postgres:17-alpine")
|
||||
.WithDatabase("musify_test")
|
||||
.WithUsername("postgres")
|
||||
@@ -83,7 +85,7 @@ public sealed class InfrastructureTestFixture : IAsyncLifetime
|
||||
{
|
||||
name = "musify-test",
|
||||
credentials = new[] { new { accessKey = S3AccessKey, secretKey = S3SecretKey } },
|
||||
actions = new[] { "Admin", "Read", "Write" }
|
||||
actions = S3Actions
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using Microsoft.IdentityModel.JsonWebTokens;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
@@ -36,7 +37,7 @@ public sealed class TicketValidatorTests : IDisposable
|
||||
{
|
||||
var claims = new Dictionary<string, object> { ["prefix"] = prefix };
|
||||
if (maxBytes != null)
|
||||
claims["maxBytes"] = maxBytes.Value.ToString();
|
||||
claims["maxBytes"] = maxBytes.Value.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
var descriptor = new SecurityTokenDescriptor
|
||||
{
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
@@ -39,7 +40,7 @@ public sealed class TicketValidationMiddlewareTests : IDisposable
|
||||
{
|
||||
var claims = new Dictionary<string, object> { ["prefix"] = prefix };
|
||||
if (maxBytes != null)
|
||||
claims["maxBytes"] = maxBytes.Value.ToString();
|
||||
claims["maxBytes"] = maxBytes.Value.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
return new JsonWebTokenHandler().CreateToken(new SecurityTokenDescriptor
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user