public void GetAllQuestionAnswersForTeacher() { // Arrange const int teacherId = 2; const int questionId = 23; var question = GetFakeQuiz.Question(questionId); question.Quiz = _service.GetQuiz(1).GetData(); _service.CreateQuizQuestion(question); _service.GetQuestionAnswer(1).GetData().QuizQuestion = question; // Act var result = _service.GetAllQuestionAnswers(teacherId); // Assert Assert.IsTrue(result.IsOK); var data = result.GetData() as IEnumerable <QuestionAnswer>; Assert.IsNotNull(data); var dataAsList = data.ToList(); Assert.IsTrue(dataAsList.Count == 1); Assert.IsTrue(dataAsList[0].QuizQuestion.Id == question.Id); Assert.IsTrue(dataAsList[0].QuizQuestion.Quiz.Id == _service.GetQuiz(1).GetData().Id); }
public void CreateQuizQuestion() { // Arrange int id = 543; var quizQesution = GetFakeQuiz.Question(id); // Act var result = _service.CreateQuizQuestion(quizQesution); // Aseert Assert.IsTrue(result.IsOK); var data = _service.GetQuizQuestion(id).GetData() as QuizQuestion; Assert.IsNotNull(data); Assert.IsTrue(data.Id == id); Assert.IsTrue(data.QuestionText == "QuestionText" + id); }
public void Create() { // Arrange var id = 888; var item = GetFakeQuiz.Question(id); // Act var result = repository.CreateItem(item); // Assert Assert.IsTrue(result); var insertedItem = repository.GetItem(id); Assert.IsTrue(insertedItem.Id == id); Assert.IsTrue(insertedItem.QuestionText == "QuestionText" + id); var items = repository.GetAllItems(); Assert.IsTrue(items.Count() == ITEMS_COUNT + 1); }
public void GetAllQuizQuestionsForTeacher() { // Arrange var id = 9644; var teacherId = 2; var quizQuestion = GetFakeQuiz.Question(id); quizQuestion.Quiz = _service.GetQuiz(1).GetData(); _service.CreateQuizQuestion(quizQuestion); // Act var result = _service.GetAllQuizQuestions(teacherId); // Assert Assert.IsTrue(result.IsOK); var data = result.GetData() as IEnumerable <QuizQuestion>; Assert.IsNotNull(data); var dataList = data.ToList(); Assert.IsTrue(dataList.Count() == 1); Assert.IsTrue(dataList.ToList()[0].Id == id); }