public void GivenAnEmptyListOfOperationOutComeIssues_WhenInitialized_ThenOneOperationOutcomeIssueShouldBeAdded() { string message = "message"; HttpStatusCode statusCode = HttpStatusCode.Processing; var exception = new FhirTransactionFailedException(message, statusCode, new List <OperationOutcomeIssue>()); Assert.NotNull(exception.Issues); Assert.Single(exception.Issues); AssertOperationOutcomeIssue(message, OperationOutcomeConstants.IssueType.Processing, exception.Issues.First()); }
public void GivenAListOfOperationOutComeIssues_WhenInitialized_ThenCorrectOperationOutcomeIssuesShouldBeAdded() { string message = "message"; HttpStatusCode statusCode = HttpStatusCode.Processing; var operationOutComeIssues = GetOperationOutcomeIssues(message); var exception = new FhirTransactionFailedException(message, statusCode, operationOutComeIssues); Assert.NotNull(exception.Issues); Assert.Equal(3, exception.Issues.Count); AssertOperationOutcomeIssue(message, OperationOutcomeConstants.IssueType.Processing, exception.Issues.First()); AssertOperationOutcomeIssue(message, OperationOutcomeConstants.IssueType.NotFound, exception.Issues.Skip(1).First()); AssertOperationOutcomeIssue(message, OperationOutcomeConstants.IssueType.Invalid, exception.Issues.Last()); }