Adds a few more test cases
This commit is contained in:
@@ -600,31 +600,39 @@ namespace Umbraco.Tests.PublishedContent
|
||||
// -- Home: 1173 (parent 1046)
|
||||
// -- Custom Doc: 1178 (parent 1173)
|
||||
// --- Custom Doc2: 1179 (parent: 1178)
|
||||
// - Custom Doc3: 1172 (no parent)
|
||||
|
||||
var home = GetNode(1173);
|
||||
var root = GetNode(1046);
|
||||
var customDoc = GetNode(1178);
|
||||
var customDoc2 = GetNode(1179);
|
||||
var customDoc3 = GetNode(1172);
|
||||
|
||||
Assert.IsFalse(root.IsAncestor(customDoc3));
|
||||
Assert.IsTrue(root.IsAncestor(customDoc2));
|
||||
Assert.IsTrue(root.IsAncestor(customDoc));
|
||||
Assert.IsTrue(root.IsAncestor(home));
|
||||
Assert.IsFalse(root.IsAncestor(root));
|
||||
|
||||
Assert.IsFalse(home.IsAncestor(customDoc3));
|
||||
Assert.IsTrue(home.IsAncestor(customDoc2));
|
||||
Assert.IsTrue(home.IsAncestor(customDoc));
|
||||
Assert.IsFalse(home.IsAncestor(home));
|
||||
Assert.IsFalse(home.IsAncestor(root));
|
||||
|
||||
Assert.IsFalse(customDoc.IsAncestor(customDoc3));
|
||||
Assert.IsTrue(customDoc.IsAncestor(customDoc2));
|
||||
Assert.IsFalse(customDoc.IsAncestor(customDoc));
|
||||
Assert.IsFalse(customDoc.IsAncestor(home));
|
||||
Assert.IsFalse(customDoc.IsAncestor(root));
|
||||
|
||||
Assert.IsFalse(customDoc2.IsAncestor(customDoc3));
|
||||
Assert.IsFalse(customDoc2.IsAncestor(customDoc2));
|
||||
Assert.IsFalse(customDoc2.IsAncestor(customDoc));
|
||||
Assert.IsFalse(customDoc2.IsAncestor(home));
|
||||
Assert.IsFalse(customDoc2.IsAncestor(root));
|
||||
|
||||
Assert.IsFalse(customDoc3.IsAncestor(customDoc3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -635,31 +643,39 @@ namespace Umbraco.Tests.PublishedContent
|
||||
// -- Home: 1173 (parent 1046)
|
||||
// -- Custom Doc: 1178 (parent 1173)
|
||||
// --- Custom Doc2: 1179 (parent: 1178)
|
||||
// - Custom Doc3: 1172 (no parent)
|
||||
|
||||
var home = GetNode(1173);
|
||||
var root = GetNode(1046);
|
||||
var customDoc = GetNode(1178);
|
||||
var customDoc2 = GetNode(1179);
|
||||
var customDoc3 = GetNode(1172);
|
||||
|
||||
Assert.IsFalse(root.IsAncestorOrSelf(customDoc3));
|
||||
Assert.IsTrue(root.IsAncestorOrSelf(customDoc2));
|
||||
Assert.IsTrue(root.IsAncestorOrSelf(customDoc));
|
||||
Assert.IsTrue(root.IsAncestorOrSelf(home));
|
||||
Assert.IsTrue(root.IsAncestorOrSelf(root));
|
||||
|
||||
Assert.IsFalse(home.IsAncestorOrSelf(customDoc3));
|
||||
Assert.IsTrue(home.IsAncestorOrSelf(customDoc2));
|
||||
Assert.IsTrue(home.IsAncestorOrSelf(customDoc));
|
||||
Assert.IsTrue(home.IsAncestorOrSelf(home));
|
||||
Assert.IsFalse(home.IsAncestorOrSelf(root));
|
||||
|
||||
Assert.IsFalse(customDoc.IsAncestorOrSelf(customDoc3));
|
||||
Assert.IsTrue(customDoc.IsAncestorOrSelf(customDoc2));
|
||||
Assert.IsTrue(customDoc.IsAncestorOrSelf(customDoc));
|
||||
Assert.IsFalse(customDoc.IsAncestorOrSelf(home));
|
||||
Assert.IsFalse(customDoc.IsAncestorOrSelf(root));
|
||||
|
||||
Assert.IsFalse(customDoc2.IsAncestorOrSelf(customDoc3));
|
||||
Assert.IsTrue(customDoc2.IsAncestorOrSelf(customDoc2));
|
||||
Assert.IsFalse(customDoc2.IsAncestorOrSelf(customDoc));
|
||||
Assert.IsFalse(customDoc2.IsAncestorOrSelf(home));
|
||||
Assert.IsFalse(customDoc2.IsAncestorOrSelf(root));
|
||||
|
||||
Assert.IsTrue(customDoc3.IsAncestorOrSelf(customDoc3));
|
||||
}
|
||||
|
||||
|
||||
@@ -697,31 +713,39 @@ namespace Umbraco.Tests.PublishedContent
|
||||
// -- Home: 1173 (parent 1046)
|
||||
// -- Custom Doc: 1178 (parent 1173)
|
||||
// --- Custom Doc2: 1179 (parent: 1178)
|
||||
|
||||
// - Custom Doc3: 1172 (no parent)
|
||||
|
||||
var home = GetNode(1173);
|
||||
var root = GetNode(1046);
|
||||
var customDoc = GetNode(1178);
|
||||
var customDoc2 = GetNode(1179);
|
||||
var customDoc3 = GetNode(1172);
|
||||
|
||||
Assert.IsFalse(root.IsDescendant(root));
|
||||
Assert.IsFalse(root.IsDescendant(home));
|
||||
Assert.IsFalse(root.IsDescendant(customDoc));
|
||||
Assert.IsFalse(root.IsDescendant(customDoc2));
|
||||
Assert.IsFalse(root.IsDescendant(customDoc3));
|
||||
|
||||
Assert.IsTrue(home.IsDescendant(root));
|
||||
Assert.IsFalse(home.IsDescendant(home));
|
||||
Assert.IsFalse(home.IsDescendant(customDoc));
|
||||
Assert.IsFalse(home.IsDescendant(customDoc2));
|
||||
Assert.IsFalse(home.IsDescendant(customDoc3));
|
||||
|
||||
Assert.IsTrue(customDoc.IsDescendant(root));
|
||||
Assert.IsTrue(customDoc.IsDescendant(home));
|
||||
Assert.IsFalse(customDoc.IsDescendant(customDoc));
|
||||
Assert.IsFalse(customDoc.IsDescendant(customDoc2));
|
||||
Assert.IsFalse(customDoc.IsDescendant(customDoc3));
|
||||
|
||||
Assert.IsTrue(customDoc2.IsDescendant(root));
|
||||
Assert.IsTrue(customDoc2.IsDescendant(home));
|
||||
Assert.IsTrue(customDoc2.IsDescendant(customDoc));
|
||||
Assert.IsFalse(customDoc2.IsDescendant(customDoc2));
|
||||
Assert.IsFalse(customDoc2.IsDescendant(customDoc3));
|
||||
|
||||
Assert.IsFalse(customDoc3.IsDescendant(customDoc3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -732,31 +756,39 @@ namespace Umbraco.Tests.PublishedContent
|
||||
// -- Home: 1173 (parent 1046)
|
||||
// -- Custom Doc: 1178 (parent 1173)
|
||||
// --- Custom Doc2: 1179 (parent: 1178)
|
||||
|
||||
// - Custom Doc3: 1172 (no parent)
|
||||
|
||||
var home = GetNode(1173);
|
||||
var root = GetNode(1046);
|
||||
var customDoc = GetNode(1178);
|
||||
var customDoc2 = GetNode(1179);
|
||||
var customDoc3 = GetNode(1172);
|
||||
|
||||
Assert.IsTrue(root.IsDescendantOrSelf(root));
|
||||
Assert.IsFalse(root.IsDescendantOrSelf(home));
|
||||
Assert.IsFalse(root.IsDescendantOrSelf(customDoc));
|
||||
Assert.IsFalse(root.IsDescendantOrSelf(customDoc2));
|
||||
Assert.IsFalse(root.IsDescendantOrSelf(customDoc3));
|
||||
|
||||
Assert.IsTrue(home.IsDescendantOrSelf(root));
|
||||
Assert.IsTrue(home.IsDescendantOrSelf(home));
|
||||
Assert.IsFalse(home.IsDescendantOrSelf(customDoc));
|
||||
Assert.IsFalse(home.IsDescendantOrSelf(customDoc2));
|
||||
Assert.IsFalse(home.IsDescendantOrSelf(customDoc3));
|
||||
|
||||
Assert.IsTrue(customDoc.IsDescendantOrSelf(root));
|
||||
Assert.IsTrue(customDoc.IsDescendantOrSelf(home));
|
||||
Assert.IsTrue(customDoc.IsDescendantOrSelf(customDoc));
|
||||
Assert.IsFalse(customDoc.IsDescendantOrSelf(customDoc2));
|
||||
Assert.IsFalse(customDoc.IsDescendantOrSelf(customDoc3));
|
||||
|
||||
Assert.IsTrue(customDoc2.IsDescendantOrSelf(root));
|
||||
Assert.IsTrue(customDoc2.IsDescendantOrSelf(home));
|
||||
Assert.IsTrue(customDoc2.IsDescendantOrSelf(customDoc));
|
||||
Assert.IsTrue(customDoc2.IsDescendantOrSelf(customDoc2));
|
||||
Assert.IsFalse(customDoc2.IsDescendantOrSelf(customDoc3));
|
||||
|
||||
Assert.IsTrue(customDoc3.IsDescendantOrSelf(customDoc3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user