Example #1
0
        public void Navigate_ViewModelFactory_PageAware()
        {
            var app                   = new PrismApplicationMock();
            var view                  = new AutowireView();
            var viewModel             = (AutowireViewModel)view.BindingContext;
            var pageAware             = (IPageAware)viewModel.NavigationService;
            var navigationServicePage = app.CreateNavigationServiceForPage(view);

            Assert.IsType <AutowireView>(pageAware.Page);
            var navigatedPage = ((IPageAware)navigationServicePage).Page;

            Assert.IsType <AutowireView>(navigatedPage);
            Assert.Same(view, pageAware.Page);
            Assert.Same(pageAware.Page, navigatedPage);
        }
        public void ThrowsException_If_Container_DoesNotSupportModules()
        {
            PrismApplicationMock app = null;
            var exception            = Record.Exception(() => app = new PrismApplicationModulesMock(new XunitPlatformInitializer(_testOutputHelper)));

            // The app should always be null if we do not support Modules
            if (app == null || !((IContainerExtension)app.Container).SupportsModules)
            {
                _testOutputHelper.WriteLine("Container Does Not Support Modules");
                Assert.NotNull(exception);
                Assert.IsType <NotSupportedException>(exception);
            }
            else
            {
                _testOutputHelper.WriteLine("Container Supports Modules");
            }
        }
        public void OnInitialized()
        {
            var app = new PrismApplicationMock();

            Assert.True(app.Initialized);
        }
 private static INavigationService ResolveAndSetRootPage(PrismApplicationMock app)
 {
     var navigationService = app.NavigationService;
     ((IPageAware)navigationService).Page = new ContentPage();
     return navigationService;
 }
Example #5
0
 public TestMainPageViewModel()
 {
     Xamarin.Forms.Mocks.MockForms.Init();
     app       = new PrismApplicationMock();
     viewModel = new MainPageViewModel(app.NavigationService);
 }
 public TestMovieDetailPageViewModel()
 {
     Xamarin.Forms.Mocks.MockForms.Init();
     app       = new PrismApplicationMock();
     viewModel = new MovieDetailPageViewModel();
 }
Example #7
0
 public RegionFixture(ITestOutputHelper testOutputHelper)
     : base(testOutputHelper)
 {
     _app = new PrismApplicationMock(this);
 }