Skip to content

Commit

Permalink
Now remove the hack again.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewoutkramer committed Feb 1, 2024
1 parent 3ce827d commit 6116a0f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Hl7.Fhir.Base/Introspection/ModelInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ private void extractBackbonesFromClasses(IEnumerable<Type> classTypes)

public Type? GetTypeForFhirType(string name) => FindClassMapping(name) is { } mapping ? mapping.NativeType : null;

public bool IsBindable(string type) => FindClassMapping(type) is { } mapping && mapping.IsBindable ||
type == "CodeableReference";
public bool IsBindable(string type) => FindClassMapping(type) is { } mapping && mapping.IsBindable;

public bool IsConformanceResource(string name) => GetTypeForFhirType(name) is { } type && IsConformanceResource(type);

Expand Down
13 changes: 13 additions & 0 deletions src/Hl7.Fhir.Support.Tests/Introspection/ModelInspectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* available at https://raw.githubusercontent.com/FirelyTeam/firely-net-sdk/master/LICENSE
*/

using FluentAssertions;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Hl7.Fhir.Model;
Expand Down Expand Up @@ -37,6 +38,18 @@ public void TestResourceNameResolving()
Assert.IsNull(noway);
}

[TestMethod]
public void TestIsBindable()
{
ModelInspector.Base.IsBindable("string").Should().BeTrue();
ModelInspector.Base.IsBindable("uri").Should().BeTrue();
ModelInspector.Base.IsBindable("Quantity").Should().BeTrue();
ModelInspector.Base.IsBindable("Extension").Should().BeTrue();
ModelInspector.Base.IsBindable("Coding").Should().BeTrue();
ModelInspector.Base.IsBindable("CodeableConcept").Should().BeTrue();
ModelInspector.Base.IsBindable("CodeableReference").Should().BeTrue();
ModelInspector.Base.IsBindable("integer").Should().BeFalse();
}

[TestMethod]
public void TestAssemblyInspection()
Expand Down

0 comments on commit 6116a0f

Please sign in to comment.