public async Task Should_Push_Page_On_Stack() { // Given var fixture = new ViewStackServiceFixture(); // When await fixture.ViewStackService.PushModal(new PageViewModelMock(), "modal"); var result = await fixture.ViewStackService.ModalStack.FirstAsync(); // Then result.ShouldNotBeEmpty(); result.Count.ShouldBe(1); }
public async Task Should_Have_One_Item_On_Stack() { // Given ViewStackService sut = new ViewStackServiceFixture(); await sut.PushPage(new PageViewModelMock(), pages : 3); await sut.PopToRootPage(); // When var result = await sut.PageStack.FirstOrDefaultAsync(); // Then result.ShouldHaveSingleItem(); }
public async Task Should_Pop_Page() { // Given var fixture = new ViewStackServiceFixture(); fixture.PushModal(new PageViewModelMock()).Subscribe(); // When fixture.ViewStackService.PopPage().Subscribe(); var result = await fixture.ViewStackService.PageStack.FirstAsync(); // Then result.ShouldBeEmpty(); }
public async Task Should_Push_Page() { // Given ViewStackService sut = new ViewStackServiceFixture(); // When await sut.PushPage(new PageViewModelMock()); var result = await sut.TopPage(); // Then result.ShouldNotBeNull(); result.ShouldBeOfType <PageViewModelMock>(); }
public async Task Should_Push_Page_On_Stack() { // Given ViewStackService sut = new ViewStackServiceFixture(); // When await sut.PushPage(new PageViewModelMock()); var result = await sut.PageStack.FirstAsync(); // Then result.ShouldNotBeEmpty(); result.Count.ShouldBe(1); }
public async Task Should_Push_Modal() { // Given var fixture = new ViewStackServiceFixture(); fixture.PushModal(new PageViewModelMock()).Subscribe(); // When var result = await fixture.ViewStackService.TopModal(); // Then result.ShouldNotBeNull(); result.ShouldBeOfType <PageViewModelMock>(); }
public async Task Should_Pop_Page() { // Given ViewStackService sut = new ViewStackServiceFixture(); await sut.PushModal(new PageViewModelMock()); // When await sut.PopPage(); var result = await sut.PageStack.FirstAsync(); // Then result.ShouldBeEmpty(); }
public async Task Should_Return_Last_Element() { // Given var fixture = new ViewStackServiceFixture(); fixture.PushPage(new PageViewModelMock("1")).Subscribe(); fixture.PushPage(new PageViewModelMock("2")).Subscribe(); // When var result = await fixture.ViewStackService.TopPage(); // Then result.Should().BeOfType <PageViewModelMock>(); result.Id.Should().Be("2"); }
public async Task Should_Push_And_Pop(int amount) { // Given var fixture = new ViewStackServiceFixture(); fixture.PushModal(new PageViewModelMock(), "modal", amount).Subscribe(); fixture.ViewStackService.ModalStack.FirstAsync().Wait().Count.Should().Be(amount); fixture.PopModal(amount).Subscribe(); // When var result = await fixture.ViewStackService.ModalStack.FirstAsync(); // Then result.Should().BeEmpty(); }
public async Task Should_Return_Last_Element() { // Given ViewStackService sut = new ViewStackServiceFixture(); await sut.PushPage(new PageViewModelMock("1")); await sut.PushPage(new PageViewModelMock("2")); // When var result = await sut.TopPage(); // Then result.ShouldBeOfType <PageViewModelMock>(); result.Id.ShouldBe("2"); }
public async Task Should_Clear_Navigation_Stack_If_Reset() { // Given ViewStackService sut = new ViewStackServiceFixture().WithView(Substitute.For <IView>()); // When await sut.PushPage(new PageViewModelMock(), pages : 3); await sut.PushPage(new PageViewModelMock(), resetStack : true); var result = await sut.PageStack.FirstOrDefaultAsync(); // Then result.ShouldHaveSingleItem(); }
public async Task Should_Push_And_Pop(int amount) { // Given ViewStackService sut = new ViewStackServiceFixture(); await sut.PushModal(new PageViewModelMock(), "modal", amount); sut.ModalStack.FirstAsync().Wait().Count.ShouldBe(amount); await sut.PopModal(amount); // When var result = await sut.ModalStack.FirstAsync(); // Then result.ShouldBeEmpty(); }
public async Task Should_Pop_Modal() { // Given ViewStackService sut = new ViewStackServiceFixture(); await sut.PushModal(new PageViewModelMock()); // When var item = await sut.ModalStack.FirstAsync(); item.Count.ShouldBe(1); await sut.PopModal(); // Then item = await sut.ModalStack.FirstAsync(); item.ShouldBeEmpty(); }
public async Task Should_Return_Single_Notification() { // Given int count = 0; ViewStackService sut = new ViewStackServiceFixture(); await sut.PushPage(new PageViewModelMock(), pages : 3); sut.View.PagePopped.Subscribe(_ => { count++; }); // When await sut.PopToRootPage(); // Then count.ShouldBe(1); }
public async Task Should_Pop_Modal() { // Given var fixture = new ViewStackServiceFixture(); fixture.PushModal(new PageViewModelMock()).Subscribe(); // When var item = await fixture.ViewStackService.ModalStack.FirstAsync(); item.Count.ShouldBe(1); fixture.PopModal().Subscribe(); // Then item = await fixture.ViewStackService.ModalStack.FirstAsync(); item.ShouldBeEmpty(); }
public static ViewStackServiceFixture WithModalStack(this ViewStackServiceFixture viewStackServiceFixture) { viewStackServiceFixture.ViewStackService.PushModal(viewStackServiceFixture.ModalViewModel, viewStackServiceFixture.ModalViewModel.Id).Subscribe(); return(viewStackServiceFixture); }
public static ViewStackServiceFixture WithPageStack(this ViewStackServiceFixture viewStackServiceFixture) { viewStackServiceFixture.ViewStackService.PushPage(viewStackServiceFixture.PageViewModel, viewStackServiceFixture.PageViewModel.Id).Subscribe(); return(viewStackServiceFixture); }