Пример #1
0
        public void GameRemoveFromCollection()
        {
            // Arrange
            var factory = new Games();

            var gameNames = new List <String> {
                "player1", "player2", "player3", "player4"
            };

            var index  = factory.CreateGame(gameNames);
            var g      = factory.GetGame(index);
            var index2 = factory.CreateGame(gameNames);
            var g2     = factory.GetGame(index);

            // Act
            factory.RemoveGame(index);

            // Assert
            Assert.Null(factory.GetGame(index));
            Assert.Equal(1, factory.Count());
            Assert.NotNull(factory.GetGame(index2));
            Assert.False(g2.gameDone);
            Assert.Equal(4, g2.numberOfPlayers);
            Assert.NotNull(g2.players[3]);
        }
Пример #2
0
        private void Processing(object sender, EventArgs e)
        {
            var senderWTask = (TaskManager.WTask)sender;

            switch (Enum.Parse(typeof(Commands), senderWTask.Description.Substring(0, 5)))
            {
            case Commands.login:
                _tm.Send(senderWTask.From, Users.ReturnAnswerToUser(Users.CheckLogin(senderWTask)));
                break;

            case Commands.crgme:
                _tm.Send(senderWTask.From, Games.CreateGame(new User(senderWTask.From), _tm));
                break;

            case Commands.icome:
                Games.ComeGamerinGame(new User(senderWTask.From), new User(senderWTask.Description.Remove(0, 5)), _tm);
                break;

            case Commands.meout:
                Games.OutFromGame(Guid.Parse(senderWTask.Description.Remove(0, 5)), _tm, senderWTask.From);
                break;

            case Commands.gstep:
                Games.MakeMotion(senderWTask.Description.Remove(0, 5), _tm);
                break;
            }
        }