public void Scenario_OpponentUsesMonopolyCardAndGetsResourcesFromPlayer() { // Arrange var monopolyCard = new MonopolyDevelopmentCard(); var testInstances = this.TestSetup(new MockGameBoardWithNoResourcesCollected(), monopolyCard); var localGameController = testInstances.LocalGameController; testInstances.Dice.AddSequence(new uint[] { 8, 8, 8, 8 }); var player = testInstances.MainPlayer; var firstOpponent = testInstances.FirstOpponent; var secondOpponent = testInstances.SecondOpponent; var thirdOpponent = testInstances.ThirdOpponent; testInstances.Dice.AddSequence(new uint[] { 3, 3, 8, 8 }); // Only second opp will collect resources (2 Ore) player.AddResources(ResourceClutch.OneBrick); firstOpponent.AddResources(ResourceClutch.DevelopmentCard); firstOpponent.AddBuyDevelopmentCardChoice(1).EndTurn() .AddPlaceMonopolyCardInstruction(new PlayMonopolyCardInstruction { ResourceType = ResourceTypes.Brick }).EndTurn(); secondOpponent.AddResources(new ResourceClutch(2, 1, 1, 1, 1)); var turn = 0; GameToken turnToken = null; localGameController.StartPlayerTurnEvent = (GameToken t) => { turnToken = t; turn++; }; var gameEvents = new List <List <GameEvent> >(); localGameController.GameEvents = (List <GameEvent> e) => { gameEvents.Add(e); }; localGameController.StartGamePlay(); localGameController.EndTurn(turnToken); // Opponent buys development cards localGameController.EndTurn(turnToken); // Opponent plays monopoly cards // Assert var expectedBuyDevelopmentCardEvent = new BuyDevelopmentCardEvent(firstOpponent.Id); var expectedResourceTransactionList = new ResourceTransactionList(); expectedResourceTransactionList.Add(new ResourceTransaction(firstOpponent.Id, player.Id, ResourceClutch.OneBrick)); expectedResourceTransactionList.Add(new ResourceTransaction(firstOpponent.Id, secondOpponent.Id, ResourceClutch.OneBrick * 2)); var expectedPlayMonopolyCardEvent = new PlayMonopolyCardEvent(firstOpponent.Id, expectedResourceTransactionList); gameEvents.Count.ShouldBe(15); gameEvents[2].Count.ShouldBe(2); gameEvents[2][1].ShouldBe(expectedBuyDevelopmentCardEvent); gameEvents[9].Count.ShouldBe(2); gameEvents[9][1].ShouldBe(expectedPlayMonopolyCardEvent); player.Resources.Count.ShouldBe(0); firstOpponent.Resources.Count.ShouldBe(3); firstOpponent.Resources.BrickCount.ShouldBe(firstOpponent.Resources.Count); secondOpponent.Resources.Count.ShouldBe(4); secondOpponent.Resources.BrickCount.ShouldBe(0); thirdOpponent.Resources.Count.ShouldBe(0); }
public void Scenario_OpponentUsesYearOfPlentyCardAndGetsResourcesofDifferentTypes() { // Arrange var bankId = Guid.NewGuid(); var yearOfPlentyCard = new YearOfPlentyDevelopmentCard(); var testInstances = this.TestSetupWithExplictGameBoard(bankId, yearOfPlentyCard, new MockGameBoardWithNoResourcesCollected()); var localGameController = testInstances.LocalGameController; testInstances.Dice.AddSequence(new uint[] { 8, 8, 8, 8, 8, 8, 8, 8 }); var player = testInstances.MainPlayer; var firstOpponent = testInstances.FirstOpponent; var secondOpponent = testInstances.SecondOpponent; var thirdOpponent = testInstances.ThirdOpponent; firstOpponent.AddResources(ResourceClutch.DevelopmentCard); firstOpponent.AddBuyDevelopmentCardChoice(1).EndTurn() .AddPlayYearOfPlentyCardInstruction(new PlayYearOfPlentyCardInstruction { FirstResourceChoice = ResourceTypes.Brick, SecondResourceChoice = ResourceTypes.Grain }).EndTurn(); var turn = 0; GameToken turnToken = null; localGameController.StartPlayerTurnEvent = (GameToken t) => { turnToken = t; turn++; }; var gameEvents = new List <List <GameEvent> >(); localGameController.GameEvents = (List <GameEvent> e) => { gameEvents.Add(e); }; localGameController.StartGamePlay(); localGameController.EndTurn(turnToken); // Opponent buys development card localGameController.EndTurn(turnToken); // Opponent plays year of plenty card // Assert var expectedBuyDevelopmentCardEvent = new BuyDevelopmentCardEvent(firstOpponent.Id); var expectedResourceTransactionList = new ResourceTransactionList(); expectedResourceTransactionList.Add(new ResourceTransaction(firstOpponent.Id, bankId, new ResourceClutch(1, 1, 0, 0, 0))); var expectedPlayYearOfPlentyCardEvent = new YearOfPlentyCardPlayedEvent(firstOpponent.Id, ResourceTypes.Brick, ResourceTypes.Brick); gameEvents.Count.ShouldBe(15); gameEvents[2].Count.ShouldBe(2); gameEvents[2][1].ShouldBe(expectedBuyDevelopmentCardEvent); gameEvents[9].Count.ShouldBe(2); gameEvents[9][1].ShouldBe(expectedPlayYearOfPlentyCardEvent); player.Resources.Count.ShouldBe(0); firstOpponent.Resources.Count.ShouldBe(2); firstOpponent.Resources.BrickCount.ShouldBe(1); firstOpponent.Resources.GrainCount.ShouldBe(1); secondOpponent.Resources.Count.ShouldBe(0); secondOpponent.Resources.BrickCount.ShouldBe(0); thirdOpponent.Resources.Count.ShouldBe(0); }