public async Task Should_Call_Popup_Navigation() { // Given var navigation = Substitute.For <IPopupNavigation>(); PopupViewStackService sut = new PopupViewStackServiceFixture().WithNavigation(navigation); // When await sut.PopPopup(); // Then await navigation.Received(1).PopAsync(Arg.Any <bool>()).ConfigureAwait(false); }
public async Task Should_Observe_Popped() { // Given bool pushed = false; PopupViewStackService sut = new PopupViewStackServiceFixture().WithNavigation(new PopupNavigationMock()); sut.Popped.Select(_ => true).Subscribe(x => pushed = x); // When await sut.PushPopup(new NavigableViewModelMock()); await sut.PopPopup(); // Then pushed.Should().BeTrue(); }
public async Task Should_Call_Destroy() { // Given var viewModel = Substitute.For <IEverything>(); var popup = new PopupMock { ViewModel = viewModel }; bool pushed = false; PopupViewStackService sut = new PopupViewStackServiceFixture().WithNavigation(new PopupNavigationMock()); sut.Popped.Select(_ => true).Subscribe(x => pushed = x); // When await sut.PushPopup(viewModel); await sut.PopPopup(); // Then ((IDestructible)popup.ViewModel).Received(1).Destroy(); }