Ejemplo n.º 1
0
        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()));
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            //var weekRel = new TypeRelay(typeof(IScheduleElem), typeof(Week));


            storage = new SchedulesInMemoryDbStorage(new DefaultSchElemsFactory());
            var fixture = new Fixture();

            FixtureUtils.ConfigureFixtureForCreateSchedule(fixture);
            tree = fixture.Create <Schedule>();
            var day = fixture.Create <Day>();

            day.Elems = fixture.CreateMany <Lesson>(4).Cast <IScheduleElem>().ToList();
            var week = fixture.Create <Week>();

            week.Elems = new List <IScheduleElem>()
            {
                day
            };
            tree.ScheduleRoot   = week;
            tree.ScheduleGroups = fixture.CreateMany <ScheduleGroup>().Cast <IScheduleGroup>().ToList();
        }