Exemple #1
0
            public void OverwritesExistingViewType()
            {
                var urlLocator = new UrlLocator();
                urlLocator.Register(typeof(NoNamingConventionViewModel2), "/Views/NoNaming1.xaml");
                urlLocator.Register(typeof(NoNamingConventionViewModel2), "/App.xaml");

                var resolvedUri = urlLocator.ResolveUrl(typeof(NoNamingConventionViewModel2), false);
                Assert.AreEqual("/App.xaml", resolvedUri);
            }
Exemple #2
0
            public void RegistersNonExistingViewType()
            {
                var urlLocator = new UrlLocator();

                Assert.IsNull(urlLocator.ResolveUrl(typeof(FollowingNoNamingConventionView)));

                urlLocator.Register(typeof(NoNamingConventionViewModel), "/App.xaml");

                var resolvedUri = urlLocator.ResolveUrl(typeof(NoNamingConventionViewModel));
                Assert.AreEqual("/App.xaml", resolvedUri);
            }
Exemple #3
0
 public void ThrowsArgumentNullExceptionForNullResolvedType()
 {
     var urlLocator = new UrlLocator();
     ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => urlLocator.Register(typeof(NoNamingConventionViewModel), null));
     ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => urlLocator.Register(typeof(NoNamingConventionViewModel), string.Empty));
 }
Exemple #4
0
 public void ThrowsArgumentNullExceptionForNullTypeToResolve()
 {
     var urlLocator = new UrlLocator();
     ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => urlLocator.Register(null, "/Views/PersonView.xaml"));
 }