Esempio n. 1
0
        public void CannotAddPlayerToGameIfAtMaxCapacity()
        {
            var game = new PickUpGame(DateTime.Now, new Sport(), new Location());
             game.MaxPlayers = 0;

             var exception = Assert.Throws(typeof (Exception), () => game.AddPlayer("Profile1"));
             Assert.AreEqual(exception.Message, "The game is already at capacity.");
        }
Esempio n. 2
0
        private void CreateExtraGames()
        {
            for (var k = 0; k < 100; k++)
            {
                var randomNumber = new Random(k);
                Console.WriteLine("Creating record: " + k);
                var game = new PickUpGame(DateTime.Now, new Sport(), new Location());
                game.MaxPlayers = 5;
                game.MinPlayers = 3;
                game.IsPrivate = true;
                game.Sport = SportIds[((int)(randomNumber.NextDouble() * SportIds.Count))];
                game.Location = LocationIds[((int)(randomNumber.NextDouble() * LocationIds.Count))];
                for (int i = 0; i < 5; i++)
                {
                    var profileId = ProfileIds[((int)(randomNumber.NextDouble() * ProfileIds.Count))];
                    if (game.PlayersIds.Contains(profileId))
                        continue;
                    game.AddPlayer(profileId);
                }
                game.Creator = Profile1Id;

                new PickUpGameRepository().SavePickUpGame(game);
            }
        }
        private PickUpGame CreatePickUpGameOnly()
        {
            var game = new PickUpGame(DateTime.Now, new Sport(), new Location());
            game.MaxPlayers = 5;
            game.MinPlayers = 3;
            game.IsPrivate = true;
            game.Sport = "Soccer";
            game.Location = "Bend";
            game.AddPlayer(_profile.ProfileName);
            game.Creator = _profile.ProfileName;
            game.ExactLocation = "A road in space";
            game.GameName = "A game name";

            _repo.SavePickUpGame(game);
            return game;
        }
Esempio n. 4
0
        public PickUpGame CreateGameWithProfile1AndProfile2()
        {
            var game = new PickUpGame(DateTime.Now, new Sport(), new Location());
            game.MaxPlayers = 5;
            game.MinPlayers = 3;
            game.IsPrivate = true;
            game.Sport = Basketballname;
            game.Location = LocationPortland;
            game.AddPlayer(Profile1Id);
            game.AddPlayer(Profile2Id);
            game.Creator = Profile1Id;
            game.GameName = "Cool Game";

            new PickUpGameRepository().SavePickUpGame(game);
            PickUpGame = game;
            return game;
        }
Esempio n. 5
0
        public PickUpGame CreateGameWithProfile1()
        {
            var game = new PickUpGame(DateTime.Now, new Sport(), new Location());
            game.MaxPlayers = 5;
            game.MinPlayers = 3;
            game.IsPrivate = true;
            game.Sport = SoccerName;
            game.Location = LocationBendName;
            game.AddPlayer(Profile1Id);
            game.Creator = Profile1Id;
            game.GameName = "1 Player game";

            new PickUpGameRepository().SavePickUpGame(game);
            PickUpGame = game;
            return game;
        }