public void TestTransform() { GameObject GameObject = new GameObject(); GameObject.whites = new List<Figure>(); GameObject.blacks = new List<Figure>(); King wKing = new King(GameObject, 1, 5, Color.white); King bKing = new King(GameObject, 8, 4, Color.black); Pawn wPawn1 = new Pawn(GameObject, 1, 7, Color.white); GameObject.blacks.Add(bKing); GameObject.whites.Add(wKing); GameObject.whites.Add(wPawn1); GameObject.UpdateAllBeatFields(); Assert.IsFalse(wPawn1.Transform(FigureTypes.Knight)); Assert.IsTrue(wPawn1.Move(1, 8)); Assert.IsFalse(wPawn1.Transform(FigureTypes.Pawn)); Assert.IsFalse(wPawn1.Transform(FigureTypes.King)); Assert.IsTrue(wPawn1.Transform(FigureTypes.Knight)); Figure newFigure = GameObject.GetFigureByXY(wPawn1.field.x, wPawn1.field.y); Assert.IsTrue(newFigure.type == FigureTypes.Knight); Assert.IsTrue(newFigure.field.x == 1); Assert.IsTrue(newFigure.field.y == 8); Assert.IsTrue(newFigure.MoveFields.Count == 2); Assert.IsTrue(newFigure.CanMoveToPosition(2, 6)); Assert.IsTrue(newFigure.CanMoveToPosition(3, 7)); }