public void OnNavigatedToTest_FirstTo( ) { var frame = new Frame( ); Page page = null; NavigationEventArgs eventObject = null; frame.Navigated += (object sender, NavigationEventArgs e) => { page = e.Content as Page; eventObject = e; }; frame.Navigate(typeof(Page)); SUTest navigation = new SUTest(page); // Act bool loadStateRaised = false; navigation.LoadState += (object sender, LoadStateEventArgs e) => { IsNull(e.PageState); loadStateRaised = true; }; navigation.OnNavigatedTo(eventObject); IsTrue(loadStateRaised); }
public void OnNavigatedFromTest_NothingSaved( ) { var frame = new Frame( ); Page page = null; NavigationEventArgs eventObject = null; frame.Navigated += (object sender, NavigationEventArgs e) => { page = e.Content as Page; eventObject = e; }; frame.Navigate(typeof(Page)); SUTest navigation = new SUTest(page); navigation.OnNavigatedTo(eventObject); // Act bool saveStateRaised = false; navigation.SaveState += (object sender, SaveStateEventArgs e) => { AreEqual(0, e.PageState.Count); saveStateRaised = true; }; navigation.OnNavigatedFrom(eventObject); IsTrue(saveStateRaised); }