mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 09: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
+1
-1
@@ -103,7 +103,7 @@ public class CheckPathExistsQueryHandlerTests
|
||||
public async Task HandleAsync_WhenCalledWithNullPath_ShouldStillCallPathService()
|
||||
{
|
||||
// Arrange
|
||||
CheckPathExistsQuery query = new(null!, false);
|
||||
CheckPathExistsQuery query = _checkPathExistsQueryFixture.Create(includePath: false, shouldIncludeHiddenElements: false);
|
||||
_mockPathService.Exists(Arg.Any<string>(), Arg.Any<bool>()).Returns(false);
|
||||
|
||||
// Act
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ public class ValidatePathQueryHandlerTests
|
||||
public async Task HandleAsync_WhenCalledWithNullPath_ShouldReturnFalseResponse()
|
||||
{
|
||||
// Arrange
|
||||
ValidatePathQuery query = new(null!);
|
||||
ValidatePathQuery query = _validatePathQueryFixture.Create(includePath: false);
|
||||
_mockPathService.IsValidPath(Arg.Any<string>()).Returns(false);
|
||||
|
||||
// Act
|
||||
@@ -89,7 +89,7 @@ public class ValidatePathQueryHandlerTests
|
||||
public async Task HandleAsync_WhenCalledWithEmptyPath_ShouldReturnFalseResponse()
|
||||
{
|
||||
// Arrange
|
||||
ValidatePathQuery query = new(string.Empty);
|
||||
ValidatePathQuery query = _validatePathQueryFixture.Create(string.Empty);
|
||||
_mockPathService.IsValidPath(Arg.Any<string>()).Returns(false);
|
||||
|
||||
// Act
|
||||
|
||||
+8
-6
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail;
|
||||
using Lumina.Application.Fixtures.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail;
|
||||
using Lumina.Application.UnitTests.Common.Setup;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
@@ -16,12 +17,13 @@ namespace Lumina.Application.UnitTests.Core.FileSystemManagement.Thumbnails.Quer
|
||||
public class GetThumbnailQueryValidatorTests
|
||||
{
|
||||
private readonly GetThumbnailQueryValidator _validator = new();
|
||||
private readonly GetThumbnailQueryFixture _getThumbnailQueryFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void Validate_WhenPathIsNull_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetThumbnailQuery query = new(null!, 1);
|
||||
GetThumbnailQuery query = _getThumbnailQueryFixture.Create(includePath: false, quality: 1);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
@@ -34,7 +36,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
public void Validate_WhenPathIsEmpty_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetThumbnailQuery query = new(string.Empty, 1);
|
||||
GetThumbnailQuery query = _getThumbnailQueryFixture.Create(string.Empty, 1);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
@@ -47,7 +49,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
public void Validate_WhenPathIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetThumbnailQuery query = new("test", 1);
|
||||
GetThumbnailQuery query = _getThumbnailQueryFixture.Create("test", 1);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
@@ -60,7 +62,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
public void Validate_WhenQualityIsNegative_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetThumbnailQuery query = new("test", -1);
|
||||
GetThumbnailQuery query = _getThumbnailQueryFixture.Create("test", -1);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
@@ -73,7 +75,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
public void Validate_WhenQualityIsOver100_ShouldHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetThumbnailQuery query = new("test", 101);
|
||||
GetThumbnailQuery query = _getThumbnailQueryFixture.Create("test", 101);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
@@ -86,7 +88,7 @@ public class GetThumbnailQueryValidatorTests
|
||||
public void Validate_WhenQualityIsValid_ShouldNotHaveValidationError()
|
||||
{
|
||||
// Arrange
|
||||
GetThumbnailQuery query = new("test", 1);
|
||||
GetThumbnailQuery query = _getThumbnailQueryFixture.Create("test", 1);
|
||||
|
||||
// Act
|
||||
List<Error> result = _validator.TestValidate(query);
|
||||
|
||||
Reference in new issue
Block a user