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.TopModal()).ConfigureAwait(false);

                // Then
                result.Should().BeOfType <ArgumentOutOfRangeException>().Which.ParamName.Should().Be("index");
            }
Exemplo n.º 2
0
            public async Task Should_Not_Pop()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture().WithView(Substitute.For <IView>());
                await sut.PushModal(new NavigableViewModelMock());

                // When
                await sut.TopModal();

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

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

                // Then
                result.Should().NotBeNull();
                result.Should().BeOfType <NavigableViewModelMock>();
            }
Exemplo n.º 4
0
            public async Task Should_Return_Last_Element()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();
                await sut.PushModal(new NavigableViewModelMock("1"));

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

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

                // Then
                result.Should().BeOfType <NavigableViewModelMock>();
                result.Id.Should().Be("2");
            }
Exemplo n.º 5
0
            public async Task Should_Throw_If_Stack_Empty()
            {
                // Given
                ViewStackService sut = new ViewStackServiceFixture();

                // When
                var result = await Should.ThrowAsync <InvalidOperationException>(async() => await sut.TopModal()).ConfigureAwait(false);

                // Then
                result.Message.ShouldBe("Sequence contains no elements");
            }