示例#1
0
        public void ConvertFromEDaysOfWeekFlagsWithMultipleDays()
        {
            HashSet <EDaysOfWeek> weekendDays = DaysOfWeek.ConvertFrom(EDaysOfWeekFlags.Saturday ^ EDaysOfWeekFlags.Sunday);

            Assert.That(weekendDays, Is.Not.Empty);
            Assert.That(weekendDays.Count, Is.EqualTo(2));
            Assert.That(weekendDays.Contains(EDaysOfWeek.Saturday), Is.True);
            Assert.That(weekendDays.Contains(EDaysOfWeek.Sunday), Is.True);
        }
示例#2
0
 public void ConvertFromEDaysOfWeekFlags()
 {
     Assert.That(DaysOfWeek.ConvertFrom(EDaysOfWeekFlags.Monday).Single(), Is.EqualTo(EDaysOfWeek.Monday));
     Assert.That(DaysOfWeek.ConvertFrom(EDaysOfWeekFlags.Tuesday).Single(), Is.EqualTo(EDaysOfWeek.Tuesday));
     Assert.That(DaysOfWeek.ConvertFrom(EDaysOfWeekFlags.Wednesday).Single(), Is.EqualTo(EDaysOfWeek.Wednesday));
     Assert.That(DaysOfWeek.ConvertFrom(EDaysOfWeekFlags.Thursday).Single(), Is.EqualTo(EDaysOfWeek.Thursday));
     Assert.That(DaysOfWeek.ConvertFrom(EDaysOfWeekFlags.Friday).Single(), Is.EqualTo(EDaysOfWeek.Friday));
     Assert.That(DaysOfWeek.ConvertFrom(EDaysOfWeekFlags.Saturday).Single(), Is.EqualTo(EDaysOfWeek.Saturday));
     Assert.That(DaysOfWeek.ConvertFrom(EDaysOfWeekFlags.Sunday).Single(), Is.EqualTo(EDaysOfWeek.Sunday));
 }
示例#3
0
 public void ConvertFromDayOfWeek()
 {
     Assert.That(DaysOfWeek.ConvertFrom(DayOfWeek.Monday), Is.EqualTo(EDaysOfWeek.Monday));
     Assert.That(DaysOfWeek.ConvertFrom(DayOfWeek.Tuesday), Is.EqualTo(EDaysOfWeek.Tuesday));
     Assert.That(DaysOfWeek.ConvertFrom(DayOfWeek.Wednesday), Is.EqualTo(EDaysOfWeek.Wednesday));
     Assert.That(DaysOfWeek.ConvertFrom(DayOfWeek.Thursday), Is.EqualTo(EDaysOfWeek.Thursday));
     Assert.That(DaysOfWeek.ConvertFrom(DayOfWeek.Friday), Is.EqualTo(EDaysOfWeek.Friday));
     Assert.That(DaysOfWeek.ConvertFrom(DayOfWeek.Saturday), Is.EqualTo(EDaysOfWeek.Saturday));
     Assert.That(DaysOfWeek.ConvertFrom(DayOfWeek.Sunday), Is.EqualTo(EDaysOfWeek.Sunday));
     Assert.That(() => DaysOfWeek.ConvertFrom((DayOfWeek)int.MaxValue), Throws.TypeOf <ArgumentException>());
 }