Skip to content

Commit 3c4ee64

Browse files
committed
fix tests
1 parent aa5c7d6 commit 3c4ee64

File tree

3 files changed

+6
-41
lines changed

3 files changed

+6
-41
lines changed

ManagedCode.Communication.Tests/Results/CollectionResultTests.cs

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void Empty_ShouldCreateEmptyResult()
153153
.BeEmpty();
154154
result.PageNumber
155155
.Should()
156-
.Be(1);
156+
.Be(0);
157157
result.PageSize
158158
.Should()
159159
.Be(0);
@@ -171,33 +171,6 @@ public void Empty_ShouldCreateEmptyResult()
171171
.BeTrue();
172172
}
173173

174-
[Fact]
175-
public void Empty_WithPaging_ShouldCreateEmptyResultWithPaging()
176-
{
177-
// Act
178-
var result = CollectionResult<string>.Empty(pageNumber: 2, pageSize: 10);
179-
180-
// Assert
181-
result.IsSuccess
182-
.Should()
183-
.BeTrue();
184-
result.Collection
185-
.Should()
186-
.BeEmpty();
187-
result.PageNumber
188-
.Should()
189-
.Be(2);
190-
result.PageSize
191-
.Should()
192-
.Be(10);
193-
result.TotalItems
194-
.Should()
195-
.Be(0);
196-
result.TotalPages
197-
.Should()
198-
.Be(0);
199-
}
200-
201174
[Fact]
202175
public void Fail_WithMessage_ShouldCreateFailedResult()
203176
{
@@ -477,10 +450,10 @@ public void ThrowIfFail_WithValidationFailure_ShouldThrowWithValidationDetails()
477450

478451
exception.Problem.Title.Should().Be("Validation Failed");
479452
exception.Problem.StatusCode.Should().Be(400);
480-
453+
481454
var validationErrors = exception.Problem.GetValidationErrors();
482455
validationErrors.Should().NotBeNull();
483456
validationErrors!["filter"].Should().Contain("Invalid filter format");
484457
validationErrors!["pageSize"].Should().Contain("Page size must be between 1 and 100");
485458
}
486-
}
459+
}

ManagedCode.Communication.Tests/Serialization/SerializationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void Problem_WithValidationErrors_ShouldSerializeAndDeserialize()
6060
deserialized!.Type.Should().Be(ProblemConstants.Types.ValidationFailed);
6161
deserialized.Title.Should().Be(ProblemConstants.Titles.ValidationFailed);
6262
deserialized.StatusCode.Should().Be(400);
63-
63+
6464
var errors = deserialized.GetValidationErrors();
6565
errors.Should().NotBeNull();
6666
errors!["email"].Should().Contain("Invalid format");
@@ -220,7 +220,7 @@ public void CollectionResult_Empty_ShouldSerializeAndDeserialize()
220220
// Assert
221221
deserialized.IsSuccess.Should().BeTrue();
222222
deserialized.Collection.Should().BeEmpty();
223-
deserialized.PageNumber.Should().Be(1);
223+
deserialized.PageNumber.Should().Be(0);
224224
deserialized.PageSize.Should().Be(0);
225225
deserialized.TotalItems.Should().Be(0);
226226
}
@@ -437,4 +437,4 @@ private class TestModel
437437
public string? Name { get; set; }
438438
public string[]? Tags { get; set; }
439439
}
440-
}
440+
}

ManagedCode.Communication/CollectionResultT/CollectionResult.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,5 @@ public static CollectionResult<T> Empty()
173173
return Create(true, [], 0, 0, 0);
174174
}
175175

176-
/// <summary>
177-
/// Creates an empty collection result with paging information.
178-
/// </summary>
179-
public static CollectionResult<T> Empty()
180-
{
181-
return Create(true, [], 0, 0, 0);
182-
}
183-
184176
#endregion
185177
}

0 commit comments

Comments
 (0)