public async Task Should_Call_Popup_Navigation() { // Given var navigation = Substitute.For <IPopupNavigation>(); PopupViewStackService sut = new PopupViewStackServiceFixture().WithNavigation(navigation); // When await sut.RemovePopup(new NavigableViewModelMock()); // Then await navigation.Received(1).RemovePageAsync(Arg.Any <PopupPage>()).ConfigureAwait(false); }
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.RemovePopup(viewModel); // Then ((IDestructible)popup.ViewModel).Received(1).Destroy(); }