Ejemplo n.º 1
0
        public void PointArrayItem()
        {
            PDFPoint pt1 = new PDFPoint(1, 1);
            PDFPoint pt2 = new PDFPoint(2, 2);
            PDFPoint pt3 = new PDFPoint(3, 3);

            PDFPointArray ary = new PDFPointArray();

            Assert.IsNotNull(ary);
            Assert.AreEqual(0, ary.Count);

            ary.Add(pt1);
            ary.Add(pt2);
            ary.Add(pt3);
            Assert.AreEqual(3, ary.Count);

            Assert.AreEqual(pt2, ary[1]);

            PDFPoint pt4 = new PDFPoint(4, 5);

            ary.Add(pt4);

            Assert.AreEqual(pt4, ary[3]);

            try
            {
                PDFPoint notvalid = ary[-1];
                throw new InvalidOperationException("No exception thrown when accessing a point out side of the bounds of the PointArray");
            }
            catch (ArgumentOutOfRangeException)
            {
                //Expected
            }

            try
            {
                PDFPoint notvalid = ary[ary.Count];
                throw new InvalidOperationException("No exception thrown when accessing a point out side of the bounds of the PointArray");
            }
            catch (ArgumentOutOfRangeException)
            {
                //Expected
            }
        }
Ejemplo n.º 2
0
        public void PointArrayAdd()
        {
            PDFPoint pt1 = new PDFPoint(1, 1);
            PDFPoint pt2 = new PDFPoint(2, 2);
            PDFPoint pt3 = new PDFPoint(3, 3);

            PDFPointArray ary = new PDFPointArray();

            Assert.IsNotNull(ary);
            Assert.AreEqual(0, ary.Count);

            ary.Add(pt1);
            ary.Add(pt2);
            ary.Add(pt3);
            Assert.AreEqual(3, ary.Count);

            PDFPoint pt4 = new PDFPoint(4, 5);

            ary.Add(pt4);
        }