From 64a41f63c941f91311ea2cf435659ace94e52fb5 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sun, 7 Apr 2024 11:04:13 -0600 Subject: [PATCH] chore: refactor test --- .../Fixtures/Navigation/NavigationTests.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Navigation/NavigationTests.cs b/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Navigation/NavigationTests.cs index ae06e5adf..904282884 100644 --- a/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Navigation/NavigationTests.cs +++ b/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Navigation/NavigationTests.cs @@ -230,19 +230,18 @@ public async Task RelativeNavigation_RemovesPage_AndNavigatesModally() Assert.Null(startupEx); var window = GetWindow(mauiApp); - var rootPage = window.Page as MockViewA; - Assert.NotNull(rootPage); - TestPage(rootPage); - var currentPage = rootPage.Navigation.ModalStack.Last(); + Assert.IsType(window.Page); + TestPage(window.Page); + var currentPage = window.CurrentPage; Assert.IsType(currentPage); TestPage(currentPage); - var container = currentPage.GetContainerProvider(); - var navService = container.Resolve(); - Assert.Equal(2, rootPage.Navigation.ModalStack.Count); - await navService.NavigateAsync("../MockViewC"); - var viewC = window.Page.Navigation.ModalStack.Last(); - Assert.IsType(viewC); - Assert.Equal(2, rootPage.Navigation.ModalStack.Count); + var navService = Prism.Navigation.Xaml.Navigation.GetNavigationService(currentPage); + Assert.Single(window.Page.Navigation.ModalStack); + var result = await navService.NavigateAsync("../MockViewC"); + Assert.True(result.Success); + Assert.Null(result.Exception); + Assert.IsType(window.CurrentPage); + Assert.Single(window.Page.Navigation.ModalStack); } [Fact]