コード例 #1
0
        public virtual void TestGetCodeValueValidArgument()
        {
            CodedTypeR2 <UnitsOfMeasureCaseSensitive> codedType = new CodedTypeR2 <UnitsOfMeasureCaseSensitive>();

            codedType.Code = Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.CUP;
            Assert.AreEqual("[cup_us]", CodedTypeR2Helper.GetCodeValue(codedType));
        }
コード例 #2
0
        private string ValueAsString(object value, Relationship relationship)
        {
            string type = relationship.Type;

            if (type == null)
            {
                throw new MarshallingException("Relationship " + relationship.Name + " has no type information");
            }
            else
            {
                if ("CS".Equals(type))
                {
                    if (CodedTypeR2Helper.IsCodedTypeR2(value))
                    {
                        return(CodedTypeR2Helper.GetCodeValue(value));
                    }
                    else
                    {
                        if (value is Code)
                        {
                            return(((Code)value).CodeValue);
                        }
                        else
                        {
                            throw new MarshallingException("Encountered value \"" + value + "\" of type " + value.GetType().FullName + " when Code was expected ("
                                                           + relationship.Name + ")");
                        }
                    }
                }
                else
                {
                    if ("BL".Equals(type))
                    {
                        return(true.Equals(value) ? "true" : "false");
                    }
                    else
                    {
                        if ("ST".Equals(type))
                        {
                            return((string)value);
                        }
                        else
                        {
                            throw new MarshallingException("Cannot handle structural attribute string of type " + type + " (" + relationship.Name + ")"
                                                           );
                        }
                    }
                }
            }
        }
コード例 #3
0
 public virtual void TestGetCodeValueInvalidArgument()
 {
     CodedTypeR2Helper.GetCodeValue(new CD_R2Impl <Code>());
 }