mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 11:11:10 +00:00
Refactors the test fixtures and their consumers to compose other fixtures instead of instantiating models inline
This commit is contained in:
1 parent
0abda472c6
commit
3aadd6de84
157 files changed
+1312
-597
No files matched your search
+9
-6
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.DTO.Common.Pagination;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.Common.Pagination;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
@@ -11,11 +12,13 @@ namespace Lumina.Contracts.UnitTests.DTO.Common.Pagination;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PaginationDataDtoTests
|
||||
{
|
||||
private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void CurrentPage_WhenNotSet_ShouldDefaultToOne()
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = new();
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
int currentPage = sut.CurrentPage;
|
||||
@@ -28,7 +31,7 @@ public class PaginationDataDtoTests
|
||||
public void PerPage_WhenNotSet_ShouldDefaultToTwoHundred()
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = new();
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
int perPage = sut.PerPage;
|
||||
@@ -43,7 +46,7 @@ public class PaginationDataDtoTests
|
||||
public void CurrentPage_WhenSettingValueBelowOne_ShouldClampToOne(int value)
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = new();
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
sut.CurrentPage = value;
|
||||
@@ -58,7 +61,7 @@ public class PaginationDataDtoTests
|
||||
public void PerPage_WhenSettingValueBelowOne_ShouldClampToOne(int value)
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = new();
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
sut.PerPage = value;
|
||||
@@ -71,7 +74,7 @@ public class PaginationDataDtoTests
|
||||
public void CurrentPage_WhenSettingValueAboveOne_ShouldPreserveValue()
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = new();
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
sut.CurrentPage = 5;
|
||||
@@ -84,7 +87,7 @@ public class PaginationDataDtoTests
|
||||
public void PerPage_WhenSettingValueAboveOne_ShouldPreserveValue()
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = new();
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
sut.PerPage = 25;
|
||||
|
||||
+4
-1
@@ -2,6 +2,7 @@
|
||||
using Lumina.Contracts.DTO.Common;
|
||||
using Lumina.Contracts.DTO.MediaContributors;
|
||||
using Lumina.Contracts.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,6 +17,8 @@ namespace Lumina.Contracts.UnitTests.DTO.MediaLibrary.WrittenContentLibrary.Book
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class BookMetadataLookupDtoTests
|
||||
{
|
||||
private readonly BookMetadataLookupDtoFixture _bookMetadataLookupDtoFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenOmittingOptionalParameters_ShouldUseNullDefaults()
|
||||
{
|
||||
@@ -23,7 +26,7 @@ public class BookMetadataLookupDtoTests
|
||||
Guid libraryId = Guid.NewGuid();
|
||||
|
||||
// Act
|
||||
BookMetadataLookupDto sut = new(libraryId, @"/media/books/dune.epub");
|
||||
BookMetadataLookupDto sut = _bookMetadataLookupDtoFixture.Create(libraryId: libraryId, path: @"/media/books/dune.epub");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(libraryId, sut.LibraryId);
|
||||
|
||||
Reference in new issue
Block a user