From ea4c5ac19a0931ea902a49fda27ea7695aa7d769 Mon Sep 17 00:00:00 2001 From: Marco Minerva Date: Wed, 9 Jul 2025 15:12:48 +0200 Subject: [PATCH] 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. --- .../ValidationsGenerator.Parsable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parsable.cs b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parsable.cs index 6ea212ebaa16..fb3d133c3515 100644 --- a/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parsable.cs +++ b/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/ValidationsGenerator.Parsable.cs @@ -48,7 +48,7 @@ public class ComplexTypeWithParsableProperties [Range(typeof(DateTime), "2023-01-01", "2025-12-31", ErrorMessage = "DateTime must be between 2023-01-01 and 2025-12-31")] public DateTime? DateTimeWithRange { get; set; } = DateTime.UtcNow; - [Range(typeof(decimal), "0.1", "100.5", ErrorMessage = "Amount must be between 0.1 and 100.5")] + [Range(typeof(decimal), "0.1", "100.5", ErrorMessage = "Amount must be between 0.1 and 100.5", ParseLimitsInInvariantCulture = true)] public decimal? DecimalWithRange { get; set; } = 50.5m; [Range(0, 12, ErrorMessage = "Hours must be between 0 and 12")]