Skip to content

Commit bac0768

Browse files
committed
add test for yyyy short date pattern
1 parent e2ac112 commit bac0768

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs

+15
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,21 @@ public void ShortDatePattern_Set_GetReturnsExpected(string value)
232232
Assert.Equal(value, format.ShortDatePattern);
233233
}
234234

235+
public static IEnumerable<object[]> ShortDatePatter_Set_Culture_TestData()
236+
{
237+
yield return new object[] { "de-DE", "dd.MM.yyyy" };
238+
yield return new object[] { "en-US", "M/d/yyyy" };
239+
yield return new object[] { "fa-IR", "yyyy/M/d" };
240+
}
241+
242+
[Theory]
243+
[MemberData(nameof(ShortDatePatter_Set_Culture_TestData))]
244+
public void ShortDatePattern_SetCulture_GetReturnsExpected(string cultureName, string expected)
245+
{
246+
var format = new CultureInfo(cultureName).DateTimeFormat;
247+
Assert.True(expected == format.ShortDatePattern, $"Failed for culture: {cultureName}. Expected: {expected}, Actual: {format.ShortDatePattern}");
248+
}
249+
235250
[Fact]
236251
public void ShortDatePattern_Set_InvalidatesDerivedPatterns()
237252
{

0 commit comments

Comments
 (0)