public void WriteTest_Id() { var customMetricItem = new CustomMetricItem() { Id = "5b98016854c00417f86e8d098ffc1e00" }; string expected = "{\"id\":\"5b98016854c00417f86e8d098ffc1e00\"}"; var actual = JsonSerializer.Serialize <CustomMetricItem>(customMetricItem); Assert.AreEqual(expected, actual); }
public void WriteTest_NameContextTypeObjectives() { var objectives = new List <MetricBin>() { new MetricBin("PASS", new byte[] { 18, 191, 0 }, null, 90), new MetricBin("FAIL", new byte[] { 255, 0, 0 }) }; var customMetricItem = new CustomMetricItem() { Name = "Normalcy of Diet @ 6 mo. (0-100)", Context = "patient", Type = new CustomMetricType("number"), Objectives = objectives }; string objectivesJson = "[{\"label\":\"PASS\",\"color\":[18,191,0],\"max\":90},{\"label\":\"FAIL\",\"color\":[255,0,0]}]"; string expected = $"{{\"name\":\"Normalcy of Diet @ 6 mo. (0-100)\",\"context\":\"patient\",\"type\":{{\"number\":{{}}}},\"objectives\":{objectivesJson}}}"; var actual = JsonSerializer.Serialize <CustomMetricItem>(customMetricItem); Assert.AreEqual(expected, actual); }
public void WriteTest() { var computedMetricObjectives = new List <MetricBin>() { new MetricBin("IDEAL", new byte[] { 18, 191, 0 }, null, 85), new MetricBin("UNACCEPTABLE", new byte[] { 255, 0, 0 }) }; var computedMetric = new ComputedMetric("CUMULATIVE_METERSET", null, null, null, computedMetricObjectives); var computedMetrics = new List <ComputedMetric>() { computedMetric }; var customMetricObjectives = new List <MetricBin>() { new MetricBin("IDEAL", new byte[] { 18, 191, 0 }, null, 90), new MetricBin("UNACCEPTABLE", new byte[] { 255, 0, 0 }) }; var customMetricItem = new CustomMetricItem() { Id = "5b9c00f90e40e073f43aec25ff9f851a", Objectives = customMetricObjectives }; var customMetricItems = new List <CustomMetricItem>() { customMetricItem }; var scorecardTemplateItem = new ScorecardTemplateItem(null, "SDK Testing", computedMetrics, customMetricItems); string computedMetricObjectivesJson = "[{\"label\":\"IDEAL\",\"color\":[18,191,0],\"max\":85},{\"label\":\"UNACCEPTABLE\",\"color\":[255,0,0]}]"; string computedMetricsJson = $"[{{\"type\":\"CUMULATIVE_METERSET\",\"roi_name\":null,\"arg_1\":null,\"arg_2\":null,\"objectives\":{computedMetricObjectivesJson}}}]"; string customMetricObjectivesJson = "[{\"label\":\"IDEAL\",\"color\":[18,191,0],\"max\":90},{\"label\":\"UNACCEPTABLE\",\"color\":[255,0,0]}]"; string customMetricsJson = $"[{{\"id\":\"5b9c00f90e40e073f43aec25ff9f851a\",\"objectives\":{customMetricObjectivesJson}}}]"; string expected = $"{{\"name\":\"SDK Testing\",\"computed\":{computedMetricsJson},\"custom\":{customMetricsJson}}}"; var actual = JsonSerializer.Serialize <ScorecardTemplateItem>(scorecardTemplateItem); Assert.AreEqual(expected, actual); }