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).
40 lines
1.6 KiB
C#
40 lines
1.6 KiB
C#
using ErrorOr;
|
|
using Musify.Application.PlayLists;
|
|
using Musify.Application.Tests.TestSupport;
|
|
using Musify.Domain.Entities;
|
|
using Xunit;
|
|
|
|
namespace Musify.Application.Tests.PlayLists
|
|
{
|
|
public sealed class GetPlayListTracksQueryHandlerTests : HandlerTestBase
|
|
{
|
|
private GetPlayListTracksQueryHandler CreateHandler() => new(Database);
|
|
|
|
[Fact]
|
|
public async Task Handle_TracksOrderedByPosition_ReturnsThemInOrder()
|
|
{
|
|
var owner = TestEntities.User();
|
|
var playList = TestEntities.PlayList(owner.Id);
|
|
var second = TestEntities.LocalTrack(owner, "Second");
|
|
var first = TestEntities.LocalTrack(owner, "First");
|
|
await SeedAsync(
|
|
owner, playList, second, first,
|
|
new PlayListHasTrack { PlayListId = playList.Id, TrackId = second.Id, Position = 1 },
|
|
new PlayListHasTrack { PlayListId = playList.Id, TrackId = first.Id, Position = 0 });
|
|
|
|
var result = await CreateHandler().Handle(new GetPlayListTracksQuery(playList.Id, PageNumber: 1, PageSize: 10), TestContext.Current.CancellationToken);
|
|
|
|
Assert.False(result.IsError);
|
|
Assert.Equal(["First", "Second"], result.Value.Items.Select(track => track.Title));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Handle_PlayListMissing_ReturnsNotFound()
|
|
{
|
|
var result = await CreateHandler().Handle(new GetPlayListTracksQuery(Guid.NewGuid(), PageNumber: 1, PageSize: 10), TestContext.Current.CancellationToken);
|
|
|
|
Assert.Equal(ErrorType.NotFound, result.FirstError.Type);
|
|
}
|
|
}
|
|
}
|