Skip to content

Commit f863b7a

Browse files
committed
Attempt to fix culture comparison on the pipeline for failing tests.
1 parent 57de5f5 commit f863b7a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/Core/DateTime/FluentDatePickerTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// ------------------------------------------------------------------------
44

55
using System.Globalization;
6+
using System.Runtime.Serialization;
67
using Bunit;
78
using Microsoft.AspNetCore.Components;
89
using Microsoft.Extensions.DependencyInjection;
@@ -305,15 +306,16 @@ public void FluentDatePicker_TryParseValueFromString(string? value, string? cult
305306
{
306307
// Arrange
307308
var picker = new FluentDatePicker();
309+
var culture = cultureName != null ? CultureInfo.GetCultureInfo(cultureName) : CultureInfo.InvariantCulture;
308310

309311
// Act
310-
picker.Culture = cultureName != null ? CultureInfo.GetCultureInfo(cultureName) : CultureInfo.InvariantCulture;
312+
picker.Culture = culture;
311313
var successfullParse = picker.TryParseSelectableValueFromString(value, out var resultDate, out var validationErrorMessage);
312314

313315
// Assert
314316
if (successfullParse)
315317
{
316-
Assert.Equal(expectedValue, resultDate?.ToShortDateString());
318+
Assert.Equal(expectedValue, resultDate?.ToString(culture.DateTimeFormat.ShortDatePattern, culture));
317319
}
318320
else
319321
{

0 commit comments

Comments
 (0)