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); }
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); }
public void ThrowsArgumentNullExceptionForNullResolvedType() { var urlLocator = new UrlLocator(); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => urlLocator.Register(typeof(NoNamingConventionViewModel), null)); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => urlLocator.Register(typeof(NoNamingConventionViewModel), string.Empty)); }
public void ThrowsArgumentNullExceptionForNullTypeToResolve() { var urlLocator = new UrlLocator(); ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => urlLocator.Register(null, "/Views/PersonView.xaml")); }