コード例 #1
0
ファイル: ShiftsServiceTests.cs プロジェクト: aviezzi/arale
        public void Should_return_shifts_calendar_without_patron_days_check()
        {
            var sut = new ShiftsService(() => _calendarService.Build());

            var actual = sut
                         .Build(_heroMates)
                         .ToList();

            CheckCompleteCalendar(actual);
        }
コード例 #2
0
ファイル: ShiftsServiceTests.cs プロジェクト: aviezzi/arale
        public void Should_use_old_calendar()
        {
            var sut = new ShiftsService(() => _calendarService.Build());

            var calendarOld = new List <Shift>
            {
                new Shift(new TeamMate("1", "IronMan", "US"), new LocalDate(2019, 11, 1)),
                new Shift(new TeamMate("3", "Thor", "AZ"), new LocalDate(2019, 11, 2)),
                new Shift(new TeamMate("2", "Hulk", "LA"), new LocalDate(2019, 11, 3)),
                new Shift(new TeamMate("4", "AntMan", "US"), new LocalDate(2019, 11, 4)),
                new Shift(new TeamMate("1", "IronMan", "US"), new LocalDate(2019, 11, 5)),
                new Shift(new TeamMate("3", "Thor", "AZ"), new LocalDate(2019, 11, 6)),
                new Shift(new TeamMate("2", "Hulk", "LA"), new LocalDate(2019, 11, 7)),
                new Shift(new TeamMate("4", "AntMan", "US"), new LocalDate(2019, 11, 8)),
                new Shift(new TeamMate("1", "IronMan", "US"), new LocalDate(2019, 11, 9)),
                new Shift(new TeamMate("3", "Thor", "AZ"), new LocalDate(2019, 11, 10))
            };

            var actual = sut
                         .Build(calendarOld)
                         .ToList();

            var expected = new List <Shift>
            {
                new Shift(new TeamMate("2", "Hulk", "LA"), new LocalDate(2019, 12, 1)),
                new Shift(new TeamMate("4", "AntMan", "US"), new LocalDate(2019, 12, 2)),
                new Shift(new TeamMate("1", "IronMan", "US"), new LocalDate(2019, 12, 3)),
                new Shift(new TeamMate("3", "Thor", "AZ"), new LocalDate(2019, 12, 4)),
                new Shift(new TeamMate("2", "Hulk", "LA"), new LocalDate(2019, 12, 5)),
                new Shift(new TeamMate("4", "AntMan", "US"), new LocalDate(2019, 12, 6)),
                new Shift(new TeamMate("1", "IronMan", "US"), new LocalDate(2019, 12, 7)),
                new Shift(new TeamMate("3", "Thor", "AZ"), new LocalDate(2019, 12, 8)),
                new Shift(new TeamMate("2", "Hulk", "LA"), new LocalDate(2019, 12, 9))
            };

            for (var i = 0; i < actual.Count; i++)
            {
                var e = expected.Skip(i).First();
                var a = actual.Skip(i).First();

                Assert.AreEqual(e.Schedule, a.Schedule);
                Assert.AreEqual(e.TeamMate.Id, a.TeamMate.Id);
            }
        }