Ejemplo n.º 1
0
        public void QuestionFactory_MapQuestionNull_Return_NullReferenceException()
        {
            QuestionFactory qFactory = new QuestionFactory();

            Question factoryQ = qFactory.MapQuestion(null, null);

            String s = factoryQ.question;
        }
Ejemplo n.º 2
0
        public Question getQuestionById(int id)
        {
            var question = questionEntitie.Fragens.Where(x => (x.P_Id == id)).FirstOrDefault();
            var answers  = questionEntitie.Antwortens.Where(x => (x.P_Id == id)).ToList();

            if (question != null)
            {
                return(questions.MapQuestion(question, answers));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        public void QuestionFactory_MapQuestion_ReturnValueObject()
        {
            EHFragenEntities   ehfEntitie = new EHFragenEntities();
            QuestionFactory    qFactory   = new QuestionFactory();
            QuestionManagement qManager   = new QuestionManagement();
            Question           managerQ   = qManager.getQuestionById(1);

            Fragenbogen_RK.Fragen fragen    = ehfEntitie.Fragens.Where(x => (x.P_Id == 1)).FirstOrDefault();
            List <Antworten>      antworten = ehfEntitie.Antwortens.Where(x => (x.P_Id == 1)).ToList();

            Question factoryQ = qFactory.MapQuestion(fragen, antworten);

            Assert.AreEqual(factoryQ.question, managerQ.question);
        }