protected void Validate(CDuration cDuration) { Invariant(cDuration.Range != null || (cDuration.YearsAllowed || cDuration.MonthsAllowed || cDuration.WeeksAllowed || cDuration.DaysAllowed || cDuration.HoursAllowed || cDuration.MinutesAllowed || cDuration.SecondsAllowed || cDuration.FractionalSecondsAllowed), "cDuration range is null, implies years_allowed or months_allowed or " + "weeks_allowed or days_allowed or hours_allowed or minutes_allowed or " + "seconds_allowed or fractional_seconds_allowed"); }
private static CDuration Map(this C_DURATION model) { var primitive = new CDuration { AssumedValue = new Duration(model.assumed_value), Pattern = model.pattern }; if (model.range != null) { primitive.Range = model.range.Map(); } return(primitive); }
internal static OpenEhr.AM.Archetype.ConstraintModel.Primitive.CPrimitive CPrimitive(string typeName) { DesignByContract.Check.Require(!string.IsNullOrEmpty(typeName), string.Format(CommonStrings.XMustNotBeNullOrEmpty, "typeName")); OpenEhr.AM.Archetype.ConstraintModel.Primitive.CPrimitive cPrimitive = null; switch (typeName) { case "C_BOOLEAN": cPrimitive = new CBoolean(); break; case "C_DATE": cPrimitive = new CDate(); break; case "C_DATE_TIME": cPrimitive = new CDateTime(); break; case "C_DURATION": cPrimitive = new CDuration(); break; case "C_TIME": cPrimitive = new CTime(); break; case "C_INTEGER": cPrimitive = new CInteger(); break; case "C_REAL": cPrimitive = new CReal(); break; case "C_STRING": cPrimitive = new CString(); break; default: throw new NotSupportedException("type not supported: " + typeName); } DesignByContract.Check.Ensure(cPrimitive != null, "cObject must not be null."); return(cPrimitive); }
public void IsValidValueThrowsException() { var instance = new CDuration(); instance.IsValidValue(null); }