예제 #1
0
        public async Task PopToAModalPage()
        {
            var firstPage       = new LCPage();
            var firstModalPage  = new LCPage();
            var secondModalPage = new LCPage();

            var window = new Window(firstPage);
            await window.Navigation.PushModalAsync(firstModalPage);

            await window.Navigation.PushModalAsync(secondModalPage);

            firstModalPage.ClearNavigationArgs();
            secondModalPage.ClearNavigationArgs();

            await window.Navigation.PopModalAsync();

            Assert.IsNotNull(secondModalPage.NavigatingFromArgs);
            Assert.AreEqual(secondModalPage, firstModalPage.NavigatedToArgs.PreviousPage);
            Assert.AreEqual(firstModalPage, secondModalPage.NavigatedFromArgs.DestinationPage);

            Assert.AreEqual(1, secondModalPage.DisappearingCount);
            Assert.AreEqual(1, secondModalPage.AppearingCount);

            Assert.AreEqual(1, firstModalPage.DisappearingCount);
            Assert.AreEqual(2, firstModalPage.AppearingCount);
        }