protected void Validate(CCodePhrase cCodePhrase) { this.Validate((CDomainType)cCodePhrase); Invariant(cCodePhrase.CodeList == null || (!cCodePhrase.CodeList.IsEmpty() && cCodePhrase.TerminologyId != null), "cCodePhrase.CodeList is not null, implies it must not be empty and terminologyId must not be null."); Invariant(cCodePhrase.AnyAllowed() ^ cCodePhrase.TerminologyId != null, "cCodePhrase.AnyAllowed xor cCodePhrase.TerminologyId must not be null."); }
internal static CObject CObject(string typeName) { DesignByContract.Check.Require(!string.IsNullOrEmpty(typeName), string.Format(CommonStrings.XMustNotBeNullOrEmpty, "typeName")); CObject cObject = null; switch (typeName) { case "C_COMPLEX_OBJECT": cObject = new CComplexObject(); break; case "C_PRIMITIVE_OBJECT": cObject = new CPrimitiveObject(); break; case "ARCHETYPE_INTERNAL_REF": cObject = new ArchetypeInternalRef(); break; case "CONSTRAINT_REF": cObject = new ConstraintRef(); break; case "ARCHETYPE_SLOT": cObject = new ArchetypeSlot(); break; case "C_CODE_PHRASE": cObject = new CCodePhrase(); break; case "C_DV_STATE": cObject = new CDvState(); break; case "C_DV_ORDINAL": cObject = new CDvOrdinal(); break; case "C_DV_QUANTITY": cObject = new CDvQuantity(); break; default: throw new NotSupportedException("type not supported: " + typeName); } DesignByContract.Check.Ensure(cObject != null, "cObject must not be null."); return(cObject); }
public void TestMethod1() { string adl = System.IO.File.ReadAllText(@"..\..\..\..\java-libs\adl-parser\src\test\resources\adl-test-composition.dv_coded_text.test.adl"); se.acode.openehr.parser.ADLParser parser = new se.acode.openehr.parser.ADLParser(adl); org.openehr.am.archetype.Archetype archetype = parser.parse(); Assert.IsNotNull(archetype); org.openehr.am.archetype.constraintmodel.ArchetypeConstraint node = archetype.node("/category/defining_code"); //assertTrue("CCodePhrase expected, but got " + node.getClass(), // node instanceof CCodePhrase); Assert.IsInstanceOfType(node, typeof(CCodePhrase)); CCodePhrase ccp = (CCodePhrase)node; Assert.AreEqual(ccp.getTerminologyId().toString(), "openehr", "terminologyId wrong"); Assert.AreEqual(ccp.getCodeList().get(0), "431", "codeString wrong"); }
private static CCodePhrase Map(this C_CODE_PHRASE model) { var codePhrase = new CCodePhrase { Occurences = model.occurrences.Map(), NodeId = model.node_id, TerminologyId = new TerminologyId(model.terminology_id.value), ReferenceModelTypeName = model.rm_type_name }; if (model.code_list != null) { foreach (string item in model.code_list) { codePhrase.CodeList.Add(item); } } return(codePhrase); }
public void ListsAreNotNull() { var instance = new CCodePhrase(); Assert.IsNotNull(instance.CodeList); }
public void IsValidValueThrowsException() { var instance = new CCodePhrase(); var result = instance.IsValidValue(null); }
public void IsSubsetOfThrowsException() { var instance = new CCodePhrase(); var result = instance.IsSubsetOf(null); }
public void DefaultValueThrowsException() { var instance = new CCodePhrase(); var result = instance.DefaultValue(); }