public void StartNewGame_ValidGameSettings_GameCreated() { // arrange StartGameCommand testStartCommand = new StartGameCommand(_gameCreatorMock.Object, _manipulatorMock.Object, _defaultSettings); // act testStartCommand.Execute(); // assert _gameCreatorMock.Verify(c => c.CreateGame(_defaultSettings, _manipulatorMock.Object), Times.Once()); }
public void StartGameCommandTest() { createContext(); ICommand startGameCommand = new StartGameCommand(_context, EState.DECIDING, true); startGameCommand.Execute(); Assert.IsNotNull(_context.Robot); Assert.IsTrue(_context.State is DecidingState); }
public void StartGameWithTwoCounterKing() { var game = new Game { State = new LobbyState(), Players = { new Player { User = new User { Id = 1 }, IsOwner = true, Deck = new Deck { BattleKingCard = new DeckCard { Card = new Card { Effect = GwintEffect.CounterKing } } } }, new Player { User = new User { Id = 2 }, Deck = new Deck { BattleKingCard = new DeckCard { Card = new Card { Effect = GwintEffect.CounterKing } } } } } }; var command = new StartGameCommand { SenderUserId = 1 }; command.Execute(game); Assert.True(game.Players.All(p => !p.CanUseBattleKingCard)); }
public void PlayerStartingPositionsAreLogged() { var player1 = new Player("Player 1"); var player2 = new Player("Player 2"); var game = Game.CreateNewGame(10, 10, player1, player2); var log = new JsonMessageLog(); var command = new StartGameCommand(); command.Execute(game, log); log.AssertMessageTypes(GameMessageType.NewGame, GameMessageType.PlayerAdded, GameMessageType.PlayerAdded); }
public void StartGame() { var game = new Game { State = new LobbyState(), Players = { new Player { User = new User { Id = 1 }, IsOwner = true, Deck = new Deck { BattleKingCard = new DeckCard { Card = new Card() } } }, new Player { User = new User { Id = 2 }, Deck = new Deck { BattleKingCard = new DeckCard { Card = new Card() } } } } }; var command = new StartGameCommand { SenderUserId = 1 }; command.Execute(game); Assert.IsType(typeof(RedrawState), command.NextState); Assert.True(game.Players.All(p => p.CanUseBattleKingCard)); Assert.NotNull(game.Players.SingleOrDefault(p => p.IsRoundStarter)); }
public void StartGameWithScoiataelFaction() { var game = new Game { State = new LobbyState(), Players = { new Player { User = new User { Id = 1 }, IsOwner = true, Deck = new Deck { Faction = GwintFaction.Scoiatael, BattleKingCard = new DeckCard { Card = new Card() } } }, new Player { User = new User { Id = 2 }, Deck = new Deck { BattleKingCard = new DeckCard { Card = new Card() } } } } }; var command = new StartGameCommand { SenderUserId = 1 }; command.Execute(game); Assert.IsType(typeof(PickStartingPlayerState), command.NextState); }
public void TwoPlayersStartInOppositeCorners() { var player1 = new Player("Player 1"); var player2 = new Player("Player 2"); var game = Game.CreateNewGame(10, 10, player1, player2); var log = new JsonMessageLog(); var command = new StartGameCommand(); command.Execute(game, log); var pos1 = player1.Position; var pos2 = player2.Position; Assert.AreEqual(0, pos1.X); Assert.AreEqual(0, pos1.Y); Assert.AreEqual(9, pos2.X); Assert.AreEqual(9, pos2.Y); }
public void ParseCommand(int action) { switch (action) { case 1: ICommand startGameCommand = new StartGameCommand(this.gameService, this.userService, this.boardOutputService, this.tetrominoService, this.currentTetrominoService, this.boardService); startGameCommand.Execute(); break; case 2: ICommand howToPlayCommand = new HowToPlayCommand(this.menuService); howToPlayCommand.Execute(); break; case 3: ICommand showScoresCommand = new ShowScoresCommand(this.menuService, this.userService); showScoresCommand.Execute(); break; case 4: ICommand showHighScoresCommand = new ShowHighScoresCommand(this.menuService, this.highScoreService); showHighScoresCommand.Execute(); break; case 5: ICommand showCreditsCommand = new ShowCreditsCommand(this.menuService); showCreditsCommand.Execute(); break; case 6: Environment.Exit(0); break; } }