Ejemplo n.º 1
0
        /// <summary>
        /// Задает коллекцию вопросов.
        /// </summary>
        /// <param name="id">Идентификатор пользователя.</param>
        /// <param name="user">Имя пользователя.</param>
        /// <param name="command">Команда с типом вопросов.</param>
        private void SetQuestions(int id, string user, string command)
        {
            _subStates[id] = new UserTestState
            {
                User     = user,
                Results  = new List <bool>(),
                SubState = StateChoice
            };

            switch (command)
            {
            case ConclusiveRoleMember:
            {
                _subStates[id].TasksInfos = _tasksStorage.GetTasksForConclusiveMembers(QuestionsNumbers)
                                            .Select(c => _tasksProcessing.Shake(c)).ToList();

                break;
            }

            case ConsultativeRoleMember:
            {
                _subStates[id].TasksInfos = _tasksStorage.GetTasksForConsultativeMembers(QuestionsNumbers)
                                            .Select(c => _tasksProcessing.Shake(c)).ToList();


                break;
            }

            case Observer:
            {
                _subStates[id].TasksInfos = _tasksStorage.GetTasksForObservers(QuestionsNumbers)
                                            .Select(c => _tasksProcessing.Shake(c)).ToList();

                break;
            }
            }
        }
Ejemplo n.º 2
0
        public void ShakeTest()
        {
            for (var i = 0; i < 10; i++)
            {
                var task = _tasksProcessing.Shake(Task);
                if (task.CorrectOptionNum == Task.CorrectOptionNum)
                {
                    continue;
                }

                if (i == 9)
                {
                    throw new SuccessException(@"Не удалось перемешать варианты в задаче.");
                }

                Assert.That(task.Options.ToList()[task.CorrectOptionNum], Is.EqualTo(Task.Options.ToList()[Task.CorrectOptionNum]));
                break;
            }
        }