예제 #1
0
        public void GetCenter()
        {
            Rect  rec    = new Rect(new Point(), new Point(3, 5));
            Point center = rec.getCenter();

            //Correct center?
            Assert.AreEqual(center.getX(), 1.5);
            Assert.AreEqual(center.getY(), 2.5);
        }
예제 #2
0
        public void GetUpperLeftVertex()
        {
            //p1 will be upperLeft
            Point p1  = new Point(0, 10);
            Point p2  = new Point(5, 5);
            Rect  rec = new Rect(p1, p2);

            //Is p1 same as upperLeft?
            Assert.AreEqual(rec.getUpperLeftVertex().getX(), p1.getX());
            Assert.AreEqual(rec.getUpperLeftVertex().getY(), p1.getY());
        }