Ejemplo n.º 1
0
        public void Constructor_SetsNavigationMode()
        {
            MockNavigationEntry navigationEntry = new MockNavigationEntry() { PageName = "SamplePage" };
            PageNavigationEventArgs eventArgs = new PageNavigationEventArgs(navigationEntry, NavigationMode.Forward);

            Assert.AreEqual(NavigationMode.Forward, eventArgs.NavigationMode);
        }
Ejemplo n.º 2
0
        public void Constructor_Exception_InvalidNavigationMode()
        {
            MockNavigationEntry navigationEntry = new MockNavigationEntry() { PageName = "SamplePage" };

            Assert.ThrowsException<ArgumentException>(() =>
            {
                PageNavigationEventArgs eventArgs = new PageNavigationEventArgs(navigationEntry, (NavigationMode)100);
            });
        }
Ejemplo n.º 3
0
        public async Task Activate_DoesNotCallPerformQueryIfSameQueryAsVisible()
        {
            MockNavigationEntry searchPageEntry = new MockNavigationEntry();
            MockNavigationManager navigationManager = new MockNavigationManager(_ => searchPageEntry);
            SearchManager searchManager = CreateSearchMananger(navigationManager: navigationManager);

            await searchManager.Activate(new MockSearchActivatedEventArgs() { QueryText = "MyQuery", Language = "en-GB" });

            CollectionAssert.AreEqual(new[] { Tuple.Create("MyQuery", "en-GB") }, (ICollection)((MockSearchPageElement)searchPageEntry.Page).Queries);
            CollectionAssert.AreEqual(new[] { Tuple.Create("MyQuery", "en-GB") }, (ICollection)((MockSearchPageElement)searchPageEntry.ViewModel).Queries);
        }
Ejemplo n.º 4
0
        public async Task Activate_SuccessfulEvenWhenNoSearchPageImplementors()
        {
            MockNavigationEntry searchPageEntry = new MockNavigationEntry() { Page = new MockPageElement(), ViewModel = new MockPageElement() };
            MockNavigationManager navigationManager = new MockNavigationManager(_ => searchPageEntry);
            SearchManager searchManager = CreateSearchMananger(navigationManager: navigationManager);

            await searchManager.Activate(new MockSearchActivatedEventArgs() { QueryText = "MyQuery", Language = "en-GB" });
        }
Ejemplo n.º 5
0
        public async Task Activate_CallsPerformQueryOnlyOnSearchPageImplementors()
        {
            MockNavigationEntry searchPageEntry = new MockNavigationEntry() { Page = new MockPageElement() };
            MockNavigationManager navigationManager = new MockNavigationManager(_ => searchPageEntry);
            SearchManager searchManager = CreateSearchMananger(navigationManager: navigationManager);

            await searchManager.Activate(new MockSearchActivatedEventArgs() { QueryText = "MyQuery", Language = "en-GB" });

            CollectionAssert.AreEqual(new[] { Tuple.Create("MyQuery", "en-GB") }, (ICollection)((MockSearchPageElement)searchPageEntry.ViewModel).Queries);
        }