Example #1
0
        public void TestItemContainerGeneratorRefresh()
        {
            var items = new ObservableCollection <string>
            {
                "1",
                "2",
                "3"
            };

            var tabControl = new TabControlEx
            {
                ItemsSource = items
            };

            using (new TestWindow(tabControl))
            {
                var itemsPanel = (Panel)tabControl.GetType().GetField("itemsHolder", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(tabControl);

                var tabItemsInitial = GetTabItems(tabControl);

                Assert.That(tabItemsInitial, Has.Count.EqualTo(3));

                Assert.That(itemsPanel.Children.Count, Is.EqualTo(1));

                tabControl.ItemContainerGenerator.GetType().GetMethod("Refresh", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(tabControl.ItemContainerGenerator, null);

                UITestHelper.DoEvents();

                Assert.That(itemsPanel.Children.Count, Is.EqualTo(1));
            }
        }
Example #2
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);
            });
        }
Example #3
0
        public void OnSetup()
        {
            _uiTestHelper = new UITestHelper();

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

                this.AssertMenu("SV1");

                this.workbook.RemoveSmartView("SV1");

                this.AssertMenu();
            });
        }
        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());
            });
        }
Example #6
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");
            });
        }
Example #7
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");
            });
        }
Example #8
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");
            });
        }
Example #9
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);
            });
        }
Example #10
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"));
            });
        }
Example #11
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");
            });
        }
Example #12
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");
            });
        }
Example #13
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();
            });
        }
Example #14
0
        public void TestSetup(Type testType, bool isolate)
        {
            UITestHelper.MarkTestInconclusiveIfNoInternetConnectionIsPresent(testType, _app);

#if __WINDOWS__
            RestartIfAppIsClosed();
#endif

            if (isolate)
            {
                AppSetup.BeginIsolate();
            }
            else
            {
                AppSetup.EnsureMemory();
                AppSetup.EnsureConnection();
            }

            AppSetup.NavigateToIssue(testType, this);
        }
Example #15
0
        public void TestAddRemoveInsertWithItemsSource()
        {
            var items = new ObservableCollection <string>
            {
                "1",
                "2",
                "3"
            };

            var tabControl = new TabControlEx
            {
                ItemsSource = items
            };

            using (new TestWindow(tabControl))
            {
                var itemsPanel = (Panel)tabControl.GetType().GetField("itemsHolder", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(tabControl);

                var tabItemsInitial = GetTabItems(tabControl);

                Assert.That(tabItemsInitial, Has.Count.EqualTo(3));

                Assert.That(itemsPanel.Children.Count, Is.EqualTo(1));

                foreach (var tabItem in tabItemsInitial)
                {
                    tabItem.IsSelected = true;
                    UITestHelper.DoEvents();
                }

                Assert.That(itemsPanel.Children.Count, Is.EqualTo(3));

                items.RemoveAt(1);
                items.Insert(1, "2");

                UITestHelper.DoEvents();

                Assert.That(itemsPanel.Children.Count, Is.EqualTo(2));
            }
        }
Example #16
0
 protected virtual void TestSetup()
 {
     //EnsureMemory();
     UITestHelper.MarkTestInconclusiveIfNoInternetConnectionIsPresent(GetType(), App);
 }
Example #17
0
 void ClickButton()
 {
     UITestHelper.ClickButton(Button);
 }