public void PlayTurnSuccess() { // Arrange var game = TestUtils.CreateStartedGameWithMapAndPlayers(); var currentPlayer = game.CurrentPlayer; // Act var bot = new Bot(game, TestUtils.GetMapTemplate(), new AttackService(new AttackerWinsRandomGen()), new RandomGen()); bot.PlayTurn(); // Assert Assert.AreNotEqual(currentPlayer, game.CurrentPlayer, "Current player has not changed"); Assert.IsFalse(game.HistoryEntries.Count() == 0, "No history entries"); }
public void Play(long gameId) { var game = this.unitOfWork.Games.Find(gameId); if (game.State != Domain.Enums.GameState.Active) { return; } var mapTemplateProvider = this.LifetimeScope.Resolve<IMapTemplateProvider>(); var mapTemplate = mapTemplateProvider.GetTemplate(game.MapTemplateName); var attackService = this.LifetimeScope.Resolve<IAttackService>(); var randomGen = this.LifetimeScope.Resolve<IRandomGen>(); var bot = new Bot(game, mapTemplate, attackService, randomGen); bot.PlayTurn(); this.unitOfWork.Commit(); }