示例#1
0
            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);
            }
示例#2
0
            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);
            }
示例#3
0
            public void ThrowsArgumentNullExceptionForNullResolvedType()
            {
                var viewLocator = new ViewLocator();

                ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => viewLocator.Register(typeof(NoNamingConventionViewModel), null));
            }
示例#4
0
            public void ThrowsArgumentNullExceptionForNullTypeToResolve()
            {
                var viewLocator = new ViewLocator();

                ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => viewLocator.Register(null, typeof(FollowingNoNamingConventionView)));
            }
示例#5
0
 private void App_OnStartup(object sender, StartupEventArgs e)
 {
     ViewLocator.Register <MainWindowViewModel, MainWindow>();
     new KamishibaiBootstrapper().Run(this);
 }