Skip to content

Commit ac0c22b

Browse files
authored
Merge branch 'develop' into bugfix/2792-excluding-parent-property-shouldn't-exclude-children
2 parents d748cc7 + c150395 commit ac0c22b

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

src/Hl7.Fhir.Base/Model/Generated/Binary.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ public Hl7.Fhir.Model.ResourceReference SecurityContext
116116
/// </summary>
117117
[FhirElement("content", Order=70)]
118118
[NotMapped(Since=FhirRelease.R4)]
119-
[Cardinality(Min=1,Max=1)]
120119
[DataMember]
121120
public Hl7.Fhir.Model.Base64Binary ContentElement
122121
{

src/Hl7.Fhir.Shared.Tests/Validation/ValidationTests.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* available at https://raw.githubusercontent.com/FirelyTeam/firely-net-sdk/master/LICENSE
77
*/
88

9+
using FluentAssertions;
910
using Hl7.Fhir.Model;
1011
using Hl7.Fhir.Validation;
1112
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -232,5 +233,38 @@ public void TestXhtmlValidation()
232233
validateErrorOrFail(p, true);
233234
}
234235
#endif
236+
237+
[TestMethod]
238+
public void TestBinaryContentCardinalityValidation()
239+
{
240+
var bin = new Binary
241+
{
242+
ContentType = "text/plain",
243+
Content = [0, 1, 2, 3],
244+
Data = [0, 1, 2, 3]
245+
};
246+
247+
var validation = () => DotNetAttributeValidation.Validate(bin);
248+
validation.Should().NotThrow<ValidationException>();
249+
250+
251+
//We removed the cardinality validation for the Content property for issue #2821
252+
bin = new Binary
253+
{
254+
ContentType = "text/plain",
255+
Data = [0, 1, 2, 3]
256+
};
257+
258+
validation = () => DotNetAttributeValidation.Validate(bin);
259+
validation.Should().NotThrow<ValidationException>();
260+
261+
bin = new Binary
262+
{
263+
Data = [0, 1, 2, 3]
264+
};
265+
266+
validation = () => DotNetAttributeValidation.Validate(bin);
267+
validation.Should().Throw<ValidationException>();
268+
}
235269
}
236270
}

src/Hl7.Fhir.Specification.STU3.Tests/StructureDefinitionSummaryProviderTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ private static void areEqual(IElementDefinitionSummary left, IElementDefinitionS
124124
left.IsModifier.Should().Be(right.IsModifier, context + ": IsModifier differs");
125125
left.IsChoiceElement.Should().Be(right.IsChoiceElement, context + ": IsChoiceElement differs");
126126
left.IsCollection.Should().Be(right.IsCollection, context + ": IsCollection differs");
127-
left.IsRequired.Should().Be(right.IsRequired, context + ": IsRequired differs");
127+
128+
if (context != "Binary.content") //because of issue #2821
129+
left.IsRequired.Should().Be(right.IsRequired, context + ": IsRequired differs");
130+
128131
left.IsResource.Should().Be(right.IsResource, context + ": IsResource differs");
129132
// left.Order.Should().Be(right.Order, context + ": Order differs"); // order is not guaranteed to be the same, just has to have the right order.
130133
left.Representation.Should().Be(right.Representation, context + ": Representation differs");

src/Hl7.Fhir.Specification.Shared.Tests/StructureDefinitionSummaryProviderTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ private static void areEqual(IElementDefinitionSummary left, IElementDefinitionS
134134
left.IsModifier.Should().Be(right.IsModifier, context + ": IsModifier differs");
135135
left.IsChoiceElement.Should().Be(right.IsChoiceElement, context + ": IsChoiceElement differs");
136136
left.IsCollection.Should().Be(right.IsCollection, context + ": IsCollection differs");
137-
left.IsRequired.Should().Be(right.IsRequired, context + ": IsRequired differs");
137+
138+
if (context != "Binary.content") //because of issue #2821
139+
left.IsRequired.Should().Be(right.IsRequired, context + ": IsRequired differs");
140+
138141
left.IsResource.Should().Be(right.IsResource, context + ": IsResource differs");
139142
// left.Order.Should().Be(right.Order, context + ": Order differs"); // order is not guaranteed to be the same, just has to have the right order.
140143
left.Representation.Should().Be(right.Representation, context + ": Representation differs");

0 commit comments

Comments
 (0)