mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 06:11:10 +00:00
Implements tests for commit 45f9aa3bd5
This commit is contained in:
1 parent
d61a114d80
commit
aeefa9487e
44 files changed
+6929
-18
No files matched your search
+75
@@ -0,0 +1,75 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playback;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="NormalizedTrackDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class NormalizedTrackDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly NormalizedTrackSegmentDtoFixture _normalizedTrackSegmentDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="NormalizedTrackDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="trackId">Optional. The Id of the track whose audio the cached entry holds.</param>
|
||||
/// <param name="cacheId">Optional. The opaque identifier of the cached entry that holds the normalized audio.</param>
|
||||
/// <param name="mode">Optional. The way the audio is delivered.</param>
|
||||
/// <param name="container">Optional. The container of the delivered audio.</param>
|
||||
/// <param name="codec">Optional. The codec of the delivered audio.</param>
|
||||
/// <param name="segmentDurationSeconds">Optional. The duration of each segment of the delivered audio, in seconds.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the produced and cached audio, in seconds.</param>
|
||||
/// <param name="segments">Optional. The segments that make up the delivered audio, in playback order.</param>
|
||||
/// <param name="includeSegments">Whether the segments should be included, or forced to an empty collection.</param>
|
||||
/// <returns>The created <see cref="NormalizedTrackDto"/>.</returns>
|
||||
public NormalizedTrackDto Create(
|
||||
Guid? trackId = null,
|
||||
string? cacheId = null,
|
||||
PlaybackDeliveryMode? mode = null,
|
||||
string? container = null,
|
||||
string? codec = null,
|
||||
int? segmentDurationSeconds = null,
|
||||
int? durationInSeconds = null,
|
||||
IReadOnlyList<NormalizedTrackSegmentDto>? segments = null,
|
||||
bool includeSegments = true)
|
||||
{
|
||||
int resolvedSegmentDurationSeconds = segmentDurationSeconds ?? _faker.Random.Int(1, 30);
|
||||
List<NormalizedTrackSegmentDto> generatedSegments = [];
|
||||
int generatedSegmentCount = _faker.Random.Int(1, 6);
|
||||
for (int index = 0; index < generatedSegmentCount; index++)
|
||||
generatedSegments.Add(_normalizedTrackSegmentDtoFixture.Create(
|
||||
index: index,
|
||||
startSeconds: index * resolvedSegmentDurationSeconds,
|
||||
durationSeconds: resolvedSegmentDurationSeconds));
|
||||
|
||||
return new NormalizedTrackDto(
|
||||
trackId ?? _faker.Random.Guid(),
|
||||
cacheId ?? _faker.Random.Guid().ToString("N") + _faker.Random.Guid().ToString("N"),
|
||||
mode ?? _faker.PickRandom(PlaybackDeliveryMode.Remux, PlaybackDeliveryMode.Transcode),
|
||||
container ?? _faker.PickRandom("MP3", "AAC", "FLAC", "WAV", "OGG"),
|
||||
codec ?? _faker.PickRandom("MP3", "AAC", "FLAC", "PCM", "OPUS"),
|
||||
resolvedSegmentDurationSeconds,
|
||||
durationInSeconds ?? _faker.Random.Int(1, 3600),
|
||||
includeSegments ? (segments ?? generatedSegments) : []);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="NormalizedTrackDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="NormalizedTrackDto"/> instances.</returns>
|
||||
public List<NormalizedTrackDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playback;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="NormalizedTrackRequestDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class NormalizedTrackRequestDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="NormalizedTrackRequestDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="trackId">Optional. The Id of the track whose audio is normalized.</param>
|
||||
/// <param name="userId">Optional. The Id of the user whose request starts the production.</param>
|
||||
/// <param name="sourcePath">Optional. The file system path of the stored audio file of the track.</param>
|
||||
/// <param name="allowedRoots">Optional. The content locations the source path is allowed to be inside.</param>
|
||||
/// <param name="sourceContainer">Optional. The container of the stored audio file, as captured by the probe.</param>
|
||||
/// <param name="mode">Optional. The way the audio is delivered.</param>
|
||||
/// <param name="container">Optional. The container of the delivered audio.</param>
|
||||
/// <param name="codec">Optional. The codec of the delivered audio.</param>
|
||||
/// <param name="segmentDurationSeconds">Optional. The duration of each segment of the delivered audio, in seconds.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the audio of the track, in seconds.</param>
|
||||
/// <param name="bitrate">Optional. The stored audio bitrate of the track, in kbps.</param>
|
||||
/// <param name="sampleRate">Optional. The sample rate of the stored audio of the track, in Hz.</param>
|
||||
/// <param name="channels">Optional. The number of audio channels of the track.</param>
|
||||
/// <param name="bitDepth">Optional. The bit depth of the stored audio of the track.</param>
|
||||
/// <param name="quality">Optional. The quality cap applied to the delivered audio when it has to be re-encoded.</param>
|
||||
/// <param name="sourceLength">Optional. The length the source file had when the delivery was declared, in bytes.</param>
|
||||
/// <param name="sourceLastModifiedUtc">Optional. The last modification time the source file had when the delivery was declared.</param>
|
||||
/// <param name="includeSourceContainer">Whether the source container should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBitrate">Whether the bitrate should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBitDepth">Whether the bit depth should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="NormalizedTrackRequestDto"/>.</returns>
|
||||
public NormalizedTrackRequestDto Create(
|
||||
Guid? trackId = null,
|
||||
Guid? userId = null,
|
||||
string? sourcePath = null,
|
||||
IReadOnlyList<string>? allowedRoots = null,
|
||||
string? sourceContainer = null,
|
||||
PlaybackDeliveryMode? mode = null,
|
||||
string? container = null,
|
||||
string? codec = null,
|
||||
int? segmentDurationSeconds = null,
|
||||
int? durationInSeconds = null,
|
||||
int? bitrate = null,
|
||||
int? sampleRate = null,
|
||||
int? channels = null,
|
||||
int? bitDepth = null,
|
||||
PlaybackStreamingQuality? quality = null,
|
||||
long? sourceLength = null,
|
||||
DateTime? sourceLastModifiedUtc = null,
|
||||
bool includeSourceContainer = true,
|
||||
bool includeBitrate = true,
|
||||
bool includeBitDepth = true)
|
||||
{
|
||||
IReadOnlyList<string> resolvedAllowedRoots = allowedRoots ?? [Path.Combine(Path.GetTempPath(), "lumina-tests", _faker.Random.AlphaNumeric(12))];
|
||||
string resolvedSourcePath = sourcePath ?? (resolvedAllowedRoots.Count > 0
|
||||
? Path.Combine(resolvedAllowedRoots[0], "track-" + _faker.Random.AlphaNumeric(8) + ".flac")
|
||||
: Path.Combine(Path.GetTempPath(), "track-" + _faker.Random.AlphaNumeric(8) + ".flac"));
|
||||
|
||||
return new NormalizedTrackRequestDto(
|
||||
trackId ?? _faker.Random.Guid(),
|
||||
userId ?? _faker.Random.Guid(),
|
||||
resolvedSourcePath,
|
||||
resolvedAllowedRoots,
|
||||
includeSourceContainer ? (sourceContainer ?? _faker.PickRandom("FLAC", "MP3", "OGG", "MP4", "WAV")) : null,
|
||||
mode ?? _faker.PickRandom(PlaybackDeliveryMode.Remux, PlaybackDeliveryMode.Transcode),
|
||||
container ?? _faker.PickRandom("MP3", "AAC", "FLAC", "WAV", "OGG"),
|
||||
codec ?? _faker.PickRandom("MP3", "AAC", "FLAC", "PCM", "OPUS"),
|
||||
segmentDurationSeconds ?? _faker.Random.Int(1, 30),
|
||||
durationInSeconds ?? _faker.Random.Int(1, 3600),
|
||||
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null,
|
||||
sampleRate ?? _faker.PickRandom(44100, 48000, 96000),
|
||||
channels ?? _faker.PickRandom(1, 2, 6),
|
||||
includeBitDepth ? (bitDepth ?? _faker.Random.Int(16, 24)) : null,
|
||||
quality ?? _faker.PickRandom<PlaybackStreamingQuality>(),
|
||||
sourceLength ?? _faker.Random.Long(1, 100_000_000),
|
||||
sourceLastModifiedUtc ?? _faker.Date.Past().ToUniversalTime());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="NormalizedTrackRequestDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="NormalizedTrackRequestDto"/> instances.</returns>
|
||||
public List<NormalizedTrackRequestDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="NormalizedTrackSegmentDataDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class NormalizedTrackSegmentDataDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="NormalizedTrackSegmentDataDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="content">Optional. The read stream over the segment. When it is not supplied, a fresh empty <see cref="MemoryStream"/> is created.</param>
|
||||
/// <param name="length">Optional. The length of the segment, in bytes.</param>
|
||||
/// <param name="startSeconds">Optional. The exact start of the segment on the track timeline, in seconds.</param>
|
||||
/// <param name="container">Optional. The container of the delivered audio.</param>
|
||||
/// <param name="segmentCount">Optional. The number of segments the production holds.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the produced normalized audio, in seconds.</param>
|
||||
/// <returns>The created <see cref="NormalizedTrackSegmentDataDto"/>.</returns>
|
||||
public NormalizedTrackSegmentDataDto Create(
|
||||
Stream? content = null,
|
||||
long? length = null,
|
||||
decimal? startSeconds = null,
|
||||
string? container = null,
|
||||
int? segmentCount = null,
|
||||
int? durationInSeconds = null)
|
||||
{
|
||||
return new NormalizedTrackSegmentDataDto(
|
||||
content ?? new MemoryStream(),
|
||||
length ?? _faker.Random.Long(1, 10_000_000),
|
||||
startSeconds ?? _faker.Random.Decimal(0, 3600),
|
||||
container ?? _faker.PickRandom("MP3", "AAC", "FLAC", "WAV", "OGG"),
|
||||
segmentCount ?? _faker.Random.Int(1, 1000),
|
||||
durationInSeconds ?? _faker.Random.Int(1, 3600));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="NormalizedTrackSegmentDataDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="NormalizedTrackSegmentDataDto"/> instances.</returns>
|
||||
public List<NormalizedTrackSegmentDataDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="NormalizedTrackSegmentDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class NormalizedTrackSegmentDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="NormalizedTrackSegmentDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="index">Optional. The zero based position of the segment in the delivered audio.</param>
|
||||
/// <param name="startSeconds">Optional. The time, in seconds from the start of the track, at which the segment starts.</param>
|
||||
/// <param name="durationSeconds">Optional. The duration of the segment, in seconds.</param>
|
||||
/// <param name="length">Optional. The length of the segment, in bytes.</param>
|
||||
/// <returns>The created <see cref="NormalizedTrackSegmentDto"/>.</returns>
|
||||
public NormalizedTrackSegmentDto Create(
|
||||
int? index = null,
|
||||
decimal? startSeconds = null,
|
||||
decimal? durationSeconds = null,
|
||||
long? length = null)
|
||||
{
|
||||
return new NormalizedTrackSegmentDto(
|
||||
index ?? _faker.Random.Int(0, 1000),
|
||||
startSeconds ?? _faker.Random.Decimal(0, 3600),
|
||||
durationSeconds ?? _faker.Random.Decimal(1, 30),
|
||||
length ?? _faker.Random.Long(1, 10_000_000));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="NormalizedTrackSegmentDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="NormalizedTrackSegmentDto"/> instances.</returns>
|
||||
public List<NormalizedTrackSegmentDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playback;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PlaybackDeliveryDecisionDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PlaybackDeliveryDecisionDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="PlaybackDeliveryDecisionDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="mode">Optional. The way the audio is delivered.</param>
|
||||
/// <param name="container">Optional. The container of the delivered audio.</param>
|
||||
/// <param name="codec">Optional. The codec of the delivered audio.</param>
|
||||
/// <param name="shape">Optional. The shape the delivered audio is addressed and seeked by.</param>
|
||||
/// <param name="segmentDurationSeconds">Optional. The duration of each segment of the delivered audio, in seconds.</param>
|
||||
/// <returns>The created <see cref="PlaybackDeliveryDecisionDto"/>.</returns>
|
||||
public PlaybackDeliveryDecisionDto Create(
|
||||
PlaybackDeliveryMode? mode = null,
|
||||
string? container = null,
|
||||
string? codec = null,
|
||||
PlaybackDeliveryShape? shape = null,
|
||||
int? segmentDurationSeconds = null)
|
||||
{
|
||||
PlaybackDeliveryShape resolvedShape = shape ?? _faker.PickRandom<PlaybackDeliveryShape>();
|
||||
return new PlaybackDeliveryDecisionDto(
|
||||
mode ?? _faker.PickRandom(PlaybackDeliveryMode.Remux, PlaybackDeliveryMode.Transcode),
|
||||
container ?? _faker.PickRandom("MP3", "AAC", "FLAC", "WAV", "OGG"),
|
||||
codec ?? _faker.PickRandom("MP3", "AAC", "FLAC", "PCM", "OPUS"),
|
||||
resolvedShape,
|
||||
segmentDurationSeconds ?? (resolvedShape == PlaybackDeliveryShape.TimeAddressedSegments ? _faker.Random.Int(1, 30) : 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="PlaybackDeliveryDecisionDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PlaybackDeliveryDecisionDto"/> instances.</returns>
|
||||
public List<PlaybackDeliveryDecisionDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playback;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PlaybackDeliveryHandleDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PlaybackDeliveryHandleDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
private readonly NormalizedTrackRequestDtoFixture _normalizedTrackRequestDtoFixture = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="PlaybackDeliveryHandleDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">Optional. The complete normalization request the delivery declares.</param>
|
||||
/// <param name="shape">Optional. The shape the delivered audio is addressed by.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the library the track belongs to.</param>
|
||||
/// <param name="albumId">Optional. The Id of the album the track belongs to.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist that owns the album.</param>
|
||||
/// <returns>The created <see cref="PlaybackDeliveryHandleDto"/>.</returns>
|
||||
public PlaybackDeliveryHandleDto Create(
|
||||
NormalizedTrackRequestDto? request = null,
|
||||
PlaybackDeliveryShape? shape = null,
|
||||
Guid? libraryId = null,
|
||||
Guid? albumId = null,
|
||||
Guid? artistId = null)
|
||||
{
|
||||
return new PlaybackDeliveryHandleDto(
|
||||
request ?? _normalizedTrackRequestDtoFixture.Create(),
|
||||
shape ?? _faker.PickRandom<PlaybackDeliveryShape>(),
|
||||
libraryId ?? _faker.Random.Guid(),
|
||||
albumId ?? _faker.Random.Guid(),
|
||||
artistId ?? _faker.Random.Guid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="PlaybackDeliveryHandleDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PlaybackDeliveryHandleDto"/> instances.</returns>
|
||||
public List<PlaybackDeliveryHandleDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="TrackPlaybackManifestDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class TrackPlaybackManifestDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="TrackPlaybackManifestDto"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">Optional. The file system path of the stored audio file of the track.</param>
|
||||
/// <param name="container">Optional. The container of the audio file of the track.</param>
|
||||
/// <param name="audioCodec">Optional. The audio codec used by the audio file of the track.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the audio of the track, in seconds.</param>
|
||||
/// <param name="sampleRate">Optional. The sample rate of the audio of the track, in Hz.</param>
|
||||
/// <param name="channels">Optional. The number of audio channels of the track.</param>
|
||||
/// <param name="bitDepth">Optional. The bit depth of the audio of the track.</param>
|
||||
/// <param name="bitrate">Optional. The bitrate of the audio of the track, in kbps.</param>
|
||||
/// <param name="replayGainTrackGain">Optional. The ReplayGain track gain of the track, in decibels.</param>
|
||||
/// <param name="replayGainTrackPeak">Optional. The ReplayGain track peak of the track.</param>
|
||||
/// <param name="replayGainAlbumGain">Optional. The ReplayGain album gain of the track, in decibels.</param>
|
||||
/// <param name="replayGainAlbumPeak">Optional. The ReplayGain album peak of the track.</param>
|
||||
/// <param name="includeContainer">Whether the container should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAudioCodec">Whether the audio codec should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBitDepth">Whether the bit depth should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBitrate">Whether the bitrate should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReplayGain">Whether the ReplayGain values should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="TrackPlaybackManifestDto"/>.</returns>
|
||||
public TrackPlaybackManifestDto Create(
|
||||
string? path = null,
|
||||
string? container = null,
|
||||
string? audioCodec = null,
|
||||
int? durationInSeconds = null,
|
||||
int? sampleRate = null,
|
||||
int? channels = null,
|
||||
int? bitDepth = null,
|
||||
int? bitrate = null,
|
||||
decimal? replayGainTrackGain = null,
|
||||
decimal? replayGainTrackPeak = null,
|
||||
decimal? replayGainAlbumGain = null,
|
||||
decimal? replayGainAlbumPeak = null,
|
||||
bool includeContainer = true,
|
||||
bool includeAudioCodec = true,
|
||||
bool includeBitDepth = true,
|
||||
bool includeBitrate = true,
|
||||
bool includeReplayGain = true)
|
||||
{
|
||||
return new TrackPlaybackManifestDto(
|
||||
path ?? Path.Combine(_faker.System.DirectoryPath(), _faker.System.FileName("flac")),
|
||||
includeContainer ? (container ?? _faker.PickRandom("FLAC", "MP3", "OGG", "MP4", "AAC", "WAV")) : null,
|
||||
includeAudioCodec ? (audioCodec ?? _faker.PickRandom("FLAC", "MP3", "AAC", "ALAC", "PCM")) : null,
|
||||
durationInSeconds ?? _faker.Random.Int(1, 3600),
|
||||
sampleRate ?? _faker.PickRandom(44100, 48000, 96000),
|
||||
channels ?? _faker.PickRandom(1, 2, 6),
|
||||
includeBitDepth ? (bitDepth ?? _faker.Random.Int(8, 32)) : null,
|
||||
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null,
|
||||
includeReplayGain ? (replayGainTrackGain ?? _faker.Random.Decimal(-20m, 0m)) : null,
|
||||
includeReplayGain ? (replayGainTrackPeak ?? _faker.Random.Decimal(0m, 1.5m)) : null,
|
||||
includeReplayGain ? (replayGainAlbumGain ?? _faker.Random.Decimal(-20m, 0m)) : null,
|
||||
includeReplayGain ? (replayGainAlbumPeak ?? _faker.Random.Decimal(0m, 1.5m)) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="TrackPlaybackManifestDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="TrackPlaybackManifestDto"/> instances.</returns>
|
||||
public List<TrackPlaybackManifestDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Queries.GetPlaybackManifest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Queries.GetPlaybackManifest;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetPlaybackManifestQuery"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetPlaybackManifestQueryFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get the playback manifest of a track.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the track belongs to.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist the album of the track belongs to.</param>
|
||||
/// <param name="albumId">Optional. The Id of the album the track belongs to.</param>
|
||||
/// <param name="trackId">Optional. The Id of the track whose playback manifest is retrieved.</param>
|
||||
/// <param name="capabilities">Optional. The container and codec pairs the player advertises it can demux and decode directly.</param>
|
||||
/// <param name="streamPath">Optional. The path of the track stream, relative to the API.</param>
|
||||
/// <param name="segmentStreamPathTemplate">Optional. The path template of the segment route, relative to the API.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</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>
|
||||
/// <param name="includeCapabilities">Whether the capabilities should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetPlaybackManifestQuery"/>.</returns>
|
||||
public GetPlaybackManifestQuery Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
string? trackId = null,
|
||||
string? capabilities = null,
|
||||
string? streamPath = null,
|
||||
string? segmentStreamPathTemplate = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true,
|
||||
bool includeAlbumId = true,
|
||||
bool includeTrackId = true,
|
||||
bool includeCapabilities = true)
|
||||
{
|
||||
return new GetPlaybackManifestQuery(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeAlbumId ? (albumId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeTrackId ? (trackId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeCapabilities ? (capabilities ?? "mp3/mp3,flac/flac") : null,
|
||||
streamPath ?? "/api/v1/music/libraries/" + _faker.Random.AlphaNumeric(8) + "/tracks/" + _faker.Random.AlphaNumeric(8) + "/stream",
|
||||
segmentStreamPathTemplate ?? "/api/v1/music/libraries/" + _faker.Random.AlphaNumeric(8) + "/tracks/" + _faker.Random.AlphaNumeric(8) + "/stream/segments/{deliveryId}/{segmentIndex}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetPlaybackManifestQuery"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetPlaybackManifestQuery"/> instances.</returns>
|
||||
public List<GetPlaybackManifestQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Queries.GetTrackSegment;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Fixtures.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Queries.GetTrackSegment;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="GetTrackSegmentQuery"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetTrackSegmentQueryFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid query to get a single segment of the normalized audio of a track.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">Optional. The Id of the media library the track belongs to.</param>
|
||||
/// <param name="artistId">Optional. The Id of the artist the album of the track belongs to.</param>
|
||||
/// <param name="albumId">Optional. The Id of the album the track belongs to.</param>
|
||||
/// <param name="trackId">Optional. The Id of the track whose normalized audio is streamed.</param>
|
||||
/// <param name="deliveryId">Optional. The opaque handle of the normalized delivery the segment belongs to.</param>
|
||||
/// <param name="segmentIndex">Optional. The zero based index of the segment of the normalized audio.</param>
|
||||
/// <param name="includeLibraryId">Whether the library Id should be included, or forced to <see langword="null"/>.</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>
|
||||
/// <param name="includeDeliveryId">Whether the delivery Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSegmentIndex">Whether the segment index should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="GetTrackSegmentQuery"/>.</returns>
|
||||
public GetTrackSegmentQuery Create(
|
||||
string? libraryId = null,
|
||||
string? artistId = null,
|
||||
string? albumId = null,
|
||||
string? trackId = null,
|
||||
string? deliveryId = null,
|
||||
string? segmentIndex = null,
|
||||
bool includeLibraryId = true,
|
||||
bool includeArtistId = true,
|
||||
bool includeAlbumId = true,
|
||||
bool includeTrackId = true,
|
||||
bool includeDeliveryId = true,
|
||||
bool includeSegmentIndex = true)
|
||||
{
|
||||
return new GetTrackSegmentQuery(
|
||||
includeLibraryId ? (libraryId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeArtistId ? (artistId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeAlbumId ? (albumId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeTrackId ? (trackId ?? Guid.NewGuid().ToString()) : null,
|
||||
includeDeliveryId ? (deliveryId ?? Guid.NewGuid().ToString("N")) : null,
|
||||
includeSegmentIndex ? (segmentIndex ?? _faker.Random.Int(0, 1000).ToString()) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="GetTrackSegmentQuery"/> instances.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="GetTrackSegmentQuery"/> instances.</returns>
|
||||
public List<GetTrackSegmentQuery> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Playback;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Playback;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PlaybackManifestResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PlaybackManifestResponseFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="PlaybackManifestResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="trackId">Optional. The Id of the track the manifest describes.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the audio of the track, in seconds.</param>
|
||||
/// <param name="sourceContainer">Optional. The container of the stored audio file of the track.</param>
|
||||
/// <param name="sourceCodec">Optional. The codec of the stored audio of the track.</param>
|
||||
/// <param name="sampleRate">Optional. The sample rate of the stored audio, in Hz.</param>
|
||||
/// <param name="channels">Optional. The number of audio channels of the track.</param>
|
||||
/// <param name="bitDepth">Optional. The bit depth of the stored audio of the track.</param>
|
||||
/// <param name="replayGainTrackGain">Optional. The ReplayGain track gain of the track, in decibels.</param>
|
||||
/// <param name="replayGainTrackPeak">Optional. The ReplayGain track peak of the track.</param>
|
||||
/// <param name="replayGainAlbumGain">Optional. The ReplayGain album gain of the track, in decibels.</param>
|
||||
/// <param name="replayGainAlbumPeak">Optional. The ReplayGain album peak of the track.</param>
|
||||
/// <param name="isDirectPlay">Whether the stored audio is delivered as it is.</param>
|
||||
/// <param name="deliveryContainer">Optional. The container of the delivered audio.</param>
|
||||
/// <param name="deliveryCodec">Optional. The codec of the delivered audio.</param>
|
||||
/// <param name="deliveryShape">Optional. The shape the delivered audio is addressed by.</param>
|
||||
/// <param name="segmentDurationSeconds">Optional. The duration of each segment of the delivered audio, in seconds.</param>
|
||||
/// <param name="isSeekable">Whether the delivered audio can be seeked by the player.</param>
|
||||
/// <param name="streamPath">Optional. The relative path of the track stream.</param>
|
||||
/// <param name="deliveryId">Optional. The opaque handle of the normalized delivery.</param>
|
||||
/// <param name="segmentStreamPathTemplate">Optional. The relative path template of the segment route.</param>
|
||||
/// <param name="includeBitDepth">Whether the bit depth should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReplayGain">Whether the ReplayGain values should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeliveryContainer">Whether the delivery container should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeliveryCodec">Whether the delivery codec should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeliveryShape">Whether the delivery shape should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSegmentDurationSeconds">Whether the segment duration should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeliveryId">Whether the delivery handle should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSegmentStreamPathTemplate">Whether the segment path template should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="PlaybackManifestResponse"/>.</returns>
|
||||
public PlaybackManifestResponse Create(
|
||||
Guid? trackId = null,
|
||||
int? durationInSeconds = null,
|
||||
string? sourceContainer = null,
|
||||
string? sourceCodec = null,
|
||||
int? sampleRate = null,
|
||||
int? channels = null,
|
||||
int? bitDepth = null,
|
||||
decimal? replayGainTrackGain = null,
|
||||
decimal? replayGainTrackPeak = null,
|
||||
decimal? replayGainAlbumGain = null,
|
||||
decimal? replayGainAlbumPeak = null,
|
||||
bool isDirectPlay = false,
|
||||
string? deliveryContainer = null,
|
||||
string? deliveryCodec = null,
|
||||
PlaybackDeliveryShape? deliveryShape = null,
|
||||
int? segmentDurationSeconds = null,
|
||||
bool isSeekable = true,
|
||||
string? streamPath = null,
|
||||
string? deliveryId = null,
|
||||
string? segmentStreamPathTemplate = null,
|
||||
bool includeBitDepth = true,
|
||||
bool includeReplayGain = true,
|
||||
bool includeDeliveryContainer = true,
|
||||
bool includeDeliveryCodec = true,
|
||||
bool includeDeliveryShape = true,
|
||||
bool includeSegmentDurationSeconds = true,
|
||||
bool includeDeliveryId = true,
|
||||
bool includeSegmentStreamPathTemplate = true)
|
||||
{
|
||||
Guid resolvedTrackId = trackId ?? _faker.Random.Guid();
|
||||
string resolvedDeliveryId = deliveryId ?? Guid.NewGuid().ToString("N");
|
||||
return new PlaybackManifestResponse(
|
||||
resolvedTrackId,
|
||||
durationInSeconds ?? _faker.Random.Int(1, 3600),
|
||||
sourceContainer ?? _faker.PickRandom("FLAC", "MP3", "OGG", "MP4", "AAC", "WAV"),
|
||||
sourceCodec ?? _faker.PickRandom("FLAC", "MP3", "AAC", "ALAC", "OPUS", "PCM"),
|
||||
sampleRate ?? _faker.PickRandom(44100, 48000, 96000),
|
||||
channels ?? _faker.PickRandom(1, 2, 6),
|
||||
includeBitDepth ? (bitDepth ?? _faker.Random.Int(8, 32)) : null,
|
||||
includeReplayGain ? (replayGainTrackGain ?? _faker.Random.Decimal(-20m, 0m)) : null,
|
||||
includeReplayGain ? (replayGainTrackPeak ?? _faker.Random.Decimal(0m, 1.5m)) : null,
|
||||
includeReplayGain ? (replayGainAlbumGain ?? _faker.Random.Decimal(-20m, 0m)) : null,
|
||||
includeReplayGain ? (replayGainAlbumPeak ?? _faker.Random.Decimal(0m, 1.5m)) : null,
|
||||
isDirectPlay,
|
||||
includeDeliveryContainer ? (deliveryContainer ?? "MP3") : null,
|
||||
includeDeliveryCodec ? (deliveryCodec ?? "MP3") : null,
|
||||
includeDeliveryShape ? (deliveryShape ?? PlaybackDeliveryShape.TimeAddressedSegments) : null,
|
||||
includeSegmentDurationSeconds ? (segmentDurationSeconds ?? 6) : null,
|
||||
isSeekable,
|
||||
streamPath ?? $"/libraries/{Guid.NewGuid():N}/artists/{Guid.NewGuid():N}/albums/{Guid.NewGuid():N}/tracks/{resolvedTrackId:N}/stream",
|
||||
includeDeliveryId ? resolvedDeliveryId : null,
|
||||
includeSegmentStreamPathTemplate
|
||||
? (segmentStreamPathTemplate ?? $"/libraries/{Guid.NewGuid():N}/artists/{Guid.NewGuid():N}/albums/{Guid.NewGuid():N}/tracks/{resolvedTrackId:N}/stream/deliveries/{{deliveryId}}/segments/{{segmentIndex}}")
|
||||
: null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a list of <see cref="PlaybackManifestResponse"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PlaybackManifestResponse"/> instances.</returns>
|
||||
public List<PlaybackManifestResponse> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+10
-5
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Infrastructure.Common.Models.DTO.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@@ -31,6 +32,7 @@ public class TranscodingSettingsDtoFixture
|
||||
/// default temporary directory.
|
||||
/// </param>
|
||||
/// <param name="includeCacheDirectory">Whether to generate the optional cache directory, defaulting to <see langword="true"/>.</param>
|
||||
/// <param name="includeFfmpegPath">Whether the ffmpeg path should be included, or forced to <see langword="null"/>, defaulting to <see langword="true"/>.</param>
|
||||
/// <returns>A configured <see cref="TranscodingSettingsDto"/> instance.</returns>
|
||||
public TranscodingSettingsDto Create(
|
||||
string? ffmpegPath = null,
|
||||
@@ -40,16 +42,19 @@ public class TranscodingSettingsDtoFixture
|
||||
int? jobTimeoutSeconds = null,
|
||||
int? evictionGraceSeconds = null,
|
||||
string? cacheDirectory = null,
|
||||
bool includeCacheDirectory = true)
|
||||
bool includeCacheDirectory = true,
|
||||
bool includeFfmpegPath = true)
|
||||
{
|
||||
int resolvedMaxConcurrentJobs = maxConcurrentJobs ?? _faker.Random.Int(1, 16);
|
||||
return new TranscodingSettingsDto
|
||||
{
|
||||
FfmpegPath = ffmpegPath ?? _faker.System.FileName("exe"),
|
||||
MaxConcurrentJobs = maxConcurrentJobs ?? _faker.Random.Int(1, 16),
|
||||
MaxConcurrentJobsPerUser = maxConcurrentJobsPerUser ?? _faker.Random.Int(1, 8),
|
||||
FfmpegPath = includeFfmpegPath ? (ffmpegPath ?? _faker.System.FileName("exe")) : null!,
|
||||
MaxConcurrentJobs = resolvedMaxConcurrentJobs,
|
||||
// A per-user limit above the global one is rejected by the validator, so the generated value never exceeds the global limit.
|
||||
MaxConcurrentJobsPerUser = maxConcurrentJobsPerUser ?? _faker.Random.Int(1, Math.Max(1, resolvedMaxConcurrentJobs)),
|
||||
MaxCacheBytes = maxCacheBytes ?? _faker.Random.Long(1_000_000_000, 8_589_934_592),
|
||||
JobTimeoutSeconds = jobTimeoutSeconds ?? _faker.Random.Int(60, 3600),
|
||||
EvictionGraceSeconds = evictionGraceSeconds ?? _faker.Random.Int(0, 600),
|
||||
EvictionGraceSeconds = evictionGraceSeconds ?? _faker.Random.Int(1, 600),
|
||||
CacheDirectory = includeCacheDirectory ? cacheDirectory ?? _faker.System.DirectoryPath() : null
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Api;
|
||||
|
||||
/// <summary>
|
||||
/// A streamed request that was sent to the <see cref="StubStreamingApiHttpClient"/> stub.
|
||||
/// </summary>
|
||||
/// <param name="Endpoint">The endpoint the stream was requested from.</param>
|
||||
/// <param name="Headers">The request headers that were forwarded with the request.</param>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public record StubStreamRequest(string Endpoint, IReadOnlyDictionary<string, string> Headers);
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Api;
|
||||
|
||||
/// <summary>
|
||||
/// Test double for the <see cref="IStreamingApiHttpClient"/> interface, allowing integration and security tests to stub the
|
||||
/// streamed responses of the remote API without hosting a real backend.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class StubStreamingApiHttpClient : IStreamingApiHttpClient
|
||||
{
|
||||
private readonly Dictionary<string, Func<ApiStreamResult>> _streamResponseFactories = [];
|
||||
private readonly Dictionary<string, Func<Exception>> _streamExceptionFactories = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the streamed requests that were sent, with the headers that were forwarded with them.
|
||||
/// </summary>
|
||||
public List<StubStreamRequest> StreamRequests { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of endpoints the streams were requested from.
|
||||
/// </summary>
|
||||
public List<string> GetEndpointsCalled { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Registers the streamed response returned when the specified endpoint is called.
|
||||
/// </summary>
|
||||
/// <param name="endpoint">The API endpoint for which to register the response.</param>
|
||||
/// <param name="response">The streamed response to return.</param>
|
||||
public void RegisterStreamResponse(string endpoint, ApiStreamResult response)
|
||||
{
|
||||
_streamResponseFactories[endpoint] = () => response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the response factory invoked when the specified endpoint is called.
|
||||
/// </summary>
|
||||
/// <param name="endpoint">The API endpoint for which to register the response factory.</param>
|
||||
/// <param name="responseFactory">The factory that produces the streamed response.</param>
|
||||
public void RegisterStreamResponseFactory(string endpoint, Func<ApiStreamResult> responseFactory)
|
||||
{
|
||||
_streamResponseFactories[endpoint] = responseFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the exception thrown when the specified endpoint is called.
|
||||
/// </summary>
|
||||
/// <param name="endpoint">The API endpoint for which to register the exception.</param>
|
||||
/// <param name="exception">The exception to throw.</param>
|
||||
public void RegisterStreamException(string endpoint, Exception exception)
|
||||
{
|
||||
_streamExceptionFactories[endpoint] = () => exception;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets all registered responses and captured requests.
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
_streamResponseFactories.Clear();
|
||||
_streamExceptionFactories.Clear();
|
||||
StreamRequests.Clear();
|
||||
GetEndpointsCalled.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a GET request to the specified <paramref name="endpoint"/> as an asynchronous operation and returns the response as a stream.
|
||||
/// </summary>
|
||||
/// <param name="endpoint">The API endpoint where the request is being sent.</param>
|
||||
/// <param name="requestHeaders">The range and conditional headers of the incoming request to forward.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>The streamed response of the API request.</returns>
|
||||
public Task<ApiStreamResult> GetStreamAsync(string endpoint, IReadOnlyDictionary<string, string> requestHeaders, CancellationToken cancellationToken = default)
|
||||
{
|
||||
GetEndpointsCalled.Add(endpoint);
|
||||
StreamRequests.Add(new StubStreamRequest(endpoint, new Dictionary<string, string>(requestHeaders)));
|
||||
if (_streamExceptionFactories.TryGetValue(endpoint, out Func<Exception>? exceptionFactory))
|
||||
throw exceptionFactory();
|
||||
if (_streamResponseFactories.TryGetValue(endpoint, out Func<ApiStreamResult>? responseFactory))
|
||||
return Task.FromResult(responseFactory());
|
||||
throw new InvalidOperationException($"No stream response is registered for the endpoint '{endpoint}'.");
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
using Lumina.Presentation.Web.Common.Enums.AudioLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.DTO.AudioLibrary.MusicLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="PlaybackManifestDto"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PlaybackManifestDtoFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="PlaybackManifestDto"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="trackId">Optional. The Id of the track the manifest describes.</param>
|
||||
/// <param name="durationInSeconds">Optional. The duration of the audio of the track, in seconds.</param>
|
||||
/// <param name="sourceContainer">Optional. The container of the stored audio file of the track.</param>
|
||||
/// <param name="sourceCodec">Optional. The codec of the stored audio of the track.</param>
|
||||
/// <param name="sampleRate">Optional. The sample rate of the stored audio, in Hz.</param>
|
||||
/// <param name="channels">Optional. The number of audio channels of the track.</param>
|
||||
/// <param name="bitDepth">Optional. The bit depth of the stored audio of the track.</param>
|
||||
/// <param name="replayGainTrackGain">Optional. The ReplayGain track gain of the track, in decibels.</param>
|
||||
/// <param name="replayGainTrackPeak">Optional. The ReplayGain track peak of the track.</param>
|
||||
/// <param name="replayGainAlbumGain">Optional. The ReplayGain album gain of the track, in decibels.</param>
|
||||
/// <param name="replayGainAlbumPeak">Optional. The ReplayGain album peak of the track.</param>
|
||||
/// <param name="isDirectPlay">Whether the stored audio is delivered as it is.</param>
|
||||
/// <param name="deliveryContainer">Optional. The container of the delivered audio.</param>
|
||||
/// <param name="deliveryCodec">Optional. The codec of the delivered audio.</param>
|
||||
/// <param name="deliveryShape">Optional. The shape the delivered audio is addressed by.</param>
|
||||
/// <param name="segmentDurationSeconds">Optional. The duration of each segment of the delivered audio, in seconds.</param>
|
||||
/// <param name="isSeekable">Whether the delivered audio can be seeked by the player.</param>
|
||||
/// <param name="streamPath">Optional. The relative path of the track stream.</param>
|
||||
/// <param name="deliveryId">Optional. The opaque handle of the normalized delivery.</param>
|
||||
/// <param name="segmentStreamPathTemplate">Optional. The relative path template of the segment route.</param>
|
||||
/// <param name="includeBitDepth">Whether the bit depth should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReplayGain">Whether the ReplayGain values should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeliveryContainer">Whether the delivery container should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeliveryCodec">Whether the delivery codec should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeliveryShape">Whether the delivery shape should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSegmentDurationSeconds">Whether the segment duration should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeDeliveryId">Whether the delivery handle should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeSegmentStreamPathTemplate">Whether the segment path template should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>A configured <see cref="PlaybackManifestDto"/> instance.</returns>
|
||||
public PlaybackManifestDto Create(
|
||||
Guid? trackId = null,
|
||||
int? durationInSeconds = null,
|
||||
string? sourceContainer = null,
|
||||
string? sourceCodec = null,
|
||||
int? sampleRate = null,
|
||||
int? channels = null,
|
||||
int? bitDepth = null,
|
||||
decimal? replayGainTrackGain = null,
|
||||
decimal? replayGainTrackPeak = null,
|
||||
decimal? replayGainAlbumGain = null,
|
||||
decimal? replayGainAlbumPeak = null,
|
||||
bool isDirectPlay = false,
|
||||
string? deliveryContainer = null,
|
||||
string? deliveryCodec = null,
|
||||
PlaybackDeliveryShape? deliveryShape = null,
|
||||
int? segmentDurationSeconds = null,
|
||||
bool isSeekable = true,
|
||||
string? streamPath = null,
|
||||
string? deliveryId = null,
|
||||
string? segmentStreamPathTemplate = null,
|
||||
bool includeBitDepth = true,
|
||||
bool includeReplayGain = true,
|
||||
bool includeDeliveryContainer = true,
|
||||
bool includeDeliveryCodec = true,
|
||||
bool includeDeliveryShape = true,
|
||||
bool includeSegmentDurationSeconds = true,
|
||||
bool includeDeliveryId = true,
|
||||
bool includeSegmentStreamPathTemplate = true)
|
||||
{
|
||||
Guid resolvedTrackId = trackId ?? _faker.Random.Guid();
|
||||
return new PlaybackManifestDto
|
||||
{
|
||||
TrackId = resolvedTrackId,
|
||||
DurationInSeconds = durationInSeconds ?? _faker.Random.Int(1, 3600),
|
||||
SourceContainer = sourceContainer ?? _faker.PickRandom("FLAC", "MP3", "OGG", "MP4", "AAC", "WAV"),
|
||||
SourceCodec = sourceCodec ?? _faker.PickRandom("FLAC", "MP3", "AAC", "ALAC", "OPUS", "PCM"),
|
||||
SampleRate = sampleRate ?? _faker.PickRandom(44100, 48000, 96000),
|
||||
Channels = channels ?? _faker.PickRandom(1, 2, 6),
|
||||
BitDepth = includeBitDepth ? (bitDepth ?? _faker.Random.Int(8, 32)) : null,
|
||||
ReplayGainTrackGain = includeReplayGain ? (replayGainTrackGain ?? _faker.Random.Decimal(-20m, 0m)) : null,
|
||||
ReplayGainTrackPeak = includeReplayGain ? (replayGainTrackPeak ?? _faker.Random.Decimal(0m, 1.5m)) : null,
|
||||
ReplayGainAlbumGain = includeReplayGain ? (replayGainAlbumGain ?? _faker.Random.Decimal(-20m, 0m)) : null,
|
||||
ReplayGainAlbumPeak = includeReplayGain ? (replayGainAlbumPeak ?? _faker.Random.Decimal(0m, 1.5m)) : null,
|
||||
IsDirectPlay = isDirectPlay,
|
||||
DeliveryContainer = includeDeliveryContainer ? (deliveryContainer ?? "MP3") : null,
|
||||
DeliveryCodec = includeDeliveryCodec ? (deliveryCodec ?? "MP3") : null,
|
||||
DeliveryShape = includeDeliveryShape ? (deliveryShape ?? PlaybackDeliveryShape.TimeAddressedSegments) : null,
|
||||
SegmentDurationSeconds = includeSegmentDurationSeconds ? (segmentDurationSeconds ?? 6) : null,
|
||||
IsSeekable = isSeekable,
|
||||
StreamPath = streamPath ?? $"/libraries/{Guid.NewGuid():N}/artists/{Guid.NewGuid():N}/albums/{Guid.NewGuid():N}/tracks/{resolvedTrackId:N}/stream",
|
||||
DeliveryId = includeDeliveryId ? (deliveryId ?? Guid.NewGuid().ToString("N")) : null,
|
||||
SegmentStreamPathTemplate = includeSegmentStreamPathTemplate
|
||||
? (segmentStreamPathTemplate ?? $"/libraries/{Guid.NewGuid():N}/artists/{Guid.NewGuid():N}/albums/{Guid.NewGuid():N}/tracks/{resolvedTrackId:N}/stream/deliveries/{{deliveryId}}/segments/{{segmentIndex}}")
|
||||
: null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="PlaybackManifestDto"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="PlaybackManifestDto"/> instances.</returns>
|
||||
public List<PlaybackManifestDto> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
+52
@@ -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())];
|
||||
}
|
||||
}
|
||||
+53
@@ -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())];
|
||||
}
|
||||
}
|
||||
+55
@@ -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())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user