Exemple #1
0
        public void Can_attack_on_first_diagonal()
        {
            var whiteQueen = QueenAttack.Create(2, 2);
            var blackQueen = QueenAttack.Create(0, 4);

            Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
        }
Exemple #2
0
        public void Can_attack_on_same_column()
        {
            var whiteQueen = QueenAttack.Create(4, 5);
            var blackQueen = QueenAttack.Create(2, 5);

            Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
        }
Exemple #3
0
        public void Can_attack_on_same_row()
        {
            var whiteQueen = QueenAttack.Create(2, 4);
            var blackQueen = QueenAttack.Create(2, 6);

            Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
        }
Exemple #4
0
        public void Can_not_attack()
        {
            var whiteQueen = QueenAttack.Create(2, 4);
            var blackQueen = QueenAttack.Create(6, 6);

            Assert.False(QueenAttack.CanAttack(whiteQueen, blackQueen));
        }
Exemple #5
0
    public void Can_attack_on_second_diagonal()
    {
        var whiteQueen = QueenAttack.Create(2, 2);
        var blackQueen = QueenAttack.Create(3, 1);

        Assert.True(QueenAttack.CanAttack(whiteQueen, blackQueen));
    }
Exemple #6
0
        public ActionResult Result()
        {
            int inputX1 = Int32.Parse(Request.Form["queen-x"]);
            int inputY1 = Int32.Parse(Request.Form["queen-y"]);

            int inputX2 = Int32.Parse(Request.Form["target-x"]);
            int inputY2 = Int32.Parse(Request.Form["target-y"]);

            QueenAttack newQueenAttack = new QueenAttack();

            bool myQueenAttack = newQueenAttack.CanAttack
                                     (inputX1, inputY1, inputX2, inputY2);

            if (myQueenAttack == false)
            {
                return(View("../QueenAttack/ResultFalse"));
            }
            else
            {
                return(View("../QueenAttack/ResultTrue"));
            }
        }
Exemple #7
0
        public void TestCanAttack()
        {
            QueenAttack testQueenAttack = new QueenAttack();

            Assert.AreEqual(true, testQueenAttack.CanAttack(2, 2, 3, 4));
        }