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"); }
public async Task Should_Receive_Push_Modal() { // Given ViewStackService sut = new ViewStackServiceFixture().WithView(Substitute.For <IView>()); // When await sut.PushModal(new NavigableViewModelMock(), "modal"); // Then await sut.View.Received().PushModal(Arg.Any <IViewModel>(), "modal"); }
public async Task Should_Throw_If_View_Model_Null() { // Given ViewStackService sut = new ViewStackServiceFixture(); // When var result = await Record.ExceptionAsync(async() => await sut.PushModal(null)).ConfigureAwait(false); // Then result.ShouldBeOfType <ArgumentNullException>(); }
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(); }
public async Task Should_Push_Modal_Navigation_Page(bool withNavigationPage) { // Given var view = Substitute.For <IView>(); ViewStackService sut = new ViewStackServiceFixture().WithView(view); // When await sut.PushModal(new NavigableViewModelMock(), withNavigationPage : withNavigationPage); // Then await view.Received().PushModal(Arg.Any <INavigable>(), Arg.Any <string>(), withNavigationPage); }
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>(); }
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(); }
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>(); }
public async Task Should_Push_Page_On_Stack() { // Given ViewStackService sut = new ViewStackServiceFixture(); // When await sut.PushModal(new NavigableViewModelMock(), "modal"); var result = await sut.ModalStack.FirstAsync(); // Then result.Should().NotBeEmpty(); result.Count.Should().Be(1); }
public async Task Should_Pop_Page() { // Given ViewStackService sut = new ViewStackServiceFixture(); await sut.PushModal(new NavigableViewModelMock()); // When await sut.PopPage(); var result = await sut.PageStack.FirstAsync(); // Then result.ShouldBeEmpty(); }
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(); }
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(); }