Adds the scheduling module tests and centralizes domain event test fixtures

This commit is contained in:
BinaryAlley committed 2026-09-04 00:16:41 -07:00
1 parent 237be9e2c8
commit 99a6159f7f
135 files changed
+10203 -165

No files matched your search

@@ -0,0 +1,33 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.Events;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryDeletedDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryDeletedDomainEventFixture
{
private readonly LibraryFixture _libraryFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryDeletedDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="library">Optional. The library that was deleted.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <returns>The created <see cref="LibraryDeletedDomainEvent"/>.</returns>
public LibraryDeletedDomainEvent Create(Guid? id = null, Library? library = null, DateTime? occurredOnUtc = null)
{
return new LibraryDeletedDomainEvent(
id ?? Guid.NewGuid(),
library ?? _libraryFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow);
}
}
@@ -0,0 +1,47 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryMediaItemDeletedDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryMediaItemDeletedDomainEventFixture
{
private readonly Faker _faker = new();
private readonly LibraryIdFixture _libraryIdFixture = new();
private readonly MediaLibraryScanCompositeIdFixture _mediaLibraryScanCompositeIdFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryMediaItemDeletedDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="libraryId">Optional. The unique identifier of the library to which the deleted media library item belonged.</param>
/// <param name="mediaLibraryScanCompositeId">Optional. The composite identifier of the media library scan during which the item deletion was detected.</param>
/// <param name="path">Optional. The path of the media library item that was deleted.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <returns>The created <see cref="LibraryMediaItemDeletedDomainEvent"/>.</returns>
public LibraryMediaItemDeletedDomainEvent Create(
Guid? id = null,
LibraryId? libraryId = null,
MediaLibraryScanCompositeId? mediaLibraryScanCompositeId = null,
string? path = null,
DateTime? occurredOnUtc = null)
{
return new LibraryMediaItemDeletedDomainEvent(
id ?? Guid.NewGuid(),
libraryId ?? _libraryIdFixture.Create(),
mediaLibraryScanCompositeId ?? _mediaLibraryScanCompositeIdFixture.Create(),
path ?? _faker.System.FilePath(),
occurredOnUtc ?? DateTime.UtcNow);
}
}
@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryScanCancelledDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryScanCancelledDomainEventFixture
{
private readonly ScanIdFixture _scanIdFixture = new();
private readonly LibraryIdFixture _libraryIdFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryScanCancelledDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="scanId">Optional. The unique identifier of the cancelled media library scan.</param>
/// <param name="libraryId">Optional. The unique identifier of the library whose scan was cancelled.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <returns>The created <see cref="LibraryScanCancelledDomainEvent"/>.</returns>
public LibraryScanCancelledDomainEvent Create(
Guid? id = null,
ScanId? scanId = null,
LibraryId? libraryId = null,
DateTime? occurredOnUtc = null)
{
return new LibraryScanCancelledDomainEvent(
id ?? Guid.NewGuid(),
scanId ?? _scanIdFixture.Create(),
libraryId ?? _libraryIdFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow);
}
}
@@ -0,0 +1,49 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryScanFailedDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryScanFailedDomainEventFixture
{
private readonly Faker _faker = new();
private readonly LibraryIdFixture _libraryIdFixture = new();
private readonly MediaLibraryScanCompositeIdFixture _mediaLibraryScanCompositeIdFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryScanFailedDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="libraryId">Optional. The unique identifier of the library whose scan has failed.</param>
/// <param name="mediaLibraryScanCompositeId">Optional. The composite identifier of the media library scan that has failed.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <param name="errorMessage">Optional. The descriptive message of the failure.</param>
/// <param name="includeErrorMessage">Whether to include an error message in the domain event. When false, the error message is left unset.</param>
/// <returns>The created <see cref="LibraryScanFailedDomainEvent"/>.</returns>
public LibraryScanFailedDomainEvent Create(
Guid? id = null,
LibraryId? libraryId = null,
MediaLibraryScanCompositeId? mediaLibraryScanCompositeId = null,
DateTime? occurredOnUtc = null,
string? errorMessage = null,
bool includeErrorMessage = true)
{
return new LibraryScanFailedDomainEvent(
id ?? Guid.NewGuid(),
libraryId ?? _libraryIdFixture.Create(),
mediaLibraryScanCompositeId ?? _mediaLibraryScanCompositeIdFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow,
includeErrorMessage ? (errorMessage ?? _faker.Random.Words()) : null);
}
}
@@ -0,0 +1,36 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryScanFinishedDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryScanFinishedDomainEventFixture
{
private readonly MediaLibraryScanCompositeIdFixture _mediaLibraryScanCompositeIdFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryScanFinishedDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="mediaLibraryScanCompositeId">Optional. The composite identifier of the media library scan that was finished.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <returns>The created <see cref="LibraryScanFinishedDomainEvent"/>.</returns>
public LibraryScanFinishedDomainEvent Create(
Guid? id = null,
MediaLibraryScanCompositeId? mediaLibraryScanCompositeId = null,
DateTime? occurredOnUtc = null)
{
return new LibraryScanFinishedDomainEvent(
id ?? Guid.NewGuid(),
mediaLibraryScanCompositeId ?? _mediaLibraryScanCompositeIdFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow);
}
}
@@ -0,0 +1,46 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryScanJobProgressChangedDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryScanJobProgressChangedDomainEventFixture
{
private readonly LibraryIdFixture _libraryIdFixture = new();
private readonly MediaLibraryScanCompositeIdFixture _mediaLibraryScanCompositeIdFixture = new();
private readonly MediaLibraryScanJobProgressFixture _mediaLibraryScanJobProgressFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryScanJobProgressChangedDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="libraryId">Optional. The unique identifier of the library being scanned.</param>
/// <param name="mediaLibraryScanCompositeId">Optional. The composite identifier of the media library scan whose job progress changed.</param>
/// <param name="progress">Optional. The new media library scan job progress.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <returns>The created <see cref="LibraryScanJobProgressChangedDomainEvent"/>.</returns>
public LibraryScanJobProgressChangedDomainEvent Create(
Guid? id = null,
LibraryId? libraryId = null,
MediaLibraryScanCompositeId? mediaLibraryScanCompositeId = null,
MediaLibraryScanJobProgress? progress = null,
DateTime? occurredOnUtc = null)
{
return new LibraryScanJobProgressChangedDomainEvent(
id ?? Guid.NewGuid(),
libraryId ?? _libraryIdFixture.Create(),
mediaLibraryScanCompositeId ?? _mediaLibraryScanCompositeIdFixture.Create(),
progress ?? _mediaLibraryScanJobProgressFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow);
}
}
@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryScanProgressChangedDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryScanProgressChangedDomainEventFixture
{
private readonly LibraryIdFixture _libraryIdFixture = new();
private readonly MediaLibraryScanCompositeIdFixture _mediaLibraryScanCompositeIdFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryScanProgressChangedDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="libraryId">Optional. The unique identifier of the library being scanned.</param>
/// <param name="mediaLibraryScanCompositeId">Optional. The composite identifier of the media library scan whose progress changed.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <returns>The created <see cref="LibraryScanProgressChangedDomainEvent"/>.</returns>
public LibraryScanProgressChangedDomainEvent Create(
Guid? id = null,
LibraryId? libraryId = null,
MediaLibraryScanCompositeId? mediaLibraryScanCompositeId = null,
DateTime? occurredOnUtc = null)
{
return new LibraryScanProgressChangedDomainEvent(
id ?? Guid.NewGuid(),
libraryId ?? _libraryIdFixture.Create(),
mediaLibraryScanCompositeId ?? _mediaLibraryScanCompositeIdFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow);
}
}
@@ -0,0 +1,42 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryScanQueuedDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryScanQueuedDomainEventFixture
{
private readonly ScanIdFixture _scanIdFixture = new();
private readonly LibraryIdFixture _libraryIdFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryScanQueuedDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="scanId">Optional. The unique identifier of the queued media library scan.</param>
/// <param name="libraryId">Optional. The unique identifier of the library whose scan was queued.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <returns>The created <see cref="LibraryScanQueuedDomainEvent"/>.</returns>
public LibraryScanQueuedDomainEvent Create(
Guid? id = null,
ScanId? scanId = null,
LibraryId? libraryId = null,
DateTime? occurredOnUtc = null)
{
return new LibraryScanQueuedDomainEvent(
id ?? Guid.NewGuid(),
scanId ?? _scanIdFixture.Create(),
libraryId ?? _libraryIdFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow);
}
}
@@ -0,0 +1,33 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate;
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
/// <summary>
/// Fixture class for the <see cref="LibraryScanStartedDomainEvent"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class LibraryScanStartedDomainEventFixture
{
private readonly LibraryScanFixture _libraryScanFixture = new();
/// <summary>
/// Creates a random valid <see cref="LibraryScanStartedDomainEvent"/>.
/// </summary>
/// <param name="id">Optional. The Id of the domain event.</param>
/// <param name="libraryScan">Optional. The library scan that was started.</param>
/// <param name="occurredOnUtc">Optional. The date and time when the domain event occurred.</param>
/// <returns>The created <see cref="LibraryScanStartedDomainEvent"/>.</returns>
public LibraryScanStartedDomainEvent Create(Guid? id = null, LibraryScan? libraryScan = null, DateTime? occurredOnUtc = null)
{
return new LibraryScanStartedDomainEvent(
id ?? Guid.NewGuid(),
libraryScan ?? _libraryScanFixture.Create(),
occurredOnUtc ?? DateTime.UtcNow);
}
}