public async Task Should_Observe_Pushed() { // Given PopupNavigationEvent pushing = null; var viewModel = new NavigableViewModelMock(); var popup = new PopupMock { ViewModel = viewModel }; var navigation = Substitute.For <IPopupNavigation>(); var viewLocator = Substitute.For <IViewLocator>(); viewLocator.ResolveView(Arg.Any <IViewModel>()).Returns(popup); PopupViewStackService sut = new PopupViewStackServiceFixture().WithNavigation(navigation).WithViewLocator(viewLocator); sut.Pushed.Subscribe(x => pushing = x); // When await sut.PushPopup(viewModel); navigation.Pushed += Raise.EventWith(new PopupNavigationEventArgs(popup, true)); // Then pushing.ViewModel.Should().Be(viewModel); }
public void Should_Observe_Pushing() { // Given PopupNavigationEvent pushing = null; var viewModel = new NavigableViewModelMock(); var popup = new PopupMock { ViewModel = viewModel }; var navigation = Substitute.For <IPopupNavigation>(); PopupViewStackService sut = new PopupViewStackServiceFixture().WithNavigation(navigation); sut.Pushing.Subscribe(x => pushing = x); // When navigation.Pushing += Raise.EventWith(new PopupNavigationEventArgs(popup, true)); // Then pushing.ViewModel.Should().Be(viewModel); }
public void Should_Call_Destroy() { // Given PopupNavigationEvent pushing = null; var viewModel = Substitute.For <IEverything>(); var popup = new PopupMock { ViewModel = viewModel }; var navigation = Substitute.For <IPopupNavigation>(); PopupViewStackService sut = new PopupViewStackServiceFixture().WithNavigation(navigation); sut.Popped.Subscribe(x => pushing = x); // When navigation.Popped += Raise.EventWith(new PopupNavigationEventArgs(popup, true)); // Then ((IDestructible)popup.ViewModel).Received(1).Destroy(); }