コード例 #1
0
        public void AddTestCenterManagement(TestManagement m, int centerID)
        {
            var center = _testCenters.Find(t => t.ID == centerID).First();

            center.TestManagement = m;
            _testCenters.ReplaceOne(t => t.ID == centerID, center);
        }
コード例 #2
0
 public override void Load()
 {
     Bind <IAnswerManagement>().ToMethod(x => AnswerManagement.Instance());
     Bind <IInterviweeManagement>().ToMethod(x => InterviweeManagement.Instance());
     Bind <IQuestionManagement>().ToMethod(x => QuestionManagement.Instance());
     Bind <IStatistic>().ToMethod(x => Statistic.Instance());
     Bind <ITesting>().ToMethod(x => Testing.Instance());
     Bind <ITestManagement>().ToMethod(x => TestManagement.Instance());
 }
コード例 #3
0
        public void CreateTest()
        {
            TestManagement _TestManagement = new TestManagement();

            DAO.Test _Test = new DAO.Test()
            {
                Name = StaticTests.T1, Description = "Проверка создания тестов."
            };

            _TestManagement.CreateTest(_Test);
            _DbContext.SaveChanges();

            Assert.True(_TestManagement.GetTest(StaticTests.T1).Id > 0);
        }
コード例 #4
0
        public void TestingTest()
        {
            TestManagement       _TestManagement       = new TestManagement();
            InterviweeManagement _InterviweeManagement = new InterviweeManagement();

            KnowledgeTesting.BL.Testing _Testing = new KnowledgeTesting.BL.Testing();



            DAO.Interviwee _Interviwee = _InterviweeManagement.GetInterviwee(StaticInterviwee.LasName, StaticInterviwee.FirstName, StaticInterviwee.SecondName);
            DAO.Test       _Test       = _TestManagement.GetTest(StaticTests.T1);

            int _CountCompleteTeststBefore = _Interviwee.Tests.Count();

            DAO.InterviweeTests _InterviweeTests = _Testing.GetTesting(_Interviwee, _Test);

            // Количество отвеченных вопросов
            // (в конце на 1 больше чем вопрсов из-за последнего прохода цикла для определения статуса завершения).
            int _CountQuestions = 0;

            while (!_InterviweeTests.IsComplete)
            {
                // Определить статус завершения.
                _InterviweeTests.IsComplete = _Testing.DetermineStatusComplete(_InterviweeTests);

                if (!_InterviweeTests.IsComplete)
                {
                    // Получить следующий вопрос.
                    DAO.Question _Question = _Testing.GetNextQuestion(_InterviweeTests);
                    // Отвтеить на вопрос.
                    if (_Question != null)
                    {
                        _Testing.AnswerToQuestion(_InterviweeTests, _Question, _Question.Answers.First().Answer);
                    }
                }

                // Сохранить изменения - БЕЗ этого не возможно определить статус завершения теста.
                _DbContext.SaveChanges();

                _CountQuestions++;
                Assert.True(_CountQuestions <= 10);
            }

            int _CountCompleteTeststAfter = _Interviwee.Tests.Count();

            Assert.True(_DbContext.InterviweeTests.Where(x => x.Id == _InterviweeTests.Id).First().IsComplete);
            Assert.True(_CountCompleteTeststAfter > _CountCompleteTeststBefore);
            Assert.True(_InterviweeTests.TestingResults.Count() > 0);
        }
コード例 #5
0
        public void AddQuestionToTest()
        {
            TestManagement     _TestManagement     = new TestManagement();
            QuestionManagement _QuestionManagement = new QuestionManagement();

            DAO.Test _Test = _TestManagement.GetTest(StaticTests.T1);
            _TestManagement.AddQuestion(_Test, _QuestionManagement.GetQuestion(StaticQuestions.Q1));
            _TestManagement.AddQuestion(_Test, _QuestionManagement.GetQuestion(StaticQuestions.Q2));
            _TestManagement.AddQuestion(_Test, _QuestionManagement.GetQuestion(StaticQuestions.Q3));
            _TestManagement.AddQuestion(_Test, _QuestionManagement.GetQuestion(StaticQuestions.Q4));
            _TestManagement.AddQuestion(_Test, _QuestionManagement.GetQuestion(StaticQuestions.Q5));
            _DbContext.SaveChanges();

            Assert.True(_Test.Questions.Where(x => x.QuestionId == _QuestionManagement.GetQuestion(StaticQuestions.Q3).Id).Count() == 1);
        }
コード例 #6
0
        public void Test1()
        {
            TestManagement k = new TestManagement();

            Assert.Equal(1, k.testing());
        }