mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 21:11:10 +00:00
Renames project paths from Lumina to Nemera
This commit is contained in:
1 parent
ce6fddb4c9
commit
0f659a4877
6450 files changed
No files matched your search
+129
@@ -0,0 +1,129 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
using Lumina.Domain.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.MediaContributorBoundedContext.MediaContributorAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="Movie"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MovieTests
|
||||
{
|
||||
private readonly VideoMetadataFixture _videoMetadataFixture = new();
|
||||
private readonly MovieIdFixture _movieIdFixture = new();
|
||||
private readonly MediaContributorIdFixture _mediaContributorIdFixture = new();
|
||||
private readonly MovieFixture _movieFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalledWithValidData_ShouldCreateMovieWithGeneratedId()
|
||||
{
|
||||
// Arrange
|
||||
VideoMetadata metadata = _videoMetadataFixture.Create();
|
||||
List<MediaContributorId> contributors = [_mediaContributorIdFixture.Create()];
|
||||
List<Rating> ratings = [];
|
||||
|
||||
// Act
|
||||
Result<Movie> result = Movie.Create(metadata, contributors, ratings);
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.Equal(metadata, result.Value.Metadata);
|
||||
Assert.Single(result.Value.Contributors);
|
||||
Assert.Empty(result.Value.Ratings);
|
||||
Assert.NotEqual(default, result.Value.Id.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalledWithPreExistingId_ShouldCreateMovieWithThatId()
|
||||
{
|
||||
// Arrange
|
||||
Guid id = Guid.NewGuid();
|
||||
VideoMetadata metadata = _videoMetadataFixture.Create();
|
||||
List<MediaContributorId> contributors = [];
|
||||
List<Rating> ratings = [];
|
||||
|
||||
// Act
|
||||
Result<Movie> result = Movie.Create(_movieIdFixture.Create(id), metadata, contributors, ratings);
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.Equal(id, result.Value.Id.Value);
|
||||
Assert.Equal(metadata, result.Value.Metadata);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ShouldSetAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
MovieId id = _movieIdFixture.Create();
|
||||
VideoMetadata metadata = _videoMetadataFixture.Create();
|
||||
List<MediaContributorId> contributors = [_mediaContributorIdFixture.Create(), _mediaContributorIdFixture.Create()];
|
||||
List<Rating> ratings = [CreateRating(4.5m)];
|
||||
|
||||
// Act
|
||||
Movie movie = _movieFixture.Create(id, metadata, contributors, ratings);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(id, movie.Id);
|
||||
Assert.Equal(metadata, movie.Metadata);
|
||||
Assert.Equal(2, movie.Contributors.Count);
|
||||
Assert.Single(movie.Ratings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithSameId_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
Guid id = Guid.NewGuid();
|
||||
Movie firstMovie = _movieFixture.Create(id: _movieIdFixture.Create(id));
|
||||
Movie secondMovie = _movieFixture.Create(id: _movieIdFixture.Create(id));
|
||||
|
||||
// Act
|
||||
bool result = firstMovie.Equals(secondMovie);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
private static Rating CreateRating(decimal value)
|
||||
{
|
||||
return new TestRating(value, 10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Concrete test implementation of the abstract <see cref="Rating"/> class.
|
||||
/// </summary>
|
||||
private sealed class TestRating : Rating
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestRating"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The numeric value of the rating.</param>
|
||||
/// <param name="maxValue">The maximum possible rating value.</param>
|
||||
public TestRating(decimal value, decimal maxValue) : base(value, maxValue, Optional<int>.None())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of items that define equality of the object.
|
||||
/// </summary>
|
||||
/// <returns>A list of items defining the equality.</returns>
|
||||
public override IEnumerable<object> GetEqualityComponents()
|
||||
{
|
||||
yield return Value;
|
||||
yield return MaxValue;
|
||||
yield return VoteCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="MovieId"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class MovieIdTests
|
||||
{
|
||||
private readonly MovieIdFixture _movieIdFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void CreateUnique_WhenCalled_ShouldReturnIdWithNonEmptyValue()
|
||||
{
|
||||
// Act
|
||||
MovieId movieId = MovieId.CreateUnique();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(movieId);
|
||||
Assert.NotEqual(default, movieId.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalledWithValue_ShouldReturnIdWithThatValue()
|
||||
{
|
||||
// Arrange
|
||||
Guid value = Guid.NewGuid();
|
||||
|
||||
// Act
|
||||
MovieId movieId = MovieId.Create(value);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(value, movieId.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithSameValue_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
Guid value = Guid.NewGuid();
|
||||
MovieId firstId = _movieIdFixture.Create(value);
|
||||
MovieId secondId = _movieIdFixture.Create(value);
|
||||
|
||||
// Act
|
||||
bool result = firstId.Equals(secondId);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithDifferentValue_ShouldReturnFalse()
|
||||
{
|
||||
// Arrange
|
||||
MovieId firstId = _movieIdFixture.Create();
|
||||
MovieId secondId = _movieIdFixture.Create();
|
||||
|
||||
// Act
|
||||
bool result = firstId.Equals(secondId);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Common.ValueObjects.Metadata;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.MovieLibraryAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="VideoMetadata"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class VideoMetadataTests
|
||||
{
|
||||
private readonly GenreFixture _genreFixture = new();
|
||||
private readonly TagFixture _tagFixture = new();
|
||||
private readonly ReleaseInfoFixture _releaseInfoFixture = new();
|
||||
private readonly LanguageInfoFixture _languageInfoFixture = new();
|
||||
private readonly VideoMetadataFixture _videoMetadataFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalledWithValidValues_ShouldCreateMetadataWithAllPropertiesSet()
|
||||
{
|
||||
// Act
|
||||
Result<VideoMetadata> result = VideoMetadata.Create(
|
||||
"Inception",
|
||||
Optional<string>.Some("Inception (Original)"),
|
||||
durationInSeconds: 8880,
|
||||
"1920x1080",
|
||||
Optional<string>.Some("A thief who steals corporate secrets."),
|
||||
_releaseInfoFixture.Create(),
|
||||
Optional<LanguageInfo>.Some(_languageInfoFixture.Create()),
|
||||
Optional<LanguageInfo>.None(),
|
||||
Optional<float>.Some(24),
|
||||
Optional<string>.Some("H.264"),
|
||||
Optional<string>.Some("AAC"),
|
||||
[_genreFixture.Create(name: "Action")],
|
||||
[_tagFixture.Create(name: "heist")]);
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.Equal("Inception", result.Value.Title);
|
||||
Assert.Equal("Inception (Original)", result.Value.OriginalTitle.Value);
|
||||
Assert.Equal(8880, result.Value.DurationInSeconds);
|
||||
Assert.Equal("1920x1080", result.Value.Resolution);
|
||||
Assert.Equal("A thief who steals corporate secrets.", result.Value.Description.Value);
|
||||
Assert.Equal(24, result.Value.FrameRate.Value);
|
||||
Assert.Equal("H.264", result.Value.VideoCodec.Value);
|
||||
Assert.Equal("AAC", result.Value.AudioCodec.Value);
|
||||
Assert.Single(result.Value.Genres);
|
||||
Assert.Single(result.Value.Tags);
|
||||
Assert.True(result.Value.Language.HasValue);
|
||||
Assert.False(result.Value.OriginalLanguage.HasValue);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithSameValues_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
ReleaseInfo releaseInfo = _releaseInfoFixture.Create();
|
||||
VideoMetadata first = _videoMetadataFixture.Create(
|
||||
title: "Inception",
|
||||
originalTitle: Optional<string>.None(),
|
||||
durationInSeconds: 8880,
|
||||
resolution: "1920x1080",
|
||||
description: Optional<string>.None(),
|
||||
releaseInfo: releaseInfo,
|
||||
language: Optional<LanguageInfo>.None(),
|
||||
originalLanguage: Optional<LanguageInfo>.None(),
|
||||
frameRate: Optional<float>.None(),
|
||||
videoCodec: Optional<string>.None(),
|
||||
audioCodec: Optional<string>.None(),
|
||||
genres: [],
|
||||
tags: []);
|
||||
VideoMetadata second = _videoMetadataFixture.Create(
|
||||
title: "Inception",
|
||||
originalTitle: Optional<string>.None(),
|
||||
durationInSeconds: 8880,
|
||||
resolution: "1920x1080",
|
||||
description: Optional<string>.None(),
|
||||
releaseInfo: releaseInfo,
|
||||
language: Optional<LanguageInfo>.None(),
|
||||
originalLanguage: Optional<LanguageInfo>.None(),
|
||||
frameRate: Optional<float>.None(),
|
||||
videoCodec: Optional<string>.None(),
|
||||
audioCodec: Optional<string>.None(),
|
||||
genres: [],
|
||||
tags: []);
|
||||
|
||||
// Act
|
||||
bool result = first.Equals(second);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithDifferentDuration_ShouldReturnFalse()
|
||||
{
|
||||
// Arrange
|
||||
ReleaseInfo releaseInfo = _releaseInfoFixture.Create();
|
||||
VideoMetadata first = _videoMetadataFixture.Create(
|
||||
title: "Inception",
|
||||
originalTitle: Optional<string>.None(),
|
||||
durationInSeconds: 8880,
|
||||
resolution: "1920x1080",
|
||||
description: Optional<string>.None(),
|
||||
releaseInfo: releaseInfo,
|
||||
language: Optional<LanguageInfo>.None(),
|
||||
originalLanguage: Optional<LanguageInfo>.None(),
|
||||
frameRate: Optional<float>.None(),
|
||||
videoCodec: Optional<string>.None(),
|
||||
audioCodec: Optional<string>.None(),
|
||||
genres: [],
|
||||
tags: []);
|
||||
VideoMetadata second = _videoMetadataFixture.Create(
|
||||
title: "Inception",
|
||||
originalTitle: Optional<string>.None(),
|
||||
durationInSeconds: 8881,
|
||||
resolution: "1920x1080",
|
||||
description: Optional<string>.None(),
|
||||
releaseInfo: releaseInfo,
|
||||
language: Optional<LanguageInfo>.None(),
|
||||
originalLanguage: Optional<LanguageInfo>.None(),
|
||||
frameRate: Optional<float>.None(),
|
||||
videoCodec: Optional<string>.None(),
|
||||
audioCodec: Optional<string>.None(),
|
||||
genres: [],
|
||||
tags: []);
|
||||
|
||||
// Act
|
||||
bool result = first.Equals(second);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="Episode"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class EpisodeTests
|
||||
{
|
||||
private readonly EpisodeIdFixture _episodeIdFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ShouldSetId()
|
||||
{
|
||||
// Arrange
|
||||
EpisodeId id = _episodeIdFixture.Create();
|
||||
|
||||
// Act
|
||||
Episode episode = new(id);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(id, episode.Id);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.Entities;
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="Season"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SeasonTests
|
||||
{
|
||||
private readonly SeasonIdFixture _seasonIdFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ShouldSetId()
|
||||
{
|
||||
// Arrange
|
||||
SeasonId id = _seasonIdFixture.Create();
|
||||
|
||||
// Act
|
||||
Season season = new(id);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(id, season.Id);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="TvShow"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class TvShowTests
|
||||
{
|
||||
private readonly TvShowIdFixture _tvShowIdFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ShouldSetId()
|
||||
{
|
||||
// Arrange
|
||||
TvShowId id = _tvShowIdFixture.Create();
|
||||
|
||||
// Act
|
||||
TvShow tvShow = new(id);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(id, tvShow.Id);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="EpisodeId"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class EpisodeIdTests
|
||||
{
|
||||
private readonly EpisodeIdFixture _episodeIdFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void CreateUnique_WhenCalled_ShouldReturnIdWithNonEmptyValue()
|
||||
{
|
||||
// Act
|
||||
EpisodeId episodeId = EpisodeId.CreateUnique();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(episodeId);
|
||||
Assert.NotEqual(default, episodeId.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalledWithValue_ShouldReturnIdWithThatValue()
|
||||
{
|
||||
// Arrange
|
||||
Guid value = Guid.NewGuid();
|
||||
|
||||
// Act
|
||||
EpisodeId episodeId = EpisodeId.Create(value);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(value, episodeId.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithSameValue_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
Guid value = Guid.NewGuid();
|
||||
EpisodeId firstId = _episodeIdFixture.Create(value);
|
||||
EpisodeId secondId = _episodeIdFixture.Create(value);
|
||||
|
||||
// Act
|
||||
bool result = firstId.Equals(secondId);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithDifferentValue_ShouldReturnFalse()
|
||||
{
|
||||
// Arrange
|
||||
EpisodeId firstId = _episodeIdFixture.Create();
|
||||
EpisodeId secondId = _episodeIdFixture.Create();
|
||||
|
||||
// Act
|
||||
bool result = firstId.Equals(secondId);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="SeasonId"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SeasonIdTests
|
||||
{
|
||||
private readonly SeasonIdFixture _seasonIdFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void CreateUnique_WhenCalled_ShouldReturnIdWithNonEmptyValue()
|
||||
{
|
||||
// Act
|
||||
SeasonId seasonId = SeasonId.CreateUnique();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(seasonId);
|
||||
Assert.NotEqual(default, seasonId.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalledWithValue_ShouldReturnIdWithThatValue()
|
||||
{
|
||||
// Arrange
|
||||
Guid value = Guid.NewGuid();
|
||||
|
||||
// Act
|
||||
SeasonId seasonId = SeasonId.Create(value);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(value, seasonId.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithSameValue_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
Guid value = Guid.NewGuid();
|
||||
SeasonId firstId = _seasonIdFixture.Create(value);
|
||||
SeasonId secondId = _seasonIdFixture.Create(value);
|
||||
|
||||
// Act
|
||||
bool result = firstId.Equals(secondId);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithDifferentValue_ShouldReturnFalse()
|
||||
{
|
||||
// Arrange
|
||||
SeasonId firstId = _seasonIdFixture.Create();
|
||||
SeasonId secondId = _seasonIdFixture.Create();
|
||||
|
||||
// Act
|
||||
bool result = firstId.Equals(secondId);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.UnitTests.Core.BoundedContexts.VideoLibraryBoundedContext.TvShowLibraryAggregate.ValueObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="TvShowId"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class TvShowIdTests
|
||||
{
|
||||
private readonly TvShowIdFixture _tvShowIdFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void CreateUnique_WhenCalled_ShouldReturnIdWithNonEmptyValue()
|
||||
{
|
||||
// Act
|
||||
TvShowId tvShowId = TvShowId.CreateUnique();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(tvShowId);
|
||||
Assert.NotEqual(default, tvShowId.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalledWithValue_ShouldReturnIdWithThatValue()
|
||||
{
|
||||
// Arrange
|
||||
Guid value = Guid.NewGuid();
|
||||
|
||||
// Act
|
||||
TvShowId tvShowId = TvShowId.Create(value);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(value, tvShowId.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithSameValue_ShouldReturnTrue()
|
||||
{
|
||||
// Arrange
|
||||
Guid value = Guid.NewGuid();
|
||||
TvShowId firstId = _tvShowIdFixture.Create(value);
|
||||
TvShowId secondId = _tvShowIdFixture.Create(value);
|
||||
|
||||
// Act
|
||||
bool result = firstId.Equals(secondId);
|
||||
|
||||
// Assert
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_WithDifferentValue_ShouldReturnFalse()
|
||||
{
|
||||
// Arrange
|
||||
TvShowId firstId = _tvShowIdFixture.Create();
|
||||
TvShowId secondId = _tvShowIdFixture.Create();
|
||||
|
||||
// Act
|
||||
bool result = firstId.Equals(secondId);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user