示例#1
0
        public void Test_Start_TrumpIsLastInDeck()
        {
            DurakGame game = new DurakGame();

            game.AddPlayer(0);
            game.AddPlayer(1);
            game.Start();

            Assert.That(game.Trump == game.Deck.Last().Suit);
        }
示例#2
0
        static void Setup()
        {
            int playerCount = 3;

            game = new DurakGame();

            for (int i = 0; i < playerCount; i++)
            {
                game.AddPlayer(i);
            }

            game.Start();
            previousDefender = game.DefenderIndex;
        }
示例#3
0
        public int AddPlayer(string name)
        {
            if (_players.Any(p => p.Name == name))
            {
                throw new ArgumentException($"There is already player with name {name}");
            }

            var players = _game.Players.OrderBy(p => p.Id);
            int id      = players.Any() ? players.Last().Id + 1 : 0;

            _game.AddPlayer(id);
            _players.Add(new Player()
            {
                Id = id, Name = name
            });
            return(id);
        }