示例#1
0
 public HomeModule()
 {
     Get["/"] = _ => {
     return View["index.cshtml"];
       };
       Post["/"] = _ => {
     var newQueen = new Queen(Request.Form["x1"], Request.Form["y1"]);
     return View["index.cshtml",newQueen.CanAttack(Request.Form["x2"],Request.Form["y2"])];
       };
 }
示例#2
0
 public void TestIfQueenCanAttackDiag()
 {
     //Arrange
       int userOneX = 3;
       int userOneY = 2;
       //Act
       var newQueen = new Queen(userOneX, userOneY);
       //Assert
       Assert.Equal(true, newQueen.CanAttack(6, 5));
 }
示例#3
0
 public void TestIfQueenCanAttackRows()
 {
     //Arrange
       int userOneX = 3;
       int userOneY = 6;
       //Act
       var newQueen = new Queen(userOneX, userOneY);
       //Assert
       Assert.Equal(true, newQueen.CanAttack(4, 6));
 }
 public void Queen_ForVertical_true()
 {
     Queen queen = new Queen(2, 4);
       Assert.Equal(true, queen.CanAttack(3, 4));
 }
 public void Queen_ForVertical_false()
 {
     Queen queen = new Queen(3, 2);
       Assert.Equal(false, queen.CanAttack(2, 4));
 }
 public void Queen_ForHorizontal_true()
 {
     Queen queen = new Queen(2, 2);
       Assert.Equal(true, queen.CanAttack(2, 4));
 }
 public void Queen_ForDiagonal_true()
 {
     Queen queen = new Queen(5, 5);
       Assert.Equal(true, queen.CanAttack(6, 6));
 }
 public void Queen_ForDiagonal_false()
 {
     Queen queen = new Queen(5, 5);
       Assert.Equal(false, queen.CanAttack(3, 8));
 }
示例#9
0
 public void Attack_QueenAttacksVertically_true()
 {
     Queen testCoordinates = new Queen() {};
       Assert.Equal(true, testCoordinates.IsAttack(1,5,1,4));
 }
示例#10
0
 public void Attack_QueenAttacksHorizontally_true()
 {
     Queen testCoordinates = new Queen() {};
       Assert.Equal(true, testCoordinates.IsAttack(5, 1, 4, 1));
 }
示例#11
0
 public void Attack_QueenAttacksDiagonally_true()
 {
     Queen testCoordinates = new Queen() {};
       Assert.Equal(true, testCoordinates.IsAttack(4, 1 , 4, 2));
 }
示例#12
0
        public void Queen_ForHorizontal_true()
        {
            Queen queen = new Queen(2, 2);

            Assert.Equal(true, queen.CanAttack(2, 4));
        }
示例#13
0
        public void Queen_ForDiagonal_false()
        {
            Queen queen = new Queen(5, 5);

            Assert.Equal(false, queen.CanAttack(3, 8));
        }
示例#14
0
        public void Queen_ForDiagonal_true()
        {
            Queen queen = new Queen(5, 5);

            Assert.Equal(true, queen.CanAttack(6, 6));
        }
示例#15
0
        public void Queen_ForVertical_false()
        {
            Queen queen = new Queen(3, 2);

            Assert.Equal(false, queen.CanAttack(2, 4));
        }
示例#16
0
        public void Queen_ForVertical_true()
        {
            Queen queen = new Queen(2, 4);

            Assert.Equal(true, queen.CanAttack(3, 4));
        }