1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System.Collections.Generic;
8 namespace System.Globalization.Tests
10 public class DateTimeFormatInfoGetAbbreviatedDayName
12 public static IEnumerable<object[]> GetAbbreviatedDayName_TestData()
14 string[] englishAbbreviatedDayNames = new string[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
15 yield return new object[] { DateTimeFormatInfo.InvariantInfo, englishAbbreviatedDayNames };
16 yield return new object[] { new CultureInfo("en-US").DateTimeFormat, englishAbbreviatedDayNames };
17 yield return new object[] { new DateTimeFormatInfo(), englishAbbreviatedDayNames };
19 if (!PlatformDetection.IsUbuntu || PlatformDetection.IsUbuntu1404)
21 yield return new object[] { new CultureInfo("fr-FR").DateTimeFormat, DateTimeFormatInfoData.FrFRAbbreviatedDayNames() };
26 [MemberData(nameof(GetAbbreviatedDayName_TestData))]
27 public void GetAbbreviatedDayName(DateTimeFormatInfo info, string[] expected)
29 DayOfWeek[] values = new DayOfWeek[]
40 for (int i = 0; i < values.Length; ++i)
42 Assert.Equal(expected[i], info.GetAbbreviatedDayName(values[i]));
47 [InlineData(DayOfWeek.Sunday - 1)]
48 [InlineData(DayOfWeek.Saturday + 1)]
49 public void GetAbbreviatedDayName_Invalid_ThrowsArgumentOutOfRangeException(DayOfWeek dayofweek)
51 AssertExtensions.Throws<ArgumentOutOfRangeException>("dayofweek", () => new DateTimeFormatInfo().GetAbbreviatedDayName(dayofweek));