public async Task RemovePageFor_TargetImplementsIRemoved_ExecutesOnRemovedAsync() { var vm = new Mock <IOnViewRemoved>(); vm.Setup(o => o.OnViewRemovedAsync()).Verifiable(); //Can't Mock page because will compare types //and Page != Mock<Page> var page = new EmptyPage { BindingContext = vm.Object }; var navigation = new Mock <INavigation>(); navigation.Setup(o => o.NavigationStack).Returns( new List <Page> { null, page, new Mock <Page>().Object }); var ns = new NavigationService(navigation.Object); await ns.RemovePageFor <EmptyViewModel>(); vm.VerifyAll(); }
/// <summary> /// Initializes a new instance of the <see cref="StopwatchPage"/> class. /// </summary> public StopwatchPage() { //this.SetBinding(ContentPage.TitleProperty, "Title"); Title = "Stopwatch"; Icon = "maintabbed/clock_tabs_ic_stopwatch.png"; Content = new EmptyPage(); }
/// <summary> /// Initializes a new instance of the <see cref="WorldclockPage"/> class /// </summary> public WorldclockPage() { Title = "World clock"; Icon = "maintabbed/clock_tabs_ic_worldclock.png"; Content = new EmptyPage(); }
public App() { //wird für IOS benötigt!!!! //IOS basiert darauf das immer eine Seite initalisiert ist //deshalb muss inital auch eine Seite initalisiert werden da sonst die folgende Exception geworfen wird //System.NullReferenceException: Object reference not set to an instance of an object MainPage = new EmptyPage(); }
///<summary> ///Initializes a new instance of the <see cref="TimerPage"/> class ///</summary> public TimerPage() { Title = "Timer"; Icon = "maintabbed/clock_tabs_ic_timer.png"; set_time_ = new Time(); model_ = new Timer(); Content = new EmptyPage(); }
private void CheckEmptyPage() { if (ViewModel.Itineraries.Count == 0) { Content = new EmptyPage(); } else { Content = new ItineraryPageNonEmpty(); } }
public void AutoWireViewModel_ViewModelExists_SetsBindingContextToViewModel() { var mockIoc = new Mock <IIoc>(); mockIoc.Setup(m => m.Resolve(typeof(EmptyViewModel))).Returns(new EmptyViewModel()); var page = new EmptyPage(); ViewModelLocator.ContainerImplementation = mockIoc.Object; ViewModelLocator.AutoWireViewModel(page); Assert.IsType <EmptyViewModel>(page.BindingContext); }
public void AutoWireViewModel_Always_CallsIIocResolve() { var mockIoc = new Mock <IIoc>(); mockIoc.Setup(m => m.Resolve(typeof(EmptyViewModel))).Returns(new EmptyViewModel()).Verifiable(); var page = new EmptyPage(); ViewModelLocator.ContainerImplementation = mockIoc.Object; ViewModelLocator.AutoWireViewModel(page); mockIoc.VerifyAll(); }
public void AddingMultiplePagesSucceeds() { IConsolePage pageOne = new EmptyPage(); IConsolePage pageTwo = new EmptyPage(); var display = new DisplayManager(); display.Show(pageOne); Assert.True(display.CurrentPage.Id == pageOne.Id); display.Show(pageTwo); Assert.True(display.CurrentPage.Id == pageTwo.Id); }
public async Task RemovePreviousPageFromMainStack_Always_ExecutesINavigationRemovePage() { var page = new EmptyPage(); var navigation = new Mock <INavigation>(); navigation.Setup(o => o.RemovePage(page)).Verifiable(); navigation.Setup(o => o.NavigationStack).Returns( new List <Page> { null, page, new Page() }); var ns = new NavigationService(navigation.Object); await ns.RemovePreviousPageFromMainStack(); navigation.VerifyAll(); }
public void AutoWireViewModel_ViewModelExists_SetsBindingContextToViewModel() { //Don't test the ioc var mockIoc = new Mock <IIoc>(); mockIoc.Setup(m => m.Resolve(typeof(EmptyViewModel))).Returns(new EmptyViewModel()); ViewModelLocator.Ioc = mockIoc.Object; var page = new EmptyPage(); //Act ViewModelLocator.AutoWireViewModel(page); Assert.IsType <EmptyViewModel>(page.BindingContext); ViewModelLocator.Ioc = null; }
public void WireViewModel_AssemblyQualifiedName_UsesSpecifiedName() { //Don't test the ioc var mockIoc = new Mock <IIoc>(); mockIoc.Setup(m => m.Resolve(typeof(TestAssembly.SpecificViewModel))).Returns(new TestAssembly.SpecificViewModel()); ViewModelLocator.Ioc = mockIoc.Object; var view = new EmptyPage(); //Act ViewModelLocator.WireViewModel(view, typeof(TestAssembly.SpecificViewModel).AssemblyQualifiedName); Assert.IsType <TestAssembly.SpecificViewModel>(view.BindingContext); Assert.Contains(", ZenMvvm.TestAssembly", view.BindingContext.GetType().AssemblyQualifiedName); Assert.Contains(".Views", view.GetType().FullName); ViewModelLocator.Ioc = null; }
public void WireViewModel_Name_UsesNameSpaceNamingConventionOnly() { //Don't test the ioc var mockIoc = new Mock <IIoc>(); mockIoc.Setup(m => m.Resolve(typeof(ImplementsBaseViewModel))).Returns(new ImplementsBaseViewModel()); ViewModelLocator.Ioc = mockIoc.Object; var view = new EmptyPage(); //Act ViewModelLocator.WireViewModel(view, nameof(ImplementsBaseViewModel)); Assert.IsType <ImplementsBaseViewModel>(view.BindingContext); Assert.Contains(".ViewModels", view.BindingContext.GetType().FullName); Assert.Contains(".Views", view.GetType().FullName); ViewModelLocator.Ioc = null; }
/// <summary> /// Delete an page using pageID - transform them in Empty Page and add to EmptyPageList /// If you delete a page, you can using same old instance of page - page will be converter to EmptyPage /// If need deleted page, use GetPage again /// </summary> public void DeletePage(uint pageID, bool addSequence = false) { // get all pages in sequence or a single one var pages = addSequence ? this.GetSeqPages <BasePage>(pageID).ToArray() : new BasePage[] { this.GetPage <BasePage>(pageID) }; // get my header page var header = this.GetPage <HeaderPage>(0); // adding all pages to FreeList foreach (var page in pages) { // create a new empty page based on a normal page var empty = new EmptyPage(page.PageID); // add empty page to cache (with now EmptyPage type) and mark as dirty this.SetDirty(empty); // add to empty free list this.AddOrRemoveToFreeList(true, empty, header, ref header.FreeEmptyPageID); } }