From 69903158e0cbd4105e3b44abbef0047a9025327d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 16:16:58 +0000 Subject: [PATCH 1/5] Bump xunit from 2.6.3 to 2.6.4 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.3 to 2.6.4. - [Commits](https://github.com/xunit/xunit/compare/2.6.3...2.6.4) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/firely-net-sdk-tests.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firely-net-sdk-tests.props b/src/firely-net-sdk-tests.props index 0a5d857075..75cf9273a5 100644 --- a/src/firely-net-sdk-tests.props +++ b/src/firely-net-sdk-tests.props @@ -27,7 +27,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 7c68863f561e18b937e21e35f55d8eaec0628340 Mon Sep 17 00:00:00 2001 From: mmsmits Date: Wed, 3 Jan 2024 10:27:59 +0100 Subject: [PATCH 2/5] missed another return in SourceNodeComparator --- .../ElementModel/SourceNodeComparator.cs | 2 +- .../SourceNodeTests.cs | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Hl7.Fhir.Base/ElementModel/SourceNodeComparator.cs b/src/Hl7.Fhir.Base/ElementModel/SourceNodeComparator.cs index 4915c3d644..a32b22f132 100644 --- a/src/Hl7.Fhir.Base/ElementModel/SourceNodeComparator.cs +++ b/src/Hl7.Fhir.Base/ElementModel/SourceNodeComparator.cs @@ -17,7 +17,7 @@ public static TreeComparisonResult IsEqualTo(this ISourceNode expected, ISourceN if (expected.Name != actual.Name) return TreeComparisonResult.Fail(actual.Location, $"name: was '{actual.Name}', expected '{expected.Name}'"); if (expected.Text != actual.Text) return TreeComparisonResult.Fail(actual.Location, $"value: was '{actual.Text}', expected '{expected.Text}'"); - if (expected.Location != actual.Location) TreeComparisonResult.Fail(actual.Location, $"Path: was '{actual.Location}', expected '{expected.Location}'"); + if (expected.Location != actual.Location) return TreeComparisonResult.Fail(actual.Location, $"Path: was '{actual.Location}', expected '{expected.Location}'"); // Ignore ordering (only relevant to xml) var childrenExp = expected.Children().OrderBy(e => e.Name); diff --git a/src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs b/src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs index a9f2502a57..c827b3ee80 100644 --- a/src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs +++ b/src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs @@ -231,6 +231,29 @@ public void CompareNodesTest() result.Success.Should().BeFalse(); result.Details.Should().Be("number of children was different"); + + //change node location + node2 = SourceNode.Node("Patient", + SourceNode.Node("name", + SourceNode.Node("family", SourceNode.Valued("family", "van de Heuvel")), + SourceNode.Node("given", SourceNode.Valued("given", "Pieter")) + ), + SourceNode.Node("name") + ); + + var enumerator1 = node1.Children().GetEnumerator(); + var enumerator2 = node2.Children().GetEnumerator(); + + enumerator1.MoveNext(); + var child1 = enumerator1.Current; + enumerator2.MoveNext(); + enumerator2.MoveNext(); + var child2 = enumerator2.Current; + + result = child1.IsEqualTo(child2); + result.Success.Should().BeFalse(); + result.Details.Should().Be("Path: was 'Patient.name[1]', expected 'Patient.name[0]"); + } } From 44dcd2983945ee6e84ac06debf6e764d98031a61 Mon Sep 17 00:00:00 2001 From: mmsmits Date: Wed, 3 Jan 2024 10:56:41 +0100 Subject: [PATCH 3/5] missing quote --- src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs b/src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs index c827b3ee80..da484be55c 100644 --- a/src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs +++ b/src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs @@ -252,7 +252,7 @@ public void CompareNodesTest() result = child1.IsEqualTo(child2); result.Success.Should().BeFalse(); - result.Details.Should().Be("Path: was 'Patient.name[1]', expected 'Patient.name[0]"); + result.Details.Should().Be("Path: was 'Patient.name[1]', expected 'Patient.name[0]'"); } From b83856bb1c5fd816f78aa5e28733889bf5a66072 Mon Sep 17 00:00:00 2001 From: mmsmits Date: Wed, 3 Jan 2024 13:50:48 +0100 Subject: [PATCH 4/5] fix: do not catch FhirOperationExceptions in LocalTerminologyService --- .../Specification/Terminology/LocalTerminologyService.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Hl7.Fhir.Shims.Base/Specification/Terminology/LocalTerminologyService.cs b/src/Hl7.Fhir.Shims.Base/Specification/Terminology/LocalTerminologyService.cs index 1c177bb453..f795403cb2 100644 --- a/src/Hl7.Fhir.Shims.Base/Specification/Terminology/LocalTerminologyService.cs +++ b/src/Hl7.Fhir.Shims.Base/Specification/Terminology/LocalTerminologyService.cs @@ -132,7 +132,6 @@ private async Task getExpandedValueSet(ValueSet vs, string operation) } } catch (TerminologyServiceException e) -#pragma warning restore CS0618 { // Unprocessable entity throw new FhirOperationException( @@ -176,7 +175,7 @@ public async T.Task ValueSetValidateCode(Parameters parameters, stri else return await validateCodeVS(valueSet, validateCodeParams.Code?.Value, validateCodeParams.System?.Value, validateCodeParams.Display?.Value, validateCodeParams.Abstract?.Value).ConfigureAwait(false); } - catch (Exception e) + catch (Exception e) when (e is not FhirOperationException) { //500 internal server error throw new FhirOperationException(e.Message, (HttpStatusCode)500); From b3a89903fe2475dcd9ed067317a3e6d3d248c5e7 Mon Sep 17 00:00:00 2001 From: mmsmits Date: Wed, 3 Jan 2024 14:05:10 +0100 Subject: [PATCH 5/5] expanded unit tests to check for correct status code --- .../Source/TerminologyTests.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Hl7.Fhir.Specification.Shared.Tests/Source/TerminologyTests.cs b/src/Hl7.Fhir.Specification.Shared.Tests/Source/TerminologyTests.cs index 2f98a04510..4332980deb 100644 --- a/src/Hl7.Fhir.Specification.Shared.Tests/Source/TerminologyTests.cs +++ b/src/Hl7.Fhir.Specification.Shared.Tests/Source/TerminologyTests.cs @@ -312,8 +312,8 @@ public async void LocalTermServiceValidateCodeWithParamsTest() inParams = new ValidateCodeParameters() .WithValueSet(url: "http://hl7.org/fhir/ValueSet/substance-code") .WithCode(code: "1166006", system: "http://snomed.info/sct"); - await Assert.ThrowsAsync(async () => await svc.ValueSetValidateCode(inParams)); - + var exception = await Assert.ThrowsAsync(async () => await svc.ValueSetValidateCode(inParams)); + Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status); } [Fact] @@ -332,8 +332,8 @@ public async T.Task LocalTermServiceValidateCodeWithoutSystemOrContext() } }; - await Assert.ThrowsAsync(async () => await svc.ValueSetValidateCode(inParams)); - + var exception = await Assert.ThrowsAsync(async () => await svc.ValueSetValidateCode(inParams)); + Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status); } @@ -363,7 +363,8 @@ public async T.Task LocalTermServiceUsingDuplicateParameters() } }; - await Assert.ThrowsAsync(async () => await svc.ValueSetValidateCode(inParams)); + var exception = await Assert.ThrowsAsync(async () => await svc.ValueSetValidateCode(inParams)); + Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status); } [Fact]