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,48 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="PathExistsResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class PathExistsResponseTests
{
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void RoundTrip_WhenSerializingPathExistsResponse_ShouldPreserveValues()
{
// Arrange
PathExistsResponse expected = new(true);
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
PathExistsResponse? actual = JsonSerializer.Deserialize<PathExistsResponse>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
{
// Arrange
PathExistsResponse first = new(true);
PathExistsResponse second = new(true);
// Act
bool areEqual = first == second;
// Assert
Assert.True(areEqual);
}
}
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Path;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="PathSegmentResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class PathSegmentResponseTests
{
private readonly PathSegmentResponseFixture _pathSegmentResponseFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void Create_WhenCalled_ShouldReturnValidPathSegmentResponse()
{
// Act
PathSegmentResponse sut = _pathSegmentResponseFixture.Create();
// Assert
Assert.NotNull(sut);
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
}
[Fact]
public void RoundTrip_WhenSerializingPathSegmentResponse_ShouldPreserveValues()
{
// Arrange
PathSegmentResponse expected = _pathSegmentResponseFixture.Create(path: @"C:\Media");
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
PathSegmentResponse? actual = JsonSerializer.Deserialize<PathSegmentResponse>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
{
// Arrange
PathSegmentResponse first = _pathSegmentResponseFixture.Create(path: @"C:\Media\Books");
PathSegmentResponse second = _pathSegmentResponseFixture.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.Responses.FileSystemManagement.Path;
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="PathSeparatorResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class PathSeparatorResponseTests
{
private readonly PathSeparatorResponseFixture _pathSeparatorResponseFixture = new();
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void Create_WhenCalled_ShouldReturnValidPathSeparatorResponse()
{
// Act
PathSeparatorResponse sut = _pathSeparatorResponseFixture.Create();
// Assert
Assert.NotNull(sut);
Assert.False(string.IsNullOrWhiteSpace(sut.Separator));
}
[Fact]
public void RoundTrip_WhenSerializingPathSeparatorResponse_ShouldPreserveValues()
{
// Arrange
PathSeparatorResponse expected = _pathSeparatorResponseFixture.Create(separator: "\\");
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
PathSeparatorResponse? actual = JsonSerializer.Deserialize<PathSeparatorResponse>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
{
// Arrange
PathSeparatorResponse first = _pathSeparatorResponseFixture.Create(separator: "/");
PathSeparatorResponse second = _pathSeparatorResponseFixture.Create(separator: "/");
// Act
bool areEqual = first == second;
// Assert
Assert.True(areEqual);
}
}
@@ -0,0 +1,48 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Responses.FileSystemManagement.Path;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
#endregion
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Path;
/// <summary>
/// Contains unit tests for the <see cref="PathValidResponse"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class PathValidResponseTests
{
private readonly JsonSerializerOptions _jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
[Fact]
public void RoundTrip_WhenSerializingPathValidResponse_ShouldPreserveValues()
{
// Arrange
PathValidResponse expected = new(true);
// Act
string json = JsonSerializer.Serialize(expected, _jsonOptions);
PathValidResponse? actual = JsonSerializer.Deserialize<PathValidResponse>(json, _jsonOptions);
// Assert
Assert.NotNull(actual);
Assert.Equal(expected, actual);
}
[Fact]
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
{
// Arrange
PathValidResponse first = new(true);
PathValidResponse second = new(true);
// Act
bool areEqual = first == second;
// Assert
Assert.True(areEqual);
}
}