public void IssueCategorization() { Assert.AreEqual(2, _report.ListErrors().Count()); Assert.AreEqual(3, _report.Where(severity: OperationOutcome.IssueSeverity.Warning).Count()); Assert.AreEqual(2, _report.Where(type: OperationOutcome.IssueType.BusinessRule).Count()); Assert.AreEqual(1, _report.Where(issueCode: Issue.PROFILE_ELEMENTDEF_CARDINALITY_MISSING.Code).Count()); Assert.AreEqual(1, _report.Where(severity: OperationOutcome.IssueSeverity.Warning, type: OperationOutcome.IssueType.BusinessRule, issueCode: 2008).Count()); Assert.AreEqual(0, _report.Where(severity: OperationOutcome.IssueSeverity.Error, type: OperationOutcome.IssueType.BusinessRule, issueCode: 2008).Count()); }
private static bool errorOnDiscriminator(string[] discriminators, OperationOutcome outcome) { foreach (var location in outcome.ListErrors().SelectMany(i => i.Location)) { // Remove all the array indices from the instance path (e.g. you end up with Patient.telecom.system, not // Patient.telecom[2].system[0]) var ni = strip(location); //TODO: Crude algorithm. Does not support navigating across references, nor type slices, nor discriminators on choices if (discriminators.Any(d => d == ni || ni.StartsWith(d + "."))) { return(true); } } return(false); }
public static IEnumerable <OperationOutcome.IssueComponent> ErrorsAt(this OperationOutcome outcome, string path) { return(outcome.ListErrors().Where(issue => issue.IsAt(path))); }
public static IEnumerable <OperationOutcome.IssueComponent> ErrorsAt(this OperationOutcome outcome, IElementNavigator node) { return(outcome.ListErrors().Where(issue => issue.IsAt(node))); }