示例#1
0
        public void SortByStartTest()
        {
            DateTime             now         = ClockProxy.Clock.Now;
            SchoolDay            schoolDay   = new SchoolDay(now);
            TimePeriodCollection timePeriods = new TimePeriodCollection();

            timePeriods.Add(schoolDay.Lesson4);
            timePeriods.Add(schoolDay.Break3);
            timePeriods.Add(schoolDay.Lesson3);
            timePeriods.Add(schoolDay.Break2);
            timePeriods.Add(schoolDay.Lesson2);
            timePeriods.Add(schoolDay.Break1);
            timePeriods.Add(schoolDay.Lesson1);

            timePeriods.SortByStart(ListSortDirection.Descending);

            Assert.Equal(timePeriods[0], schoolDay.Lesson4);
            Assert.Equal(timePeriods[1], schoolDay.Break3);
            Assert.Equal(timePeriods[2], schoolDay.Lesson3);
            Assert.Equal(timePeriods[3], schoolDay.Break2);
            Assert.Equal(timePeriods[4], schoolDay.Lesson2);
            Assert.Equal(timePeriods[5], schoolDay.Break1);
            Assert.Equal(timePeriods[6], schoolDay.Lesson1);

            timePeriods.SortByStart();

            Assert.Equal(timePeriods[0], schoolDay.Lesson1);
            Assert.Equal(timePeriods[1], schoolDay.Break1);
            Assert.Equal(timePeriods[2], schoolDay.Lesson2);
            Assert.Equal(timePeriods[3], schoolDay.Break2);
            Assert.Equal(timePeriods[4], schoolDay.Lesson3);
            Assert.Equal(timePeriods[5], schoolDay.Break3);
            Assert.Equal(timePeriods[6], schoolDay.Lesson4);
        }         // SortByStartTest
示例#2
0
        public void SortByStartTest()
        {
            var schoolDay   = new SchoolDay();
            var timePeriods = new TimePeriodCollection
            {
                schoolDay.Lesson4,
                schoolDay.Break3,
                schoolDay.Lesson3,
                schoolDay.Break2,
                schoolDay.Lesson2,
                schoolDay.Break1,
                schoolDay.Lesson1
            };

            timePeriods.SortByStart();

            timePeriods[0].Should().Be(schoolDay.Lesson1);
            timePeriods[1].Should().Be(schoolDay.Break1);
            timePeriods[2].Should().Be(schoolDay.Lesson2);
            timePeriods[3].Should().Be(schoolDay.Break2);
            timePeriods[4].Should().Be(schoolDay.Lesson3);
            timePeriods[5].Should().Be(schoolDay.Break3);
            timePeriods[6].Should().Be(schoolDay.Lesson4);
        }
        public void SortByStartTest() {
            var schoolDay = new SchoolDay();
            var timePeriods = new TimePeriodCollection
                              {
                                  schoolDay.Lesson4,
                                  schoolDay.Break3,
                                  schoolDay.Lesson3,
                                  schoolDay.Break2,
                                  schoolDay.Lesson2,
                                  schoolDay.Break1,
                                  schoolDay.Lesson1
                              };

            timePeriods.SortByStart();

            timePeriods[0].Should().Be(schoolDay.Lesson1);
            timePeriods[1].Should().Be(schoolDay.Break1);
            timePeriods[2].Should().Be(schoolDay.Lesson2);
            timePeriods[3].Should().Be(schoolDay.Break2);
            timePeriods[4].Should().Be(schoolDay.Lesson3);
            timePeriods[5].Should().Be(schoolDay.Break3);
            timePeriods[6].Should().Be(schoolDay.Lesson4);
        }