// GET api/assessments/5
        public HttpResponseMessage Get(int id)
        {
            var model = TheModelFactory.Create(manager.Get(id));

            if (model == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, model));
        }
Ejemplo n.º 2
0
        public void Get_One_Assessment()
        {
            // Arrange
            Assessment fakeAssessment = new Assessment()
            {
                Id = 1000, Name = "test fake assessment"
            };

            assessmentRepository.Setup(x => x.GetByID(1000)).Returns(fakeAssessment);

            assessmentManager = new AssessmentManager(null, assessmentRepository.Object, null);

            //// Act
            var assessment = assessmentManager.Get(1000);

            //// Assert
            Assert.IsNotNull(assessment, "Result is null");
            Assert.IsInstanceOfType(assessment, typeof(Assessment), "Wrong Model");
            Assert.AreEqual(1000, assessment.Id, "Got wrong number of Assessments");
        }