public void TestInitializeNewGame_ScoreIsUpdated() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); engine.MoveAtDirection(Direction.Down, engine.MoveDown); engine.InitializeNewGame(); int expected = 0; int actual = engine.Score; Assert.AreEqual(expected, actual); }
public void TestMoveAtDirection_MoveAtUp() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); engine.MoveAtDirection(Direction.Up, engine.MoveUp); Position expected = new Position(2, 3); Position actual = playfield.PlayerPosition; Assert.AreEqual(expected.Row, actual.Row); Assert.AreEqual(expected.Col, actual.Col); }
private static void AssignEvents(GameEngine engine, ConsoleInput movement) { movement.OnWriteL += (sender, eventInfo) => engine.MoveAtDirection(Direction.Left, engine.MoveLeft); movement.OnWriteR += (sender, eventInfo) => engine.MoveAtDirection(Direction.Right, engine.MoveRight); movement.OnWriteU += (sender, eventInfo) => engine.MoveAtDirection(Direction.Up, engine.MoveUp); movement.OnWriteD += (sender, eventInfo) => engine.MoveAtDirection(Direction.Down, engine.MoveDown); movement.OnWriteTop += (sender, eventInfo) => engine.ShowTopResults(); movement.OnWriteRestart += (sender, eventInfo) => engine.InitializeNewGame(); movement.OnWriteExit += (sender, eventInfo) => engine.QuitGame(); //Assert.AreSame(movement.OnWriteL == movement.OnWriteL); }
public void TestMoveAtDirection_ScoreIsUpdatedOnMoveUp() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); engine.MoveAtDirection(Direction.Up, engine.MoveUp); int expected = 1; int actual = engine.Score; Assert.AreEqual(expected, actual); }