public void CodeValue_ToString() { var codeValueDetails = codeValue.ToString(); Assert.IsNotNull(codeValueDetails); Assert.AreEqual(string.Format("[{0}] {1}", codeValue.Code, codeValue.Description), codeValueDetails); }
/// <summary> /// Get the display name for the enumeration /// </summary> private ST GetDisplayName(CodeValue <T> value) { if (value == null || !typeof(T).IsEnum) { return(null); } object[] ea = typeof(T).GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false); if (ea.Length != 0 && !string.IsNullOrEmpty((ea[0] as DescriptionAttribute).Description)) { return((ea[0] as DescriptionAttribute).Description); } return(null); }
/// <summary> /// Get code system for the specified value /// </summary> private string GetCodeSystem(CodeValue <T> value) { if (value == null || !typeof(T).IsEnum) { return(null); } object[] ea = typeof(T).GetField(value.ToString()).GetCustomAttributes(typeof(EnumerationAttribute), false), oa = typeof(T).GetCustomAttributes(typeof(StructureAttribute), false); if (ea.Length != 0 && !string.IsNullOrEmpty((ea[0] as EnumerationAttribute).SupplierDomain)) { return((ea[0] as EnumerationAttribute).SupplierDomain); } if (String.IsNullOrEmpty(this.CodeSystem) && oa.Length != 0) { return((oa[0] as StructureAttribute).CodeSystem); } return(null); }
/// <summary> /// Represent this as a string /// </summary> /// <returns></returns> public override string ToString() { return(NullFlavor != null ? "" : Code == null ? "" : Code.ToString()); }
public static void Write(CodeValue codeValue, int indentation, TextWriter wtr) { wtr.WriteLine("{0}{1} - CodeValue", Indentation(indentation), codeValue.ToString()); }