Example #1
0
        public void GivenPlayerDoesNotExist(string playerName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(playerName);

            _player.FirstName = names.FirstName;
            _player.LastName  = names.LastName;
        }
Example #2
0
        public void GivenPlayerExists(string fullPlayerName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(fullPlayerName);

            _player.FirstName = names.FirstName;
            _player.LastName  = names.LastName;

            TestDbAdapter.CreatePlayer(_player);
        }
Example #3
0
        public void GivenIHaveRemovedPlayer(string playerName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(playerName);

            _playersToRemove.Add(new PlayerId(_createdPlayers
                                              .FirstOrDefault(x =>
            {
                return(x.LastName != null && (x.FirstName == names.FirstName && x.LastName == names.LastName));
            }).Id));
        }
        public void GivenCaptainIsChangedToAnother(string captainName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(captainName);

            _captain = new PlayerEntity {
                FirstName = names.FirstName,
                LastName  = names.LastName,
            };

            TestDbAdapter.CreatePlayer(_captain);
            _team.Players.Add(_captain);
        }
        public void GivenPlayerExists(string fullPlayerName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(fullPlayerName);

            var player = new PlayerEntity {
                FirstName = names.FirstName,
                LastName  = names.LastName
            };

            TestDbAdapter.CreatePlayer(player);
            _playerId = player.Id;
        }
Example #6
0
        public void GivenIHavePlayerAsATeamPlayer(string playerName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(playerName);

            var newPlayer = new PlayerEntity {
                FirstName = names.FirstName,
                LastName  = names.LastName
            };

            TestDbAdapter.CreatePlayer(newPlayer);
            _playerToAdd.Add(new PlayerId(newPlayer.Id));
        }
        private void RegisterNewPlayerAndSetCaptainId(string fullName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(fullName);

            var newPlayer = new PlayerEntity {
                FirstName = names.FirstName,
                LastName  = names.LastName
            };

            TestDbAdapter.CreatePlayer(newPlayer);

            _captainId = newPlayer.Id;
        }
Example #8
0
        public void GivenPlayerIsATeamPlayer(string playerName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(playerName);

            var newPlayer = new PlayerEntity {
                FirstName = names.FirstName,
                LastName  = names.LastName
            };

            TestDbAdapter.CreatePlayer(newPlayer);
            TestDbAdapter.AssignPlayerToTeam(newPlayer.Id, _teamId.Id);
            _createdPlayers.Add(newPlayer);
        }
Example #9
0
        public void GivenIsATeamCaptain(string playerName)
        {
            var names = SpecsHelper.SplitFullNameToFirstLastNames(playerName);

            using (var ctx = TestDbAdapter.Context)
            {
                var playerEntity = ctx.Players
                                   .SingleOrDefault(p => p.Id == _captainId.Id);

                if (playerEntity == null)
                {
                    return;
                }

                playerEntity.FirstName = names.FirstName;
                playerEntity.LastName  = names.LastName;
                ctx.SaveChanges();
                _createdPlayers.Add(playerEntity);
            }
        }