public void QuestionFactory_MapQuestionNull_Return_NullReferenceException() { QuestionFactory qFactory = new QuestionFactory(); Question factoryQ = qFactory.MapQuestion(null, null); String s = factoryQ.question; }
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); } }
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); }