public void SetUp()
        {
            fixture = new Fixture();
            FixtureUtils.ConfigureFixtureForCreateSchedule(fixture);
            freshDays = new List <ISchedule>();
            for (int i = 0; i < 4; i++)
            {
                freshDays.Add(FixtureUtils.CreateFixtureDaySchedule(3, 1, fixture));
            }
            groups = new List <IScheduleGroup>();
            freshDays.ForEach(d => groups.Add(d.ScheduleGroups.First()));
            storedDays = new List <ISchedule>();
            for (int i = 0; i < 3; i++)
            {
                storedDays.Add(FixtureUtils.CreateFixtureDaySchedule(3, 1, fixture));
            }
            storedDays.Select((d, i) => d.ScheduleGroups = new[] { groups[i] }).ToList();
            infoProviderFake = A.Fake <IScheduleInfoProvider>();
            A.CallTo(() => infoProviderFake.GetSchedules(null, default(DayOfWeek))).WithAnyArguments()
            .Returns(freshDays);
            storageFake = A.Fake <ISchedulesStorage>();
            A.CallTo(() => storageFake.GetSchedules(null, default(DayOfWeek))).WithAnyArguments().Returns(storedDays);
            monitorFake = A.Fake <IGroupsMonitor>();
            A.CallTo(() => monitorFake.AvailableGroups).Returns(groups);

            service = new ScheduleService(storageFake, monitorFake, infoProviderFake, new DefaultEventArgsFactory(),
                                          new SchElemsMerger(new DefaultSchElemsFactory()));
        }
Esempio n. 2
0
 public Task <ISchedule> GetScheduleForAsync(IEnumerable <IScheduleGroup> groups, DayOfWeek day)
 {
     return(CompileSchedules(() => storage.GetSchedules(ValidateGroups(groups), day)));
 }