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."); }
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>(); }
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(); }
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>(); }
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(); }
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(); }
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_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_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(); }