public async Task PushModal() { var page = new Mock <Page>().Object; var mockNav = new Mock <INavigation>(); mockNav.Setup(m => m.PushModalAsync(page)).Returns(Task.CompletedTask); var lrpNav = new LrpNavigation(mockNav.Object); await lrpNav.PushModalAsync(page); }
public void ModalStack() { var expectedModalStack = new Mock <IReadOnlyList <Page> >(MockBehavior.Strict).Object; var mockNav = new Mock <INavigation>(); mockNav.Setup(m => m.ModalStack).Returns(expectedModalStack); var lrpNav = new LrpNavigation(mockNav.Object); Assert.AreEqual(expectedModalStack, lrpNav.ModalStack); }
public async Task PopModal() { var expectedPage = new Mock <Page>().Object; var mockNav = new Mock <INavigation>(); mockNav.Setup(m => m.PopModalAsync()).ReturnsAsync(expectedPage); var lrpNav = new LrpNavigation(mockNav.Object); var actualPage = await lrpNav.PopModalAsync(); Assert.AreEqual(expectedPage, actualPage); }
public App() { InitializeComponent(); var builder = new ContainerBuilder(); builder.RegisterModule <MainModule>(); builder.RegisterModule <Services2Module>(); builder.RegisterModule <LrpFactorsModule>(); var container = builder.Build(); // all of the following components are Autofac app-lifetime scope _tokenManager = container.Resolve <IJwtTokenManager>(); var mp = container.Resolve <IMainPage>(); MainPage = new NavigationPage(mp as ContentPage); var lrpNavigation = new LrpNavigation(MainPage.Navigation); // By passing the mainPage to the LoginPageController // before passing it to the MainPageController, // we ensure that the subscriptions to MainPage's // OnAppearingCalledEvent gives priority to the LoginPageController; _loginPageController = container.Resolve <ILoginPageController> ( new NamedParameter("navigation", lrpNavigation), new NamedParameter("mainPage", mp) ); var mainPageViewModel = container.Resolve <IMainPageViewModel> ( new NamedParameter("pageTitle", LrpConstants.MainPageTitle) ); mp.BindingContext = mainPageViewModel; _mainPageController = container.Resolve <IMainPageController> ( new NamedParameter("mainPage", mp), new NamedParameter("mainPageViewModel", mainPageViewModel), new NamedParameter("navigation", lrpNavigation) ); }