Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/nuget/xunit.runner.visualstudi…
Browse files Browse the repository at this point in the history
…o-2.5.6
  • Loading branch information
mmsmits authored Jan 5, 2024
2 parents b1d7e8c + 4fa8588 commit 302fba2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Hl7.Fhir.Base/ElementModel/SourceNodeComparator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
23 changes: 23 additions & 0 deletions src/Hl7.Fhir.ElementModel.Shared.Tests/SourceNodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]'");

}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ private async Task<ValueSet> getExpandedValueSet(ValueSet vs, string operation)
}
}
catch (TerminologyServiceException e)
#pragma warning restore CS0618
{
// Unprocessable entity
throw new FhirOperationException(
Expand Down Expand Up @@ -176,7 +175,7 @@ public async T.Task<Parameters> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));

var exception = await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));
Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status);
}

[Fact]
Expand All @@ -332,8 +332,8 @@ public async T.Task LocalTermServiceValidateCodeWithoutSystemOrContext()
}
};

await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));

var exception = await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));
Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status);
}


Expand Down Expand Up @@ -363,7 +363,8 @@ public async T.Task LocalTermServiceUsingDuplicateParameters()
}
};

await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));
var exception = await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));
Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status);
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/firely-net-sdk-tests.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit 302fba2

Please sign in to comment.