public void TestCanAddRelationship() { LocatorRelationshipInfo lri = LocatorRelationshipInfo.CreateObj("label", "1", 1F, 1F, "pref label", "1", false); LocatorRelationshipInfo lri2 = LocatorRelationshipInfo.CreateObj("label", "2", 1F, 1F, "pref label", "1", false); ChildPresentationLocator cpl = new ChildPresentationLocator("href1", lri); Assert.IsFalse(cpl.CanAddRelationship(lri), "can add dup"); Assert.IsTrue(cpl.CanAddRelationship(lri2), "can't add new val"); }
public void TestAddReplaceRelationship() { LocatorRelationshipInfo lri = LocatorRelationshipInfo.CreateObj("label", "1", 1F, 1F, "pref label", "1", false); LocatorRelationshipInfo lri2 = LocatorRelationshipInfo.CreateObj("label", "2", 1F, 1F, "pref label", "1", true); TestChildPresentationLocator cpl = new TestChildPresentationLocator("href1", lri); cpl.AddRelationship(lri2); Assert.AreEqual(1, cpl.LocatorRelationshipInfos.Count, "wrong number of LRI's"); Assert.AreEqual(lri2, cpl.LocatorRelationshipInfos[0], "LRI is wrong"); }
public void CheckAppend3() { ArrayList errors = new ArrayList(); TestPresentationLocator parent = new TestPresentationLocator("label", "parent#parent"); TestPresentationLocator parentToMerge = new TestPresentationLocator("label", "parent#parent"); PresentationLocator pl1 = new PresentationLocator("child#child"); pl1.ParseHRef(errors); Assert.AreEqual(0, errors.Count); PresentationLocator pl2 = new PresentationLocator("child#child2"); pl2.ParseHRef(errors); Assert.AreEqual(0, errors.Count); PresentationLocator pl3 = new PresentationLocator("child#child"); pl3.ParseHRef(errors); Assert.AreEqual(0, errors.Count); PresentationLocator pl4 = new PresentationLocator("child#child2"); pl4.ParseHRef(errors); Assert.AreEqual(0, errors.Count); parent.AddChild(pl1, 1.0F, "pref", "1"); parent.AddChild(pl2, 2.0F, "pref", "1"); parentToMerge.AddChild(pl3, 1.0F, "pref", "1"); parentToMerge.AddChild(pl4, "label", "2", 2.0F, "pref", "1", true); parent.Append(parentToMerge); Assert.AreEqual(parent.childDisplayOrder.Count, 2, "wrong number of orders"); Assert.AreEqual(parent.childLocatorsByHRef.Count, 2, "wrong number of href's"); int count = ((ChildPresentationLocator)parent.childLocatorsByHRef[parent.childDisplayOrder[2.0F]]).LocatorRelationshipInfos.Count; LocatorRelationshipInfo lri = ((ChildPresentationLocator)parent.childLocatorsByHRef[parent.childDisplayOrder[2.0F]]).LocatorRelationshipInfos[count - 1] as LocatorRelationshipInfo; Assert.IsTrue(lri.IsProhibited); }
/// <exclude/> public TestChildPresentationLocator(string href, LocatorRelationshipInfo lri) : base(href, lri) { }