mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 20:01:10 +00:00
73 lines
2.7 KiB
C#
73 lines
2.7 KiB
C#
#region ========================================================================= USING =====================================================================================
|
|
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
|
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
|
|
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
|
|
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Linq;
|
|
#endregion
|
|
|
|
namespace Lumina.Application.UnitTests.Common.Mapping.FileSystemManagement.Paths;
|
|
|
|
/// <summary>
|
|
/// Contains unit tests for the <see cref="CheckPathExistsRequestMapping"/> class.
|
|
/// </summary>
|
|
[ExcludeFromCodeCoverage]
|
|
public class CheckPathExistsRequestMappingTests
|
|
{
|
|
private readonly CheckPathExistsRequestFixture _checkPathExistsRequestFixture = new();
|
|
|
|
[Fact]
|
|
public void ToQuery_WhenMappingCheckPathExistsRequest_ShouldMapCorrectly()
|
|
{
|
|
// Arrange
|
|
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create();
|
|
|
|
// Act
|
|
CheckPathExistsQuery result = request.ToQuery();
|
|
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
Assert.Equal(request.Path, result.Path);
|
|
Assert.Equal(request.ShouldIncludeHiddenElements, result.ShouldIncludeHiddenElements);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("/home/user/documents", true)]
|
|
[InlineData("C:\\Users\\Documents", false)]
|
|
[InlineData("/var/www/html", true)]
|
|
public void ToQuery_WhenMappingWithDifferentPathsAndHiddenElementsFlag_ShouldMapCorrectly(string path, bool shouldIncludeHiddenElements)
|
|
{
|
|
// Arrange
|
|
CheckPathExistsRequest request = _checkPathExistsRequestFixture.Create(path, shouldIncludeHiddenElements);
|
|
|
|
// Act
|
|
CheckPathExistsQuery result = request.ToQuery();
|
|
|
|
// Assert
|
|
Assert.NotNull(result);
|
|
Assert.Equal(path, result.Path);
|
|
Assert.Equal(shouldIncludeHiddenElements, result.ShouldIncludeHiddenElements);
|
|
}
|
|
|
|
[Fact]
|
|
public void ToQuery_WhenMappingMultipleRequests_ShouldMapAllCorrectly()
|
|
{
|
|
// Arrange
|
|
List<CheckPathExistsRequest> requests = _checkPathExistsRequestFixture.CreateMany();
|
|
|
|
// Act
|
|
List<CheckPathExistsQuery> results = requests.Select(r => r.ToQuery()).ToList();
|
|
|
|
// Assert
|
|
Assert.NotNull(results);
|
|
Assert.Equal(requests.Count, results.Count);
|
|
for (int i = 0; i < requests.Count; i++)
|
|
{
|
|
Assert.Equal(requests[i].Path, results[i].Path);
|
|
Assert.Equal(requests[i].ShouldIncludeHiddenElements, results[i].ShouldIncludeHiddenElements);
|
|
}
|
|
}
|
|
}
|