public void Constructor_SetsNavigationMode() { MockNavigationEntry navigationEntry = new MockNavigationEntry() { PageName = "SamplePage" }; PageNavigationEventArgs eventArgs = new PageNavigationEventArgs(navigationEntry, NavigationMode.Forward); Assert.AreEqual(NavigationMode.Forward, eventArgs.NavigationMode); }
public void Constructor_Exception_InvalidNavigationMode() { MockNavigationEntry navigationEntry = new MockNavigationEntry() { PageName = "SamplePage" }; Assert.ThrowsException<ArgumentException>(() => { PageNavigationEventArgs eventArgs = new PageNavigationEventArgs(navigationEntry, (NavigationMode)100); }); }
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); }
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" }); }
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); }