public void Can_get_test_details()
        {
            #region Arrange
            var test = new TestDto
            {
                Author       = ProfileModelDto.Map(TestPofile),
                CreationDate = DateTime.Now,
                Name         = "new test",
                TestType     = TestTypeModelDto.Map(TestTestType),
                Questions    = new List <TestQuestionModelDto> {
                    TestQuestionModelDto.Map(TestQuestion)
                }
            };
            using (var session = DataAccess.OpenSession())
            {
                var course = session.Get <CourseModel>(1);
                course.Tests.Add(TestDto.UnMap(test));
                session.Flush();
            }
            #endregion

            #region Act

            test = new TestService().GetTestDetails(3);

            #endregion

            #region Assert
            Assert.That(test.Name, Is.EqualTo("new test"));
            Assert.That(test.Questions.Count, Is.EqualTo(1));
            Assert.That(test.Questions.First().Answers.Count, Is.EqualTo(1));
            #endregion
        }
Beispiel #2
0
 public TestQuestionModelDto GetTestQuestion(int id)
 {
     try
     {
         var tesquestion = new Repository <TestQuestionModel>().GetById(id);
         return(TestQuestionModelDto.Map(tesquestion));
     }
     catch (Exception ex)
     {
         Logger.Error("Error : GetTestQuestion - {0}", ex.Message);
         return(null);
     }
 }