U4-9337 - fix tests

This commit is contained in:
Stephan
2017-01-04 15:36:29 +01:00
parent 13ed3303f5
commit 0e31fcf3db
3 changed files with 9 additions and 32 deletions

View File

@@ -72,23 +72,9 @@ namespace Umbraco.Tests.Routing
var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache;
if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported.");
var cachedRoutes = cache.RoutesCache.GetCachedRoutes();
Assert.AreEqual(8, cachedRoutes.Count);
foreach (var sample in samples)
{
Assert.IsTrue(cachedRoutes.ContainsKey(sample.Key));
Assert.AreEqual(sample.Value, cachedRoutes[sample.Key]);
}
var cachedIds = cache.RoutesCache.GetCachedIds();
Assert.AreEqual(8, cachedIds.Count);
foreach (var sample in samples)
{
var key = sample.Value;
Assert.IsTrue(cachedIds.ContainsKey(key));
Assert.AreEqual(sample.Key, cachedIds[key]);
}
// GetUrl does not write to cache
Assert.AreEqual(0, cachedRoutes.Count);
}
// test hideTopLevelNodeFromPath false

View File

@@ -303,18 +303,9 @@ namespace Umbraco.Tests.Routing
var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache;
if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported.");
var cachedRoutes = cache.RoutesCache.GetCachedRoutes();
Assert.AreEqual(7, cachedRoutes.Count);
var cachedIds = cache.RoutesCache.GetCachedIds();
Assert.AreEqual(7, cachedIds.Count);
CheckRoute(cachedRoutes, cachedIds, 1001, "1001/");
CheckRoute(cachedRoutes, cachedIds, 10011, "10011/");
CheckRoute(cachedRoutes, cachedIds, 100111, "10011/1001-1-1");
CheckRoute(cachedRoutes, cachedIds, 10012, "10012/");
CheckRoute(cachedRoutes, cachedIds, 100121, "10012/1001-2-1");
CheckRoute(cachedRoutes, cachedIds, 10013, "1001/1001-3");
CheckRoute(cachedRoutes, cachedIds, 1002, "/1002");
// GetUrl does not write to cache
Assert.AreEqual(0, cachedRoutes.Count);
// use the cache
Assert.AreEqual("/", routingContext.UrlProvider.GetUrl(1001, new Uri("http://domain1.com"), false));

View File

@@ -44,8 +44,8 @@ namespace Umbraco.Tests.Routing
// check that the proper route has been cached
var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache;
if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported.");
var cachedRoutes = cache.RoutesCache.GetCachedRoutes();
Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]);
//var cachedRoutes = cache.RoutesCache.GetCachedRoutes();
//Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]);
// route a rogue url
url = "http://domain1.com/1001-1/1001-1-1";
@@ -61,9 +61,9 @@ namespace Umbraco.Tests.Routing
Assert.AreEqual(100111, pcr.PublishedContent.Id);
// has the cache been polluted?
cachedRoutes = cache.RoutesCache.GetCachedRoutes();
Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); // no
//Assert.AreEqual("1001/1001-1/1001-1-1", cachedRoutes[100111]); // yes
//cachedRoutes = cache.RoutesCache.GetCachedRoutes();
//Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); // no
////Assert.AreEqual("1001/1001-1/1001-1-1", cachedRoutes[100111]); // yes
// what's the nice url now?
Assert.AreEqual("http://domain2.com/1001-1-1/", routingContext.UrlProvider.GetUrl(100111)); // good