예제 #1
0
        public void InsertShape()
        {
            var rectangleFrame = new Rect(200, 200, 200, 150);
            var ellipseFrame   = new Rect(450, 100, 100, 100);
            var triangleFrame  = new Rect(100, 100, 250, 100);

            var rectangle = new Rectangle(rectangleFrame, null, null);
            var ellipse   = new Elipse(ellipseFrame, null, null);
            var triangle  = new Triangle(triangleFrame, null, null);
            var group     = new GroupShape();

            group.InsertShape(rectangle, 0);
            Assert.AreEqual(1, group.GetShapesCount());
            Assert.ThrowsException <IndexOutOfRangeException>(() => group.InsertShape(triangle, -1));
            Assert.ThrowsException <IndexOutOfRangeException>(() => group.InsertShape(ellipse, 2));
            group.InsertShape(ellipse, 1);
            Assert.AreEqual(2, group.GetShapesCount());
        }