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