mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Removes the redundant contract and enumeration tests
This commit is contained in:
1 parent
4dce426b38
commit
dc2692e208
127 files changed
-6721
No files matched your search
@@ -18,53 +18,6 @@ public class PaginatedResponseTests
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void PaginatedResponse_WhenConstructed_ShouldRequireAllProperties()
|
||||
{
|
||||
// Act
|
||||
PaginatedResponse<int> sut = new()
|
||||
{
|
||||
Data = [1, 2, 3],
|
||||
CurrentPage = 1,
|
||||
PerPage = 10,
|
||||
Count = 3,
|
||||
NumberOfPages = 1
|
||||
};
|
||||
|
||||
// Assert
|
||||
Assert.Equal([1, 2, 3], sut.Data);
|
||||
Assert.Equal(1, sut.CurrentPage);
|
||||
Assert.Equal(10, sut.PerPage);
|
||||
Assert.Equal(3, sut.Count);
|
||||
Assert.Equal(1, sut.NumberOfPages);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingPaginatedResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
PaginatedResponse<string> expected = new()
|
||||
{
|
||||
Data = ["book1", "book2"],
|
||||
CurrentPage = 2,
|
||||
PerPage = 20,
|
||||
Count = 2,
|
||||
NumberOfPages = 1
|
||||
};
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
PaginatedResponse<string>? actual = JsonSerializer.Deserialize<PaginatedResponse<string>>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected.Data, actual.Data);
|
||||
Assert.Equal(expected.CurrentPage, actual.CurrentPage);
|
||||
Assert.Equal(expected.PerPage, actual.PerPage);
|
||||
Assert.Equal(expected.Count, actual.Count);
|
||||
Assert.Equal(expected.NumberOfPages, actual.NumberOfPages);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Deserialize_WhenDataIsMissing_ShouldThrowJsonException()
|
||||
{
|
||||
@@ -74,25 +27,4 @@ public class PaginatedResponseTests
|
||||
// Act & Assert
|
||||
Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<PaginatedResponse<int>>(json, _jsonOptions));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
PaginatedResponse<int> first = new()
|
||||
{
|
||||
Data = [1, 2, 3],
|
||||
CurrentPage = 1,
|
||||
PerPage = 10,
|
||||
Count = 3,
|
||||
NumberOfPages = 1
|
||||
};
|
||||
PaginatedResponse<int> second = first with { };
|
||||
|
||||
// Act
|
||||
bool areEqual = first == second;
|
||||
|
||||
// Assert
|
||||
Assert.True(areEqual);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user