Example #1
0
        public void CantGetShapeIfIndexMoreOrEqualThanShapesCount()
        {
            var draft = new PictureDraft();

            Assert.ThrowsException <ArgumentOutOfRangeException>(() => draft.GetShapeByIndex(0));
            var testShape = new TestShape();

            Assert.AreEqual(draft.ShapeCount, 0);
            draft.AddShape(testShape);
            Assert.AreEqual(draft.ShapeCount, 1);
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => draft.GetShapeByIndex(1));
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => draft.GetShapeByIndex(2));
        }
Example #2
0
        public void CanGetShapeByIndex()
        {
            var draft     = new PictureDraft();
            var testShape = new TestShape();

            Assert.AreEqual(draft.ShapeCount, 0);
            draft.AddShape(testShape);
            Assert.AreEqual(draft.ShapeCount, 1);
            Assert.AreEqual(draft.GetShapeByIndex(0), testShape);
        }