Use block-scoped namespaces in the test suite
Converts all 73 test source files from file-scoped (namespace X;) to
block-scoped (namespace X { ... }) declarations, re-indenting their
contents accordingly. Matches the existing convention already used in
several production files (e.g. Musify.Infrastructure.Configuration,
Musify.Application.Contracts).
Mechanical change only, done with a script, verified with a full
rebuild (0 warnings, 0 errors) and test run (257/257 passing).
This commit is contained in:
@@ -3,38 +3,39 @@ using Musify.Application.Tests.TestSupport;
|
||||
using Musify.Application.Users;
|
||||
using Xunit;
|
||||
|
||||
namespace Musify.Application.Tests.Users;
|
||||
|
||||
public sealed class CreateUserCommandHandlerTests : HandlerTestBase
|
||||
namespace Musify.Application.Tests.Users
|
||||
{
|
||||
private CreateUserCommandHandler CreateHandler() => new(Database, NoOpLogger<CreateUserCommandHandler>());
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_NewId_CreatesUser()
|
||||
public sealed class CreateUserCommandHandlerTests : HandlerTestBase
|
||||
{
|
||||
var command = new CreateUserCommand(1, "Jane Doe", "Jane", "Doe");
|
||||
private CreateUserCommandHandler CreateHandler() => new(Database, NoOpLogger<CreateUserCommandHandler>());
|
||||
|
||||
var result = await CreateHandler().Handle(command, TestContext.Current.CancellationToken);
|
||||
[Fact]
|
||||
public async Task Handle_NewId_CreatesUser()
|
||||
{
|
||||
var command = new CreateUserCommand(1, "Jane Doe", "Jane", "Doe");
|
||||
|
||||
Assert.False(result.IsError);
|
||||
Assert.Equal("Jane Doe", result.Value.Name);
|
||||
Assert.Equal(1, result.Value.Id);
|
||||
var result = await CreateHandler().Handle(command, TestContext.Current.CancellationToken);
|
||||
|
||||
var stored = await Database.Users.FindAsync([1L], TestContext.Current.CancellationToken);
|
||||
Assert.NotNull(stored);
|
||||
Assert.Equal("JANE DOE", stored.NormalizedName);
|
||||
}
|
||||
Assert.False(result.IsError);
|
||||
Assert.Equal("Jane Doe", result.Value.Name);
|
||||
Assert.Equal(1, result.Value.Id);
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_IdAlreadyExists_ReturnsConflict()
|
||||
{
|
||||
var existing = TestEntities.User(1);
|
||||
await SeedAsync(existing);
|
||||
var stored = await Database.Users.FindAsync([1L], TestContext.Current.CancellationToken);
|
||||
Assert.NotNull(stored);
|
||||
Assert.Equal("JANE DOE", stored.NormalizedName);
|
||||
}
|
||||
|
||||
var command = new CreateUserCommand(1, "Someone Else", null, null);
|
||||
[Fact]
|
||||
public async Task Handle_IdAlreadyExists_ReturnsConflict()
|
||||
{
|
||||
var existing = TestEntities.User(1);
|
||||
await SeedAsync(existing);
|
||||
|
||||
var result = await CreateHandler().Handle(command, TestContext.Current.CancellationToken);
|
||||
var command = new CreateUserCommand(1, "Someone Else", null, null);
|
||||
|
||||
Assert.Equal(ErrorType.Conflict, result.FirstError.Type);
|
||||
var result = await CreateHandler().Handle(command, TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.Equal(ErrorType.Conflict, result.FirstError.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user