public async Task Test_NavigateBackWhileAction_Causes_Rotuer_To_Navigate_Backwards_While_The_Func_Is_True() { Resolver.Register(() => new TestViewModel(), typeof(TestViewModel)); var navigator = new Navigator(); Router = new Router(navigator); var initParams = new RouterConfig() { ViewModelMap = new Dictionary <Type, RouteActions>() { { typeof(TestViewModel), new RouteActions() { Actions = new[] { RouteActions.NavigateBackWhile(transition => transition.ViewModel is TestViewModel), RouteActions.Navigate() } } } } }; await Router.InitAsync(initParams); await Router.ShowAsync <TestViewModel, TestParams>(); await Router.ShowAsync <TestViewModel, TestParams>(); Assert.Collection(navigator.TransitionStack, t => t.ViewModel.Should().BeAssignableTo <TestViewModel>()); }
public IRouteBuilder NavigateBackWhile(Func <Transition, bool> goBackWhile) { if (goBackWhile == null) { throw new ArgumentNullException(nameof(goBackWhile)); } actions.Add(RouteActions.NavigateBackWhile(goBackWhile)); return(this); }