Example #1
0
        public void NavigateTo_WithTypeAndParameter_NavigatesToPageWithFullTypeName()
        {
            MockNavigationManager navigationManager = new MockNavigationManager();

            navigationManager.NavigateTo(typeof(NavigationManagerExFixture), "Parameter");

            CollectionAssert.AreEqual(new[] { new Tuple<string, object>("Okra.Tests.Navigation.NavigationManagerExFixture", "Parameter") },
                        (ICollection)navigationManager.NavigatedPages);
        }
Example #2
0
        public async Task Activate_DoesNotNavigateIfAlreadyShowingSearchPage()
        {
            MockNavigationManager navigationManager = new MockNavigationManager();
            SearchManager searchManager = CreateSearchMananger(navigationManager: navigationManager);

            navigationManager.NavigateTo("Search");
            navigationManager.NavigatedPages.Clear();

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

            CollectionAssert.AreEqual(new Tuple<string, object>[] { }, (ICollection)navigationManager.NavigatedPages);
        }
Example #3
0
        public void NavigateTo_WithTypeAndParameter_Exception_IfPageNameIsNull()
        {
            MockNavigationManager navigationManager = new MockNavigationManager();

            Assert.ThrowsException<ArgumentNullException>(() => navigationManager.NavigateTo((Type)null, "Parameter"));
        }
Example #4
0
        public void WithSharableElement_DoesNotSetDisplayText()
        {
            INavigationManager navigationManager = new MockNavigationManager(pageName =>
            {
                return new MockNavigationEntry()
                {
                    PageName = pageName,
                    PageElements = new object[] { new MockShareablePageElement() }
                };
            });

            TestableSharingManager sharingManager = CreateSharingManager(navigationManager);
            sharingManager.DefaultFailureText = "Default Text";

            navigationManager.NavigateTo("Test Page");
            MockDataRequest dataRequest = new MockDataRequest();
            sharingManager.DataRequested(dataRequest);

            CollectionAssert.AreEqual(new string[] { }, dataRequest.FailureText);
        }
Example #5
0
        public void WithSharableElement_ForwardsDataRequest()
        {
            INavigationManager navigationManager = new MockNavigationManager(pageName =>
                                {
                                    return new MockNavigationEntry()
                                            {
                                                PageName = pageName,
                                                PageElements = new object[] { new MockPageElement(), new MockShareablePageElement(), new MockPageElement() }
                                            };
                                });

            TestableSharingManager sharingManager = CreateSharingManager(navigationManager);

            navigationManager.NavigateTo("Test Page");
            MockDataRequest dataRequest = new MockDataRequest();
            sharingManager.DataRequested(dataRequest);

            MockShareablePageElement sharableElement = navigationManager.CurrentPage.GetElements().First(e => e is MockShareablePageElement) as MockShareablePageElement;
            CollectionAssert.AreEqual(new object[] { dataRequest }, sharableElement.DataRequests);
        }