public void UnmoveLong() { var to = new Position(1, 1); var p = new Piece(); p.Move(to); p.Move(to); p.Move(to); p.Unmove(); p.Unmove(); p.Unmove(); Assert.AreEqual(0, p.PathLength); Assert.AreEqual(null, p.Pos); }
public void MoveTest() { var p = new Piece(); var pos = new Position(1, 1); p.Move(pos); Assert.AreEqual(1, p.PathLength); Assert.AreEqual(pos, p.Pos); }
public void MakeMoveIsStateChanged() { var g = new MockGame(); var from = new Position(1, 1); var to = new Position(2, 2); var p = new Piece(); var m = new ConcreteMove(from, to); g.State[from] = p; p.Move(from); g.AddMove(m); g.MakeMove(); Assert.AreEqual(p, g.State[to]); }
public void MakeMove() { var g = new MockGame(); var from = new Position(1, 1); var to = new Position(2, 2); var p = new Piece(); var m = new ConcreteMove(from, to); g.State[from] = p; p.Move(from); g.AddMove(m); bool result = g.MakeMove(); Assert.AreEqual(1, g.MovesCount); Assert.AreEqual(1, g.CurrentMove); Assert.IsTrue(result); }
public virtual void NewEmptyPiece(Position pos) { var p = new Piece {IsEmpty = true}; this[pos] = p; p.Move(pos); }