Skip to content

Commit

Permalink
Merge pull request #2722 from FirelyTeam/feature/2662-json-duplicate-…
Browse files Browse the repository at this point in the history
…choice-types

#2662 duplicate choice type entries
  • Loading branch information
mmsmits authored Feb 20, 2024
2 parents aaad00c + 08b7175 commit bc1f5f8
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,34 @@ public void TestDuplicateProperties(string testJson, string[] expectedErrs)
assertErrors(dfe.Exceptions, expectedErrs);
}
}

[TestMethod]
public void TestDuplicateChoiceTypeEntries()
{
var scenario = """
{
"resourceType": "Patient",
"deceasedBoolean": true,
"deceasedDateTime": "2022"
}
""";

string expected = ERR.DUPLICATE_PROPERTY_CODE;

var jsonSerializerOptions = new JsonSerializerOptions().ForFhir(typeof(TestPatient).Assembly);

try
{
_ = JsonSerializer.Deserialize<TestPatient>(scenario, jsonSerializerOptions);
Assert.Fail("Should have encountered errors.");
}
catch (DeserializationFailedException dfe)
{
assertErrors(dfe.Exceptions, [expected]);
}


}
}
}
#nullable restore

0 comments on commit bc1f5f8

Please sign in to comment.