Implements tests for commit 45f9aa3bd5

This commit is contained in:
BinaryAlley committed 2026-10-28 22:34:32 +02:00
1 parent d61a114d80
commit aeefa9487e
44 files changed
+6929 -18

No files matched your search

@@ -0,0 +1,52 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
/// <summary>
/// Fixture class for the <see cref="GetPlaybackManifestRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPlaybackManifestRequestFixture
{
/// <summary>
/// Creates a new <see cref="GetPlaybackManifestRequest"/> instance.
/// </summary>
/// <param name="artistId">Optional unique identifier of the artist the album belongs to.</param>
/// <param name="albumId">Optional unique identifier of the album the track belongs to.</param>
/// <param name="trackId">Optional unique identifier of the track whose manifest is requested.</param>
/// <param name="libraryId">Optional unique identifier of the media library the track belongs to.</param>
/// <param name="capabilities">Optional capabilities the player advertises it can play directly.</param>
/// <param name="includeCapabilities">Whether the capabilities should be included, or forced to <see langword="null"/>.</param>
/// <returns>A configured <see cref="GetPlaybackManifestRequest"/> instance.</returns>
public GetPlaybackManifestRequest Create(
string? artistId = null,
string? albumId = null,
string? trackId = null,
Guid? libraryId = null,
string? capabilities = null,
bool includeCapabilities = true)
{
return new GetPlaybackManifestRequest(
artistId ?? Guid.NewGuid().ToString(),
albumId ?? Guid.NewGuid().ToString(),
trackId ?? Guid.NewGuid().ToString(),
libraryId ?? Guid.NewGuid(),
includeCapabilities ? (capabilities ?? "mp3/mp3") : null);
}
/// <summary>
/// Creates a list of <see cref="GetPlaybackManifestRequest"/> instances.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="GetPlaybackManifestRequest"/> instances.</returns>
public List<GetPlaybackManifestRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,53 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
/// <summary>
/// Fixture class for the <see cref="StreamMusicTrackRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class StreamMusicTrackRequestFixture
{
/// <summary>
/// Creates a new <see cref="StreamMusicTrackRequest"/> instance.
/// </summary>
/// <param name="artistId">Optional unique identifier of the artist the album belongs to.</param>
/// <param name="albumId">Optional unique identifier of the album the track belongs to.</param>
/// <param name="trackId">Optional unique identifier of the track to stream.</param>
/// <param name="libraryId">Optional unique identifier of the media library the track belongs to.</param>
/// <param name="includeArtistId">Whether the artist Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTrackId">Whether the track Id should be included, or forced to <see langword="null"/>.</param>
/// <returns>A configured <see cref="StreamMusicTrackRequest"/> instance.</returns>
public StreamMusicTrackRequest Create(
string? artistId = null,
string? albumId = null,
string? trackId = null,
Guid? libraryId = null,
bool includeArtistId = true,
bool includeAlbumId = true,
bool includeTrackId = true)
{
return new StreamMusicTrackRequest(
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null!,
includeAlbumId ? (albumId ?? Guid.NewGuid().ToString()) : null!,
includeTrackId ? (trackId ?? Guid.NewGuid().ToString()) : null!,
libraryId ?? Guid.NewGuid());
}
/// <summary>
/// Creates a list of <see cref="StreamMusicTrackRequest"/> instances.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="StreamMusicTrackRequest"/> instances.</returns>
public List<StreamMusicTrackRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,55 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Presentation.Web.Fixtures.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
/// <summary>
/// Fixture class for the <see cref="StreamMusicTrackSegmentRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class StreamMusicTrackSegmentRequestFixture
{
/// <summary>
/// Creates a new <see cref="StreamMusicTrackSegmentRequest"/> instance.
/// </summary>
/// <param name="artistId">Optional unique identifier of the artist the album belongs to.</param>
/// <param name="albumId">Optional unique identifier of the album the track belongs to.</param>
/// <param name="trackId">Optional unique identifier of the track to stream.</param>
/// <param name="deliveryId">Optional opaque handle of the normalized delivery.</param>
/// <param name="segmentIndex">Optional zero based index of the segment.</param>
/// <param name="libraryId">Optional unique identifier of the media library the track belongs to.</param>
/// <param name="includeDeliveryId">Whether the delivery handle should be included, or forced to <see langword="null"/>.</param>
/// <returns>A configured <see cref="StreamMusicTrackSegmentRequest"/> instance.</returns>
public StreamMusicTrackSegmentRequest Create(
string? artistId = null,
string? albumId = null,
string? trackId = null,
string? deliveryId = null,
int? segmentIndex = null,
Guid? libraryId = null,
bool includeDeliveryId = true)
{
return new StreamMusicTrackSegmentRequest(
artistId ?? Guid.NewGuid().ToString(),
albumId ?? Guid.NewGuid().ToString(),
trackId ?? Guid.NewGuid().ToString(),
includeDeliveryId ? (deliveryId ?? Guid.NewGuid().ToString("N")) : null!,
segmentIndex ?? Random.Shared.Next(0, 100),
libraryId ?? Guid.NewGuid());
}
/// <summary>
/// Creates a list of <see cref="StreamMusicTrackSegmentRequest"/> instances.
/// </summary>
/// <param name="count">Number of instances to create.</param>
/// <returns>List of configured <see cref="StreamMusicTrackSegmentRequest"/> instances.</returns>
public List<StreamMusicTrackSegmentRequest> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}