Exemplo n.º 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.Should().BeOfType <InvalidOperationException>();
                result?.Message.Should().Be("Stack is empty.");
            }
Exemplo n.º 2
0
            public async Task Should_Receive_Pop_Modal()
            {
                // Given, When
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new NavigableViewModelMock());

                // When
                await sut.PopModal();

                // Then
                await sut.View.Received().PopModal();
            }
Exemplo n.º 3
0
            public async Task Should_Return_Unit()
            {
                // Given, When
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new NavigableViewModelMock());

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

                // Then
                result.Should().BeOfType <Unit>();
            }
Exemplo n.º 4
0
            public async Task Should_Push_And_Pop(int amount)
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new NavigableViewModelMock(), "modal", amount);

                sut.ModalStack.FirstAsync().Wait().Count.Should().Be(amount);
                await sut.PopModal(amount);

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

                // Then
                result.Should().BeEmpty();
            }
Exemplo n.º 5
0
            public async Task Should_Pop_Modal()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new NavigableViewModelMock());

                // When
                var item = await sut.ModalStack.FirstAsync();

                item.Count.Should().Be(1);
                await sut.PopModal();

                // Then
                item = await sut.ModalStack.FirstAsync();

                item.Should().BeEmpty();
            }