public void TestValueValidation() { var ed = new ElementDefinition { Binding = new ElementDefinition.BindingComponent { Strength = BindingStrength.Required, ValueSet = new ResourceReference("http://hl7.org/fhir/ValueSet/data-absent-reason") } }; // Non-bindeable things should succeed Element v = new FhirBoolean(true); var nav = new PocoNavigator(v); Assert.True(_validator.ValidateBinding(ed, nav).Success); v = new Quantity(4.0m, "masked", "http://hl7.org/fhir/data-absent-reason"); // nonsense, but hey UCUM is not provided with the spec nav = new PocoNavigator(v); Assert.True(_validator.ValidateBinding(ed, nav).Success); v = new Quantity(4.0m, "maskedx", "http://hl7.org/fhir/data-absent-reason"); // nonsense, but hey UCUM is not provided with the spec nav = new PocoNavigator(v); Assert.False(_validator.ValidateBinding(ed, nav).Success); v = new Quantity(4.0m, "kg"); // sorry, UCUM is not provided with the spec - still validate against data-absent-reason nav = new PocoNavigator(v); Assert.False(_validator.ValidateBinding(ed, nav).Success); v = new FhirString("masked"); nav = new PocoNavigator(v); Assert.True(_validator.ValidateBinding(ed, nav).Success); v = new FhirString("maskedx"); nav = new PocoNavigator(v); Assert.False(_validator.ValidateBinding(ed, nav).Success); var ic = new Coding("http://hl7.org/fhir/data-absent-reason", "masked"); var ext = new Extension { Value = ic }; nav = new PocoNavigator(ext); Assert.True(_validator.ValidateBinding(ed, nav).Success); ic.Code = "maskedx"; nav = new PocoNavigator(ext); Assert.False(_validator.ValidateBinding(ed, nav).Success); }