public void CanResolveViewFromViewModelWithIRoutableViewModelType() { var resolver = new ModernDependencyResolver(); resolver.InitializeSplat(); resolver.InitializeReactiveUI(); resolver.Register(() => new RoutableFooView(), typeof(IViewFor <IRoutableFooViewModel>)); using (resolver.WithResolver()) { var fixture = new DefaultViewLocator(); var vm = new RoutableFooViewModel(); var result = fixture.ResolveView <IRoutableViewModel>(vm); Assert.IsType <RoutableFooView>(result); } }
public void CanOverrideNameResolutionFunc() { var resolver = new ModernDependencyResolver(); resolver.InitializeSplat(); resolver.InitializeReactiveUI(); resolver.Register(() => new RoutableFooCustomView()); using (resolver.WithResolver()) { var fixture = new DefaultViewLocator(); fixture.ViewModelToViewFunc = x => x.Replace("ViewModel", "CustomView"); var vm = new RoutableFooViewModel(); var result = fixture.ResolveView <IRoutableViewModel>(vm); Assert.IsType <RoutableFooCustomView>(result); } }