コード例 #1
0
            public async Task Should_Throw_If_Stack_Empty()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();

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

                // Then
                result.ShouldBeOfType <InvalidOperationException>();
                result?.Message.ShouldBe("Stack is empty.");
            }
コード例 #2
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>();
            }
コード例 #3
0
            public async Task Should_Receive_Pop_Modal()
            {
                // Given, When
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new PageViewModelMock());

                // When
                await sut.PopModal();

                // Then
                await sut.View.Received().PopModal();
            }
コード例 #4
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>();
            }
コード例 #5
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();
            }
コード例 #6
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();
            }
コード例 #7
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();
            }
コード例 #8
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();
            }
コード例 #9
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();
            }
コード例 #10
0
            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();
            }