Exemple #1
0
 public void ReturnBetween17And19WhenHighSchool()
 {
     try
     {
         var age = _randomAgeQuery.Execute(PlayerStatus.HighSchool);
         Assert.IsTrue(age >= 17 && age <= 19, $"Age is: {age}");
     }
     catch (ArgumentOutOfRangeException ex)
     {
         Assert.Fail();
     }
 }
Exemple #2
0
        public PlayerModel[] Execute(GeneratePlayersRequest request)
        {
            var playNamesQuery       = new GetRandomPlayerNamesQuery(_repository);
            var playerStatusQuery    = new GetRandomPlayerStatusQuery();
            var generalPositionQuery = new GetRandomGeneralPositionQuery();
            var ageQuery             = new GetRandomAgeQuery();

            var playerNames = playNamesQuery.Execute(request.NumberOfPlayersToCreate);
            var players     = new List <PlayerModel>();

            foreach (var name in playerNames)
            {
                var playerStatus    = playerStatusQuery.Execute(request.Situation);
                var generalPosition = generalPositionQuery.Execute();
                var age             = ageQuery.Execute(playerStatus);
                players.Add(new PlayerModel()
                {
                    Guid            = Guid.NewGuid(),
                    Status          = playerStatus,
                    FirstName       = name.FirstName,
                    LastName        = name.LastName,
                    GeneralPosition = generalPosition,
                    Age             = age
                });
            }

            return(players.ToArray());
        }