public void TestMoverIsMovingATileWhichCanBeMovedByRightAllRowRowColMover() { var mover = new RowColMover(); TileFactory tileFactory = new NumberTileFactory(); FrameBuilder frameBuilder = new ClassicPatternFrameBuilder(tileFactory); var frameDirector = new FrameDirector(frameBuilder); var initialFrame = frameDirector.ConstructFrame(4, 4); var actualFrame = initialFrame.Clone(); bool moveLeft = mover.Move("13", actualFrame); bool moveRight = mover.Move("14", actualFrame); Assert.IsTrue(moveRight, "Mover method should return true when the tile can be moved"); Assert.AreNotEqual(initialFrame, actualFrame, "The frame should be changed when the mover moves the tile"); }
public void TestMoverTryMovingANullTileAndTileNotBeMovedRowColMover() { var mover = new RowColMover(); TileFactory tileFactory = new NumberTileFactory(); FrameBuilder frameBuilder = new ClassicPatternFrameBuilder(tileFactory); var frameDirector = new FrameDirector(frameBuilder); var initialFrame = frameDirector.ConstructFrame(4, 4); var actualFrame = initialFrame.Clone(); bool result = mover.Move(null, actualFrame); Assert.IsFalse(result, "Mover method should return false when the tile can not be moved"); Assert.AreEqual(initialFrame, actualFrame, "The frame should not be changed"); }
public void TestMoverNotMovingATileWhenInFrameHaveNotNullTileRowColMover() { var mover = new RowColMover(); IFrame initialFrame = new Frame(new ITile[,] { { new NumberTile(1) } }); var actualFrame = initialFrame.Clone(); bool moveDown = mover.Move("1", actualFrame); Assert.IsFalse(moveDown, "Mover method should return false when the tile can not be moved"); Assert.AreEqual(initialFrame, actualFrame, "The frame should not be changed"); }