public IActionResult GetSteps(int patientId, long startDate, long endDate) { try { return(evaluator.GetSteps(patientId, startDate, endDate)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void Test_GetSteps() { // Arrange context.Steps.Add(new Step { PatientId = patientId, Epoch = stepStart }); context.SaveChanges(); var evaluator = new PatientsEvaluator(context); // Act var stepsResult = evaluator.GetSteps(patientId, stepStart, stepEnd); // Assert var steps = JsonConvert.SerializeObject((stepsResult as JsonResult).Value as IEnumerable <object>); var stepsObj = JArray.Parse(steps); Assert.Equal(stepsObj.Count(), 1); Assert.Equal(stepsObj.First["Epoch"], stepStart); }