コード例 #1
0
        public void GivenInvalidCompartmentType_WhenCreated_ThenExceptionShouldBeThrown(string invalidCompartmentType)
        {
            InvalidSearchOperationException exception = Assert.Throws <InvalidSearchOperationException>(() => CreateSearchOptions(
                                                                                                            resourceType: null,
                                                                                                            queryParameters: null,
                                                                                                            invalidCompartmentType,
                                                                                                            "123"));

            Assert.Equal(exception.Message, $"Compartment type {invalidCompartmentType} is invalid.");
        }
コード例 #2
0
        public void GivenInvalidCompartmentId_WhenCreated_ThenExceptionShouldBeThrown(string invalidCompartmentId)
        {
            InvalidSearchOperationException exception = Assert.Throws <InvalidSearchOperationException>(() => CreateSearchOptions(
                                                                                                            resourceType: ResourceType.Claim.ToString(),
                                                                                                            queryParameters: null,
                                                                                                            CompartmentType.Patient.ToString(),
                                                                                                            invalidCompartmentId));

            Assert.Equal("Compartment id is null or empty.", exception.Message);
        }
        public void GivenAMessage_WhenInitialized_ThenCorrectOperationOutcomeShouldBeAdded()
        {
            string message = "message";

            var exception = new InvalidSearchOperationException(message);

            Assert.NotNull(exception.Issues);
            Assert.Equal(1, exception.Issues.Count);

            var issue = exception.Issues.First();

            Assert.Equal(OperationOutcomeConstants.IssueSeverity.Error, issue.Severity);
            Assert.Equal(OperationOutcomeConstants.IssueType.Forbidden, issue.Code);
            Assert.Equal(message, issue.Diagnostics);
        }