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());
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void CreateInterviewerTest()
        {
            InterviweeManagement _InterviweeManagement = new InterviweeManagement();

            DAO.Interviwee _Interviwee = new DAO.Interviwee()
            {
                LastName   = StaticInterviwee.LasName,
                FirstName  = StaticInterviwee.FirstName,
                SecondName = StaticInterviwee.SecondName
            };

            _InterviweeManagement.CreateInterviwee(_Interviwee);
            _DbContext.SaveChanges();

            _Interviwee = _InterviweeManagement.GetInterviwee(StaticInterviwee.LasName, StaticInterviwee.FirstName, StaticInterviwee.SecondName);
            Assert.True(
                _DbContext.Interviwees.Where(x =>
                                             x.Id == _Interviwee.Id
                                             ).Count() == 1
                );
        }