public virtual void Btn_MouseClick(object sender, MouseEventArgs e) { if (z == 1) { Button btn4 = (Button)sender; MessageBox.Show(btn4.Name); ChessFigure.btn1 = (Button)sender; Name = ChessFigure.btn1.Name; ChessFigure.i1 = ChessFigure.btn1.Name[ChessFigure.btn1.Name.Length - 2] - 48; ChessFigure.j1 = ChessFigure.btn1.Name[ChessFigure.btn1.Name.Length - 1] - 48; char[] arr = ChessFigure.btn1.Name.ToCharArray(); btn4.Name = $"{btn4.Name[ChessFigure.btn1.Name.Length - 2] - 48}{btn4.Name[ChessFigure.btn1.Name.Length - 1] - 48} "; ChessFigure.btn1.Name = ""; for (int i = 0; i < arr.Length; i++) { if (i != arr.Length - 1 && i != arr.Length - 2) { ChessFigure.btn1.Name += arr[i].ToString(); } } z++; } else { ChessFigure.btn2 = (Button)sender; MessageBox.Show(ChessFigure.btn2.Name); ChessFigure.i2 = ChessFigure.btn2.Name[0] - 48; ChessFigure.j2 = ChessFigure.btn2.Name[1] - 48; switch (ChessFigure.btn1.Name) { case "wPawn": Pawn p = new Pawn(); p.Move(); GameUpdate(); ChessFigure.btn1.Name = Name; break; } z = 1; } }
public void PawnShouldBeCorrectMove2() { ChessFigure figure = new Pawn("E4"); Assert.AreEqual(true, figure.Move("E5")); }
public void PawnShouldBeIncorrectMove() { ChessFigure figure = new Pawn("E2"); Assert.AreEqual(false, figure.Move("C5")); }
public void PawnShouldBeCorrectMove1() { var figure = new Pawn("E2"); Assert.AreEqual(true, figure.Move("E4")); }