Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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)
                                  );
        }