Skip to content

Commit 1f8353d

Browse files
committed
Fix ValidationAttributesTests to match current implementation where negative single values are valid for tail lines
1 parent 87b042c commit 1f8353d

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Tests/Unit/Core/ValidationAttributesTests.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,19 @@ public void Validate_ZeroLineNumber_ThrowsValidationException()
7373
InvokeValidate(invalidRange));
7474

7575
Assert.IsType<ValidationMetadataException>(exception.InnerException);
76-
Assert.Contains("Start line must be", exception.InnerException!.Message);
77-
Assert.Contains("Invalid value: 0", exception.InnerException.Message);
76+
Assert.Contains("Start line cannot be 0", exception.InnerException!.Message);
7877
}
7978

8079

8180
[Fact]
82-
public void Validate_NegativeLineNumber_ThrowsValidationException()
81+
public void Validate_NegativeSingleValue_IsValidForTailLines()
8382
{
84-
// Arrange
85-
var invalidRange = new[] { -1 };
83+
// Arrange - negative single value means "last N lines"
84+
var validRange = new[] { -10 };
8685

87-
// Act & Assert
88-
var exception = Assert.Throws<TargetInvocationException>(() =>
89-
InvokeValidate(invalidRange));
90-
91-
Assert.IsType<ValidationMetadataException>(exception.InnerException);
92-
Assert.Contains("Start line must be", exception.InnerException!.Message);
93-
Assert.Contains("Invalid value: -1", exception.InnerException.Message);
86+
// Act & Assert - should not throw
87+
var exception = Record.Exception(() => InvokeValidate(validRange));
88+
Assert.Null(exception);
9489
}
9590

9691

0 commit comments

Comments
 (0)