Esempio n. 1
0
            public async Task Should_Return_Last_Element()
            {
                // Given
                var fixture = new ViewStackServiceFixture();

                fixture.PushModal(new PageViewModelMock("1")).Subscribe();
                fixture.PushModal(new PageViewModelMock("2")).Subscribe();

                // When
                var result = await fixture.ViewStackService.TopModal();

                // Then
                result.Should().BeOfType <PageViewModelMock>();
                result.Id.Should().Be("2");
            }
Esempio n. 2
0
            public async Task Should_Return_Last_Element()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new PageViewModelMock("1"));

                await sut.PushModal(new PageViewModelMock("2"));

                // When
                var result = await sut.TopModal();

                // Then
                result.ShouldBeOfType <PageViewModelMock>();
                result.Id.ShouldBe("2");
            }
Esempio n. 3
0
            public async Task Should_Receive_Push_Modal()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture().WithView(Substitute.For <IView>());

                // When
                await sut.PushModal(new PageViewModelMock(), "modal");

                // Then
                sut.View.Received().PushModal(Arg.Any <IPageViewModel>(), "modal");
            }
Esempio n. 4
0
            public async Task Should_Throw_If_View_Model_Null()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();

                // When
                var result = await Record.ExceptionAsync(async() => await sut.PushModal(null)).ConfigureAwait(false);

                // Then
                result.ShouldBeOfType <ArgumentNullException>();
            }
Esempio n. 5
0
            public async Task Should_Not_Pop()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture().WithView(Substitute.For <IView>());
                await sut.PushModal(new PageViewModelMock());

                // When
                await sut.TopModal();

                // Then
                await sut.View.DidNotReceive().PopModal();
            }
Esempio n. 6
0
            public async Task Should_Return_Unit()
            {
                // Given, When
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new PageViewModelMock());

                // When
                var result = await sut.PopModal();

                // Then
                result.ShouldBeOfType <Unit>();
            }
Esempio n. 7
0
            public async Task Should_Receive_Pop_Page()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new PageViewModelMock());

                // When
                await sut.PopPage();

                // Then
                sut.View.Received().PopPage();
            }
Esempio n. 8
0
            public async Task Should_Push_Modal()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new PageViewModelMock());

                // When
                var result = await sut.TopModal();

                // Then
                result.ShouldNotBeNull();
                result.ShouldBeOfType <PageViewModelMock>();
            }
Esempio n. 9
0
            public void Should_Receive_Pop_Page()
            {
                // Given
                var fixture = new ViewStackServiceFixture();

                fixture.PushModal(new PageViewModelMock()).Subscribe();

                // When
                fixture.ViewStackService.PopPage().Subscribe();

                // Then
                fixture.View.Received().PopPage();
            }
Esempio n. 10
0
            public async Task Should_Receive_Pop_Modal()
            {
                // Given, When
                var fixture = new ViewStackServiceFixture();

                fixture.PushModal(new PageViewModelMock()).Subscribe();

                // When
                fixture.PopModal().Subscribe();

                // Then
                await fixture.View.Received().PopModal();
            }
Esempio n. 11
0
            public async Task Should_Return_Unit()
            {
                // Given, When
                var fixture = new ViewStackServiceFixture();

                fixture.PushModal(new PageViewModelMock()).Subscribe();

                // When
                var result = await fixture.PopModal();

                // Then
                result.Should().BeOfType <Unit>();
            }
Esempio n. 12
0
            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.Should().BeEmpty();
            }
Esempio n. 13
0
            public void Should_Pop_Modal()
            {
                // Given
                var fixture = new ViewStackServiceFixture();

                fixture.PushModal(new PageViewModelMock()).Subscribe();

                // When
                fixture.ViewStackService.ModalStack.FirstAsync().Wait().Count.Should().Be(1);
                fixture.PopModal().Subscribe();

                // Then
                fixture.ViewStackService.ModalStack.FirstAsync().Wait().Should().BeEmpty();
            }
Esempio n. 14
0
            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();
            }
Esempio n. 15
0
            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.Should().NotBeNull();
                result.Should().BeOfType <PageViewModelMock>();
            }
Esempio n. 16
0
            public async Task Should_Push_Page_On_Stack()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();

                // When
                await sut.PushModal(new PageViewModelMock(), "modal");

                var result = await sut.ModalStack.FirstAsync();

                // Then
                result.ShouldNotBeEmpty();
                result.Count.ShouldBe(1);
            }
Esempio n. 17
0
            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();
            }
Esempio n. 18
0
            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();
            }
Esempio n. 19
0
            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_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();
            }