Ejemplo n.º 1
0
        public void PathToIndex(int pIndex, bool pInclusive, int pCount)
        {
            IWeaverPath p = NewPath(5);

            IList <IWeaverPathItem> result = p.PathToIndex(pIndex, pInclusive);

            Assert.NotNull(result, "Result should be filled.");
            Assert.AreEqual(pCount, result.Count, "Incorrect Result.Count.");
            Assert.AreEqual(p.ItemAtIndex(0), result[0], "Incorrect Result[0].");

            int ri = pCount - 1;

            Assert.AreEqual(p.ItemAtIndex(ri), result[ri], "Incorrect Result[" + ri + "].");
        }
Ejemplo n.º 2
0
        public void ItemAtIndexBounds(int pIndex)
        {
            IWeaverPath p = NewPath(3);

            WeaverTestUtil.CheckThrows <WeaverPathException>(true,
                                                             () => p.ItemAtIndex(pIndex)
                                                             );
        }
Ejemplo n.º 3
0
        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.");
        }
Ejemplo n.º 4
0
        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.");
        }