public void AddItemToEndedPath() { IWeaverPath p = NewPath(); p.AddItem(new PathEnder()); WeaverTestUtil.CheckThrows <WeaverPathException>(true, () => p.AddItem(new Candy())); }
public void BuildParameterizedScript() { var i0 = new WeaverStepCustom("first()"); var i1 = new WeaverStepCustom("second"); var i2 = new WeaverStepCustom("[0..10]", true); var i3 = new PathEnder(); IWeaverPath p = NewPath(); p.AddItem(i0); p.AddItem(i1); p.AddItem(i2); p.AddItem(i3); const string expect = "first().second[0..10].ender"; Assert.AreEqual(expect, p.BuildParameterizedScript(), "Incorrect result."); }
public void ItemAtIndex() { var i0 = new Root(); var i1 = new Person(); var i2 = new PersonLikesCandy(); var i3 = new Candy(); IWeaverPath p = NewPath(); p.AddItem(i0); p.AddItem(i1); p.AddItem(i2); p.AddItem(i3); Assert.AreEqual(4, p.Length, "Incorrect Length."); Assert.AreEqual(i0, p.ItemAtIndex(0), "Incorrect item at index 0."); Assert.AreEqual(i1, p.ItemAtIndex(1), "Incorrect item at index 1."); Assert.AreEqual(i2, p.ItemAtIndex(2), "Incorrect item at index 2."); Assert.AreEqual(i3, p.ItemAtIndex(3), "Incorrect item at index 3."); }
public void AddItem() { IWeaverPath p = NewPath(); var candy = new Candy(); p.AddItem(candy); Assert.AreEqual(1, p.Length, "Incorrect Length."); Assert.AreEqual(candy, p.ItemAtIndex(0), "Incorrect item at index 0."); }
public void IndexOfItem() { var i0 = new Root(); var i1 = new Person(); var i2 = new PersonLikesCandy(); var i3 = new Candy(); IWeaverPath p = NewPath(); p.AddItem(i0); p.AddItem(i1); p.AddItem(i2); p.AddItem(i3); Assert.AreEqual(4, p.Length, "Incorrect Path.Length."); Assert.AreEqual(0, p.IndexOfItem(i0), "Incorrect item index at 0."); Assert.AreEqual(1, p.IndexOfItem(i1), "Incorrect item index at 1."); Assert.AreEqual(2, p.IndexOfItem(i2), "Incorrect item index at 2."); Assert.AreEqual(3, p.IndexOfItem(i3), "Incorrect item index at 3."); }