Skip to content

Commit ea4c5ac

Browse files
committed
Fix test for invariant culture parsing
Updated the `DecimalWithRange` property in the `ComplexTypeWithParsableProperties` class to include the `ParseLimitsInInvariantCulture` attribute in the `Range` attribute. This change ensures consistent parsing of range limits across different locale settings.
1 parent e93c889 commit ea4c5ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parsable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class ComplexTypeWithParsableProperties
4848
[Range(typeof(DateTime), "2023-01-01", "2025-12-31", ErrorMessage = "DateTime must be between 2023-01-01 and 2025-12-31")]
4949
public DateTime? DateTimeWithRange { get; set; } = DateTime.UtcNow;
5050
51-
[Range(typeof(decimal), "0.1", "100.5", ErrorMessage = "Amount must be between 0.1 and 100.5")]
51+
[Range(typeof(decimal), "0.1", "100.5", ErrorMessage = "Amount must be between 0.1 and 100.5", ParseLimitsInInvariantCulture = true)]
5252
public decimal? DecimalWithRange { get; set; } = 50.5m;
5353
5454
[Range(0, 12, ErrorMessage = "Hours must be between 0 and 12")]

0 commit comments

Comments
 (0)