public void Test_GetPatientObservations()
        {
            // Arrange
            context.Observations.Add(new Observation {
                UserId    = userId,
                PatientId = patientId,
                Comment   = userComment,
                Timestamp = new DateTime()
            });

            context.Users.Add(new User {
                Id        = userId,
                FirstName = firstName,
                LastName  = lastName,
                Email     = email,
                Password  = password,
                Salt      = "salt"
            });

            context.SaveChanges();

            var evaluator = new PatientsEvaluator(context);

            // Act
            var evalResult        = evaluator.GetPatientObserations(patientId);
            var observationResult = JsonConvert.SerializeObject((evalResult as JsonResult).Value);
            var observation       = JArray.Parse(observationResult);

            // Assert
            Assert.Equal(observation[0]["Comment"], userComment);
        }
Exemple #2
0
 public IActionResult GetPatientObserations(int patientId)
 {
     try
     {
         return(evaluator.GetPatientObserations(patientId));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }