mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Adds the music library track test suite
This commit is contained in:
1 parent
dc2692e208
commit
12d310631b
89 files changed
+18849
-9
No files matched your search
@@ -0,0 +1,45 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Fixtures.Common.ValueObjects.Metadata;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for the <see cref="Mood"/> domain value object.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MoodFixture
|
||||
{
|
||||
private readonly Faker _faker = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random valid <see cref="Mood"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">Optional. The name of the mood. If not provided, a random name is generated.</param>
|
||||
/// <returns>The created <see cref="Mood"/>.</returns>
|
||||
public Mood Create(
|
||||
string? name = null)
|
||||
{
|
||||
Result<Mood> moodResult = Mood.Create(name ?? _faker.Lorem.Word());
|
||||
|
||||
if (moodResult.IsFailure)
|
||||
throw new InvalidOperationException("Failed to create Mood: " + string.Join(", ", moodResult.Errors));
|
||||
return moodResult.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="Mood"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="Mood"/> instances.</returns>
|
||||
public List<Mood> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user