public void SimulateWillReturnSimulationResultsWithNumberOfMatchupResultsEqualToSuppliedNumberOfRounds() { // Arrange var matchup = new CooperationStrategyMatchup(new NaiveCooperationStrategy(), new EvilCooperationStrategy(), new CooperationChoicesPayoff()); var matchupSimulation = new CooperationStrategyMatchupSimulation(matchup); const int NumberOfRounds = 20; // Act var simulationResults = matchupSimulation.Simulate(NumberOfRounds); // Assert Assert.Equal(NumberOfRounds, simulationResults.MatchupResults.Count); }
public void SimulateWillReturnCorrectMatchupResults() { // Arrange var matchup = new CooperationStrategyMatchup(new TitForTatCooperationStrategy(), new EvilCooperationStrategy(), new CooperationChoicesPayoff()); var matchupSimulation = new CooperationStrategyMatchupSimulation(matchup); const int NumberOfRounds = 2; // Act var simulationResults = matchupSimulation.Simulate(NumberOfRounds); // Assert Assert.Equal(CooperationChoice.Cooperate, simulationResults.MatchupResults[0].StrategyAResult.ChoiceMade); Assert.Equal(CooperationChoice.Defect, simulationResults.MatchupResults[1].StrategyBResult.ChoiceMade); }
public void CooperationStrategyMatchupReturnsCooperationStrategyMatchupSuppliedToConstructor() { // Arrange var strategyA = new NaiveCooperationStrategy(); var strategyB = new EvilCooperationStrategy(); var cooperationChoicePayoff = new CooperationChoicesPayoff(); var matchup = new CooperationStrategyMatchup(strategyA, strategyB, cooperationChoicePayoff); // Act var simulation = new CooperationStrategyMatchupSimulation(matchup); // Assert Assert.Equal(matchup, simulation.Matchup); }
public void SimulateWithNumberOfRoundsEqualToZeroThrowsArgumentException() { // Arrange var matchup = new CooperationStrategyMatchup(new NaiveCooperationStrategy(), new EvilCooperationStrategy(), new CooperationChoicesPayoff()); var matchupSimulation = new CooperationStrategyMatchupSimulation(matchup); const int NumberOfRounds = 0; // Act // Assert Assert.Throws<ArgumentException>(() => matchupSimulation.Simulate(NumberOfRounds)); }