コード例 #1
0
ファイル: UrlLocatorTest.cs プロジェクト: ziez/Catel
            public void ClearsTheCache()
            {
                var urlLocator  = new UrlLocator();
                var resolvedUrl = urlLocator.ResolveUrl(typeof(PersonViewModel), false);

                Assert.IsNotNull(resolvedUrl);
                Assert.AreEqual("/Views/Person.xaml", resolvedUrl);

                // Clear the naming conventions (so it *must* come from the cache)
                urlLocator.NamingConventions.Clear();

                resolvedUrl = urlLocator.ResolveUrl(typeof(PersonViewModel), false);

                Assert.IsNotNull(resolvedUrl);
                Assert.AreEqual("/Views/Person.xaml", resolvedUrl);

                // Clear the cache, now it should break
                urlLocator.ClearCache();

                resolvedUrl = urlLocator.ResolveUrl(typeof(PersonViewModel), false);

                Assert.IsNull(resolvedUrl);
            }
コード例 #2
0
ファイル: UrlLocatorFacts.cs プロジェクト: xaecors/Catel
            public void ThrowsArgumentNullExceptionForNullViewType()
            {
                var urlLocator = new UrlLocator();

                ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => urlLocator.ResolveUrl(null));
            }