コード例 #1
0
        public IEnumerable <Squad> Make(int numberOfSquads)
        {
            var allPlayers = new List <SquadPlayer>(_playerProvider.ProvidePlayers()).ToList();

            AlgorithmInput _algorithmInput = new AlgorithmInput();

            _algorithmInput = _internalDataProvider.ProvideAlgorithmInput(numberOfSquads, (List <SquadPlayer>)allPlayers);

            var sequenceData = new List <AlgDynamicSequenceModel>(_algSequenceProvider.ProvideSequenceData(_algorithmInput));

            _algorithmInput.AllPlayers   = allPlayers;
            _algorithmInput.SequenceData = sequenceData;

            var squads = new List <Squad>(_squadsProvider.ProvideSquads(_algorithmInput)).ToList();

            foreach (Squad squad in (List <Squad>)squads)
            {
                if (squad.Name.Equals("bench", StringComparison.OrdinalIgnoreCase))
                {
                    yield return(squad);
                }
                else
                {
                    _iTeamAverageCalculator.CalculateAverage(squad);
                    yield return(squad);
                }
            }
        }
コード例 #2
0
 public void CalculateAverageNoOfPlayersTests(int noOfPlayer)
 {
     _teamAverageCalculator.CalculateAverage(_squad);
     Assert.AreEqual(noOfPlayer, _squad.Players.Count());
 }