예제 #1
0
        public void Initialize()
        {
            this.dbContext = new FakeDatabaseContext();
            this.workbook  = new Workbook(this.dbContext, WinSettings.Instance);

            this.views = new List <ISystemView>
            {
                new SystemView {
                    ViewKind = ViewKind.Today
                },
                new SystemView {
                    ViewKind = ViewKind.Tomorrow
                },
                new SystemView {
                    ViewKind = ViewKind.Starred
                },
                new SystemView {
                    ViewKind = ViewKind.Late
                }
            };

            foreach (var view in this.views)
            {
                this.dbContext.AddSystemView(view);
            }

            this.workbook.Initialize();

            UITestHelper.ExecuteOnUIThread(() =>
            {
                this.viewmodel = this.CreateMainPageViewModel();
                var manager    = new NavigationMenuManager(this.workbook, new TestSynchronizationManager(), this.viewmodel);
            });
        }
예제 #2
0
        public void OnSetup()
        {
            _uiTestHelper = new UITestHelper();

            _uiTestHelper.ExecuteOnUIThread(() =>
            {
                _navigationManagerImpl = new NavigationManagerImpl(new FakeViewLocator());
                _navigationManagerImpl.SetMainWorkspace(new Grid(), new FakeWorkspaceAdapter());
            });
        }
예제 #3
0
        public void It_must_track_smart_views()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                this.workbook.AddSmartView("SV1", SmartViewRule);

                this.AssertMenu("SV1");

                this.workbook.RemoveSmartView("SV1");

                this.AssertMenu();
            });
        }
예제 #4
0
        public void OnSetup()
        {
            _uiTestHelper = new UITestHelper();

            _uiTestHelper.ExecuteOnUIThread(() =>
            {
                _workspace        = new Grid();
                _workspaceAdapter = new GridWorkspaceAdapter();
                //_workspaceAdapter.SetTransitionAnimationProvider(TransitionAnimation.Create);
                _workspaceAdapter.SetMainWorkspace(_workspace);
                _workspaceAdapter.SetViewGroupCollection(new ViewGroupCollection());
            });
        }
예제 #5
0
        public void It_must_track_folders()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                this.workbook.AddFolder("1");
                this.AssertMenu("1");

                this.workbook.RemoveFolder("1");
                this.AssertMenu();

                this.workbook.AddFolder("2");
                this.workbook.AddFolder("3");
                this.AssertMenu("2", "3");
            });
        }
예제 #6
0
        public void It_must_track_views()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                this.views[0].IsEnabled = true;
                this.AssertMenu("today");

                this.views[0].IsEnabled = false;
                this.AssertMenu();

                this.views[0].IsEnabled = true;
                this.views[1].IsEnabled = true;
                this.AssertMenu("today", "tomorrow");
            });
        }
예제 #7
0
        public void It_must_track_contexts()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                this.workbook.AddContext("1");
                this.AssertMenu("1");

                this.workbook.RemoveContext("1");
                this.AssertMenu();

                this.workbook.AddContext("2");
                this.workbook.AddContext("3");
                this.AssertMenu("2", "3");
            });
        }
예제 #8
0
        public void When_timer_ticks_start_date_is_checked()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                // setup
                this.Setup(DateTime.Now.AddDays(1));
                Assert.AreEqual(0, this.folderItemViewModel.SmartCollection.Count);

                // act
                StaticTestOverrides.Now = DateTime.Now.AddDays(1);
                this.scheduler.OnUpdateTasksTimerTick();

                // verify
                Assert.AreEqual(1, this.folderItemViewModel.SmartCollection.Count);
            });
        }
예제 #9
0
        public void When_timer_ticks_collection_is_rebuilt()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                // setup
                this.Setup(null);
                Assert.IsTrue(this.folderItemViewModel.SmartCollection.Items[0].Title.StartsWith("Today"));

                // act
                StaticTestOverrides.Now = DateTime.Now.AddDays(1);
                this.scheduler.OnUpdateTasksTimerTick();

                // verify
                Assert.IsFalse(this.folderItemViewModel.SmartCollection.Items[0].Title.StartsWith("Today"));
            });
        }
예제 #10
0
        public void It_must_manage_separators_add_context()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                this.AssertMenu();

                this.views[0].IsEnabled = true;
                this.workbook.AddTag("t2");
                this.workbook.AddFolder("f1");

                this.AssertMenu("today", "", "f1", "", "t2");

                this.workbook.AddContext("c3");

                this.AssertMenu("today", "", "f1", "", "c3", "", "t2");
            });
        }
예제 #11
0
        public void Starts_with_2_smart_views()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                this.viewmodel = this.CreateMainPageViewModel();

                var manager = new NavigationMenuManager(this.workbook, new TestSynchronizationManager(), this.viewmodel);

                this.AssertMenu();

                this.views[0].IsEnabled = true;
                this.workbook.AddSmartView("sv1", SmartViewRule);
                this.workbook.AddSmartView("sv2", SmartViewRule);


                this.AssertMenu("today", "", "sv1", "sv2");
            });
        }
예제 #12
0
        public void It_must_manage_separators()
        {
            UITestHelper.ExecuteOnUIThread(() =>
            {
                this.AssertMenu();

                this.views[0].IsEnabled = true;
                this.AssertMenu("today");

                this.workbook.AddFolder("f1");
                this.AssertMenu("today", "", "f1");

                this.views[1].IsEnabled = true;
                this.AssertMenu("today", "tomorrow", "", "f1");

                this.workbook.AddContext("c2");
                this.AssertMenu("today", "tomorrow", "", "f1", "", "c2");

                this.workbook.AddTag("t3");
                this.AssertMenu("today", "tomorrow", "", "f1", "", "c2", "", "t3");

                this.workbook.AddSmartView("sv1", SmartViewRule);
                this.AssertMenu("today", "tomorrow", "", "sv1", "", "f1", "", "c2", "", "t3");

                this.views[1].IsEnabled = false;
                this.AssertMenu("today", "", "sv1", "", "f1", "", "c2", "", "t3");

                this.views[0].IsEnabled = false;
                this.AssertMenu("sv1", "", "f1", "", "c2", "", "t3");

                this.workbook.RemoveFolder("f1");
                this.AssertMenu("sv1", "", "c2", "", "t3");

                this.workbook.RemoveTag("t3");
                this.AssertMenu("sv1", "", "c2");

                this.workbook.RemoveContext("c2");
                this.AssertMenu("sv1");

                this.workbook.RemoveSmartView("sv1");
                this.AssertMenu();
            });
        }