public GameTests() { _gameSettings = new TestGameSettings(); var gameClock = new TestGameClock(); _game = new Game(gameClock, _gameSettings); }
public GhostTests() { _gameSettings = new TestGameSettings { PowerPills = { new CellLocation(50, 50) } }; _gameClock = new TestGameClock(); }
public FruitTests() { _now = DateTime.UtcNow; _gameSettings = new TestGameSettings(); _gameClock = new TestGameClock(); }
public async Task EatingFruitOnEveryLevel(int levelNumber, int scoreIncrement) { var now = DateTime.UtcNow; var gameClock = new TestGameClock(); _gameSettings.Coins.Add(_gameSettings.PacMan.Location.Left); _gameSettings.Coins.Add(_gameSettings.PacMan.Location.Left.Left); _gameSettings.Fruit = _gameSettings.PacMan.Location.Left.Above; _gameSettings.FruitAppearsAfterCoinsEaten.Add(1); var game = new Game(gameClock, _gameSettings); game.StartGame(); for (var level = 0; level < levelNumber - 1; level++) { await game.ChangeDirection(Direction.Left); await gameClock.Tick(now); //Fruit appears await gameClock.Tick(now); //Level completed if (game.Status != GameStatus.ChangingLevel) { throw new Exception($"Game status should be GameStatus.ChangingLevel not {game.Status}"); } WeExpectThat(game.PacMan).IsAt(_gameSettings.PacMan.Location.Left.Left); await gameClock.Tick(now.AddSeconds(7)); //Screen flashes WeExpectThat(game.PacMan).IsAt(_gameSettings.PacMan.Location); } await game.ChangeDirection(Direction.Left); await gameClock.Tick(now.AddSeconds(7)); // Eat coin, fruit appears WeExpectThat(game.PacMan).IsAt(_gameSettings.PacMan.Location.Left); await game.ChangeDirection(Direction.Up); var score = game.Score; await gameClock.Tick(); // Eat coin, fruit appears game.Should().BeEquivalentTo(new { Level = levelNumber, Score = score + scoreIncrement }); }
public async Task GameContainsAllCoins() { var gameBoard = new TestGameSettings(); gameBoard.Coins.Add((1, 1)); gameBoard.Coins.Add((1, 2)); gameBoard.Coins.Add((2, 2)); var gameClock = new TestGameClock(); var game = new Game(gameClock, gameBoard); game.StartGame(); await gameClock.Tick(); game.Coins.Should().BeEquivalentTo( new CellLocation(1, 1), new CellLocation(1, 2), new CellLocation(2, 2) ); }
public PacManTests() { _gameSettings = new TestGameSettings(); _gameClock = new TestGameClock(); }
public CoinTests() { _gameSettings = new TestGameSettings(); _gameClock = new TestGameClock(); }
public PowerPillTests() { _gameSettings = new TestGameSettings(); _gameClock = new TestGameClock(); }
public LivesTests() { _gameSettings = new TestGameSettings(); _gameClock = new TestGameClock(); }
public GhostTests() { _gameSettings = new TestGameSettings(); _gameClock = new TestGameClock(); }
public BonusLivesTests() { _now = DateTime.UtcNow; _gameClock = new TestGameClock(); _numberOfNotificationsTriggered = 0; }