Hardens test assertions and adds missing test coverage.

This commit is contained in:
BinaryAlley committed 2026-08-18 08:28:16 -07:00
1 parent 6b86fd5805
commit 1189bbaf36
489 files changed
+39982 -512

No files matched your search

@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Requests.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="CheckPathExistsRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class CheckPathExistsRequestTests
{
private readonly CheckPathExistsRequestFixture _checkPathExistsRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void Create_WhenCalled_ShouldReturnValidCheckPathExistsRequest()
{
// Act
CheckPathExistsRequest sut = _checkPathExistsRequestFixture.Create();
// Assert
Assert.NotNull(sut);
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
}
[Fact]
public void RoundTrip_WhenSerializingCheckPathExistsRequest_ShouldPreserveValues()
{
// Arrange
CheckPathExistsRequest expected = _checkPathExistsRequestFixture.Create();
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
CheckPathExistsRequest? actual = JsonSerializer.Deserialize<CheckPathExistsRequest>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
{
// Arrange
CheckPathExistsRequest sut = _checkPathExistsRequestFixture.Create(path: @"C:\Media\Books", includeHiddenElements: true);
// Act
(string? path, bool includeHiddenElements) = sut;
// Assert
Assert.Equal(sut.Path, path);
Assert.Equal(sut.IncludeHiddenElements, includeHiddenElements);
}
}
@@ -0,0 +1,63 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Requests.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="CombinePathRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class CombinePathRequestTests
{
private readonly CombinePathRequestFixture _combinePathRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void Create_WhenCalled_ShouldReturnValidCombinePathRequest()
{
// Act
CombinePathRequest sut = _combinePathRequestFixture.Create();
// Assert
Assert.NotNull(sut);
Assert.False(string.IsNullOrWhiteSpace(sut.OriginalPath));
Assert.False(string.IsNullOrWhiteSpace(sut.NewPath));
}
[Fact]
public void RoundTrip_WhenSerializingCombinePathRequest_ShouldPreserveValues()
{
// Arrange
CombinePathRequest expected = _combinePathRequestFixture.Create();
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
CombinePathRequest? actual = JsonSerializer.Deserialize<CombinePathRequest>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
{
// Arrange
CombinePathRequest sut = _combinePathRequestFixture.Create(originalPath: @"C:\Media", newPath: "books");
// Act
(string? originalPath, string? newPath) = sut;
// Assert
Assert.Equal(sut.OriginalPath, originalPath);
Assert.Equal(sut.NewPath, newPath);
}
}
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Requests.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="GetPathParentRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPathParentRequestTests
{
private readonly GetPathParentRequestFixture _getPathParentRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void Create_WhenCalled_ShouldReturnValidGetPathParentRequest()
{
// Act
GetPathParentRequest sut = _getPathParentRequestFixture.Create();
// Assert
Assert.NotNull(sut);
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
}
[Fact]
public void RoundTrip_WhenSerializingGetPathParentRequest_ShouldPreserveValues()
{
// Arrange
GetPathParentRequest expected = _getPathParentRequestFixture.Create();
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
GetPathParentRequest? actual = JsonSerializer.Deserialize<GetPathParentRequest>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
{
// Arrange
GetPathParentRequest first = _getPathParentRequestFixture.Create(path: @"C:\Media\Books");
GetPathParentRequest second = _getPathParentRequestFixture.Create(path: @"C:\Media\Books");
// Act
bool areEqual = first == second;
// Assert
Assert.True(areEqual);
}
}
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Requests.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="GetPathRootRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPathRootRequestTests
{
private readonly GetPathRootRequestFixture _getPathRootRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void Create_WhenCalled_ShouldReturnValidGetPathRootRequest()
{
// Act
GetPathRootRequest sut = _getPathRootRequestFixture.Create();
// Assert
Assert.NotNull(sut);
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
}
[Fact]
public void RoundTrip_WhenSerializingGetPathRootRequest_ShouldPreserveValues()
{
// Arrange
GetPathRootRequest expected = _getPathRootRequestFixture.Create();
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
GetPathRootRequest? actual = JsonSerializer.Deserialize<GetPathRootRequest>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
{
// Arrange
GetPathRootRequest first = _getPathRootRequestFixture.Create(path: @"C:\Media\Books");
GetPathRootRequest second = _getPathRootRequestFixture.Create(path: @"C:\Media\Books");
// Act
bool areEqual = first == second;
// Assert
Assert.True(areEqual);
}
}
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Requests.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="SplitPathRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class SplitPathRequestTests
{
private readonly SplitPathRequestFixture _splitPathRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void Create_WhenCalled_ShouldReturnValidSplitPathRequest()
{
// Act
SplitPathRequest sut = _splitPathRequestFixture.Create();
// Assert
Assert.NotNull(sut);
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
}
[Fact]
public void RoundTrip_WhenSerializingSplitPathRequest_ShouldPreserveValues()
{
// Arrange
SplitPathRequest expected = _splitPathRequestFixture.Create();
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
SplitPathRequest? actual = JsonSerializer.Deserialize<SplitPathRequest>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
{
// Arrange
SplitPathRequest first = _splitPathRequestFixture.Create(path: @"C:\Media\Books");
SplitPathRequest second = _splitPathRequestFixture.Create(path: @"C:\Media\Books");
// Act
bool areEqual = first == second;
// Assert
Assert.True(areEqual);
}
}
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Requests.FileSystemManagement.Path;
using Lumina.Contracts.Requests.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Requests.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="ValidatePathRequest"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ValidatePathRequestTests
{
private readonly ValidatePathRequestFixture _validatePathRequestFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void Create_WhenCalled_ShouldReturnValidValidatePathRequest()
{
// Act
ValidatePathRequest sut = _validatePathRequestFixture.Create();
// Assert
Assert.NotNull(sut);
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
}
[Fact]
public void RoundTrip_WhenSerializingValidatePathRequest_ShouldPreserveValues()
{
// Arrange
ValidatePathRequest expected = _validatePathRequestFixture.Create();
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
ValidatePathRequest? actual = JsonSerializer.Deserialize<ValidatePathRequest>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
{
// Arrange
ValidatePathRequest first = _validatePathRequestFixture.Create(path: @"C:\Media\Books");
ValidatePathRequest second = _validatePathRequestFixture.Create(path: @"C:\Media\Books");
// Act
bool areEqual = first == second;
// Assert
Assert.True(areEqual);
}
}