From bac07687f019630628d3ee66c62b9649f5cfcc5d Mon Sep 17 00:00:00 2001 From: Matous Kozak Date: Mon, 18 Mar 2024 15:45:39 +0100 Subject: [PATCH] add test for yyyy short date pattern --- .../DateTimeFormatInfoShortDatePattern.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs index dd601d0f9ffb9..7d6c6ae455df0 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs @@ -232,6 +232,21 @@ public void ShortDatePattern_Set_GetReturnsExpected(string value) Assert.Equal(value, format.ShortDatePattern); } + public static IEnumerable ShortDatePatter_Set_Culture_TestData() + { + yield return new object[] { "de-DE", "dd.MM.yyyy" }; + yield return new object[] { "en-US", "M/d/yyyy" }; + yield return new object[] { "fa-IR", "yyyy/M/d" }; + } + + [Theory] + [MemberData(nameof(ShortDatePatter_Set_Culture_TestData))] + public void ShortDatePattern_SetCulture_GetReturnsExpected(string cultureName, string expected) + { + var format = new CultureInfo(cultureName).DateTimeFormat; + Assert.True(expected == format.ShortDatePattern, $"Failed for culture: {cultureName}. Expected: {expected}, Actual: {format.ShortDatePattern}"); + } + [Fact] public void ShortDatePattern_Set_InvalidatesDerivedPatterns() {