Exemplo n.º 1
0
        public void TestRightReflect()
        {
            Ball ball = new BasketBall(0, 20, new Point(513, 0));

            Assert.IsFalse(ball.collision(), "이동 전");
            ball.move();
            Assert.IsTrue(ball.collision(), "충돌 전");
            ball.move();
            Assert.IsFalse(ball.collision(), "충돌 후");

            ball = new BasketBall(Math.PI / 4, 20, new Point(513, 150));
            Assert.IsFalse(ball.collision(), "이동 전2");
            ball.move();
            Assert.IsTrue(ball.collision(), "충돌 전2");
            ball.move();
            Assert.IsFalse(ball.collision(), "충돌 후2");

            ball = new BasketBall(Math.PI * 7 / 4, 20, new Point(513, 150));
            Assert.IsFalse(ball.collision(), "이동 전3");
            ball.move();
            Assert.IsTrue(ball.collision(), "충돌 전3");
            ball.move();
            Assert.IsFalse(ball.collision(), "충돌 후3");
        }
Exemplo n.º 2
0
        public void TestLeftReflect()
        {
            Ball ball = new BasketBall(Math.PI, 20, new Point(30, 0));

            Assert.IsFalse(ball.collision(), "이동 전");
            ball.move();
            Assert.IsTrue(ball.collision(), "충돌 전");
            ball.move();
            Assert.IsFalse(ball.collision(), "충돌 후");

            ball = new BasketBall(Math.PI * 3 / 4, 40, new Point(30, 150));
            Assert.IsFalse(ball.collision(), "이동 전2");
            ball.move();
            Assert.IsTrue(ball.collision(), "충돌 전2");
            ball.move();
            Assert.IsFalse(ball.collision(), "충돌 후2");

            ball = new BasketBall(Math.PI * 5 / 4, 40, new Point(30, 150));
            Assert.IsFalse(ball.collision(), "이동 전3");
            ball.move();
            Assert.IsTrue(ball.collision(), "충돌 전3");
            ball.move();
            Assert.IsFalse(ball.collision(), "충돌 후3");
        }