public void Should_set_IsSelected_to_false_on_the_session()
        {
            var session = new Session { ID = mockGuid1, Title = "Some fake session to remove" };
            manager = new MyScheduleManager(repository, new List<Session> { session });

            manager.RemoveFromSchedule(session);

            session.IsSelected.ShouldBe(false);
        }
        public void Should_not_pass_the_newly_removed_session_to_the_repository()
        {
            var session = new Session { ID = mockGuid1, Title = "Some fake session to remove" };
            manager = new MyScheduleManager(repository, new List<Session> { session });

            manager.RemoveFromSchedule(session);

            repository.SessionIdsToSave.Contains(mockGuid1).ShouldBe(false);
        }
        public void Should_ask_schedule_repository_to_save()
        {
            var session = new Session { ID = mockGuid1, Title = "Some fake session to remove" };
            manager = new MyScheduleManager(repository, new List<Session> { session });

            manager.RemoveFromSchedule(session);

            repository.SaveWasCalled.ShouldBe(true);
        }
        public void Should_set_IsSelected_to_true_on_the_session()
        {
            var session = new Session { ID = mockGuid1, Title = "Some fake session to add" };
            manager = new MyScheduleManager(repository, new List<Session> { session });

            manager.AddToSchedule(session);

            session.IsSelected.ShouldBe(true);
        }
        public void Should_pass_the_newly_added_session_to_the_repository()
        {
            var session = new Session { ID = mockGuid1, Title = "Some fake session to add" };
            manager = new MyScheduleManager(repository, new List<Session> { session });

            manager.AddToSchedule(session);

            repository.SessionIdsToSave.Contains(mockGuid1).ShouldBe(true);
        }
        public void Should_pass_previously_added_sessions_to_the_repository()
        {
            var session1 = new Session { ID = mockGuid1, Title = "Some fake session to remove" };
            var session2 = new Session { ID = mockGuid2, IsSelected = true, Title = "Another fake session" };
            manager = new MyScheduleManager(repository, new List<Session> { session1, session2 });

            manager.RemoveFromSchedule(session1);

            repository.SessionIdsToSave.Contains(mockGuid2).ShouldBe(true);
        }
        public void Should_ask_the_repository_to_get_all_selected_sessions()
        {
            var sessions = new List<Session>
            {
                new Session { ID = mockGuid1, Title = "Some fake session" }
            };
            manager = new MyScheduleManager(repository, sessions);

            manager.SetSelectedSessions();

            repository.GetAllWasCalled.ShouldBe(true);
        }
Example #8
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            InitializeWindow();

            // TODO: put this in a thread when the UI is blocked
            Sessions = SessionsOnDisk.GetAll();
            MyScheduleManager = new MyScheduleManager(new ScheduleTextFileRepository(), Sessions);
            MyScheduleManager.SetSelectedSessions();

            InitializeMainViewControllers();
            InitializeTabController();

            window.MakeKeyAndVisible();
            return true;
        }
        public void Should_flag_the_correct_sessions()
        {
            var sessions = new List<Session>
            {
                new Session { ID = mockGuid1, Title = "Some fake session" },
                new Session { ID = mockGuid2, Title = "Another fake session" }
            };
            repository.SessionIdsToGet = new List<Guid> { mockGuid1 };
            manager = new MyScheduleManager(repository, sessions);

            manager.SetSelectedSessions();

            sessions[0].IsSelected.ShouldBe(true);
            sessions[1].IsSelected.ShouldBe(false);
        }
 protected void Initialise_manager_and_repository()
 {
     repository = new FakeScheduleRepository();
     manager = new MyScheduleManager(repository, null);
 }