public void OverwritesExistingViewType() { var viewLocator = new ViewLocator(); viewLocator.Register(typeof(FollowingNoNamingConventionView), typeof(NoNamingConventionViewModel)); viewLocator.Register(typeof(FollowingNoNamingConventionView), typeof(NoNamingConventionViewModel2)); var resolvedView = viewLocator.ResolveView(typeof(FollowingNoNamingConventionView)); Assert.AreEqual(typeof(NoNamingConventionViewModel2), resolvedView); }
public void ReturnsCompatibleValues(Type viewType, bool expectedValue) { var viewLocator = new ViewLocator(); viewLocator.Register(typeof(MyNameViewerViewModel), typeof(MyNameViewer)); viewLocator.Register(typeof(MyNameViewerViewModel), typeof(MyNameViewer2)); var isCompatible = viewLocator.IsCompatible(typeof(MyNameViewerViewModel), viewType); Assert.AreEqual(expectedValue, isCompatible); }
public void ThrowsArgumentNullExceptionForNullResolvedType() { var viewLocator = new ViewLocator(); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => viewLocator.Register(typeof(NoNamingConventionViewModel), null)); }
public void ThrowsArgumentNullExceptionForNullTypeToResolve() { var viewLocator = new ViewLocator(); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => viewLocator.Register(null, typeof(FollowingNoNamingConventionView))); }
private void App_OnStartup(object sender, StartupEventArgs e) { ViewLocator.Register <MainWindowViewModel, MainWindow>(); new KamishibaiBootstrapper().Run(this); }