Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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]);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 public virtual void NewEmptyPiece(Position pos)
 {
     var p = new Piece {IsEmpty = true};
     this[pos] = p;
     p.Move(pos);
 }