public void EvaluateWithNullCooperationStrategyIgnoresNullCooperationStrategyException()
        {
            // Arranged
            var cooperationStrategiesFitnessEvaluator = new CooperationStrategiesFitnessEvaluator();
            cooperationStrategiesFitnessEvaluator.CooperationStrategies.Clear();
            cooperationStrategiesFitnessEvaluator.CooperationStrategies.Add(new NaiveCooperationStrategy());
            cooperationStrategiesFitnessEvaluator.CooperationStrategies.Add(null);

            // Act
            var fitnesses = cooperationStrategiesFitnessEvaluator.Evaluate();

            // Assert
            Assert.Equal(1, fitnesses.Count);
        }
        public void EvaluateWithEmptyCooperationStrategiesDoesNotThrowException()
        {
            // Arranged
            var cooperationStrategiesFitnessEvaluator = new CooperationStrategiesFitnessEvaluator();
            cooperationStrategiesFitnessEvaluator.CooperationStrategies.Clear();

            // Act
            var fitnesses = cooperationStrategiesFitnessEvaluator.Evaluate();

            // Assert
            Assert.Equal(0, fitnesses.Count);
        }
        public void EvaluateReturnsOneCooperationStrategyFitnessForEachStrategy()
        {
            // Arrange
            var cooperationStrategiesFitnessEvaluator = new CooperationStrategiesFitnessEvaluator();

            // Act
            var fitnesses = cooperationStrategiesFitnessEvaluator.Evaluate();

            // Assert
            Assert.Equal(cooperationStrategiesFitnessEvaluator.CooperationStrategies.Count(), fitnesses.Count);
        }
        public void EvaluateReturnsCorrectTotalPayoffForEachStrategy()
        {
            // Arrange
            var cooperationStrategiesFitnessEvaluator = new CooperationStrategiesFitnessEvaluator
                                                            {
                                                                NumberOfRounds = 3,
                                                            };

            // Act
            var fitnesses = cooperationStrategiesFitnessEvaluator.Evaluate();

            // Assert
            Assert.Equal(27, fitnesses[0].TotalPayoff);
            Assert.Equal(28, fitnesses[1].TotalPayoff);
            Assert.Equal(29, fitnesses[2].TotalPayoff);
        }
        public void EvaluateReturnsCooperationStrategyFitnessForEachStrategy()
        {
            // Arrange
            var cooperationStrategiesFitnessEvaluator = new CooperationStrategiesFitnessEvaluator();

            // Act
            var fitnesses = cooperationStrategiesFitnessEvaluator.Evaluate();

            // Assert
            Assert.True(cooperationStrategiesFitnessEvaluator.CooperationStrategies.All(strategy => fitnesses.Any(fitness => fitness.Strategy == strategy)));
        }
        public void EvaluateReturnsCooperationStrategyFitnessesInOrderOfInput()
        {
            // Arrange
            var cooperationStrategiesFitnessEvaluator = new CooperationStrategiesFitnessEvaluator();

            // Act
            var fitnesses = cooperationStrategiesFitnessEvaluator.Evaluate();

            // Assert
            Assert.Equal(cooperationStrategiesFitnessEvaluator.CooperationStrategies.First(), fitnesses[0].Strategy);
            Assert.Equal(cooperationStrategiesFitnessEvaluator.CooperationStrategies.Skip(1).First(), fitnesses[1].Strategy);
            Assert.Equal(cooperationStrategiesFitnessEvaluator.CooperationStrategies.Skip(2).First(), fitnesses[2].Strategy);
        }