Beispiel #1
0
        private object ResolveCodeValue(Relationship relationship, string attributeValue, VersionNumber version, bool isR2)
        {
            Type   returnType = (Type)DomainTypeHelper.GetReturnType(relationship, version, CodeTypeRegistry.GetInstance());
            Code   codeLookup = CodeResolverRegistry.Lookup(returnType, attributeValue);
            object result     = codeLookup;

            if (isR2)
            {
                result = CodedTypeR2Helper.ConvertCodedTypeR2(new CodedTypeR2 <Code>(codeLookup), returnType);
            }
            return(result);
        }
Beispiel #2
0
        public virtual void TestConvertCodedTypeR2ToSpecificTypeNonCodeTypeArgument()
        {
            CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>();

            codedType.Code = Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.CUP;

            object convertedValue = CodedTypeR2Helper.ConvertCodedTypeR2(codedType, typeof(string));

            Assert.IsTrue(convertedValue is CodedTypeR2 <Code>);

            CodedTypeR2 <Code> actualValue = (CodedTypeR2 <Code>)convertedValue;

            Assert.AreEqual(codedType.Code, actualValue.Code);
        }
Beispiel #3
0
        public virtual void TestConvertCodedTypeR2ToSpecificType()
        {
            CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>();

            codedType.Code                         = Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.CUP;
            codedType.CodeSystemName               = "code system";
            codedType.CodeSystemVersion            = "version";
            codedType.DisplayName                  = "display name";
            codedType.NullFlavorForTranslationOnly = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.ASKED_BUT_UNKNOWN;
            codedType.OriginalText                 = new EncapsulatedData("original text");
            IList <CodeRole> qualifier = new List <CodeRole>();

            qualifier.Add(new CodeRole());
            codedType.Qualifier = qualifier;
            IList <CodedTypeR2 <Code> > translation = new List <CodedTypeR2 <Code> >();

            translation.Add(new CodedTypeR2 <Code>());
            codedType.Translation = translation;
            codedType.SimpleValue = "simple value";
            codedType.Operator    = SetOperator.CONVEX_HULL;
            codedType.Value       = new BigDecimal("5");
            codedType.ValidTime   = new Interval <PlatformDate>(new PlatformDate(), SetOperator.CONVEX_HULL);
            codedType.Qty         = 32;

            object convertedValue = CodedTypeR2Helper.ConvertCodedTypeR2(codedType, typeof(UnitsOfMeasureCaseSensitive));

            Assert.IsTrue(convertedValue is CodedTypeR2 <UnitsOfMeasureCaseSensitive>);

            CodedTypeR2 <UnitsOfMeasureCaseSensitive> actualValue = (CodedTypeR2 <UnitsOfMeasureCaseSensitive>)convertedValue;

            Assert.AreEqual(codedType.Code, actualValue.Code);
            Assert.AreEqual(codedType.CodeSystemName, actualValue.CodeSystemName);
            Assert.AreEqual(codedType.CodeSystemVersion, actualValue.CodeSystemVersion);
            Assert.AreEqual(codedType.DisplayName, actualValue.DisplayName);
            Assert.AreEqual(codedType.NullFlavorForTranslationOnly, actualValue.NullFlavorForTranslationOnly);
            Assert.AreEqual(codedType.OriginalText, actualValue.OriginalText);
            Assert.AreEqual(codedType.Qualifier, actualValue.Qualifier);
            Assert.AreEqual(codedType.Translation, actualValue.Translation);
            Assert.AreEqual(codedType.SimpleValue, actualValue.SimpleValue);
            Assert.AreEqual(codedType.Operator, actualValue.Operator);
            Assert.AreEqual(codedType.Value, actualValue.Value);
            Assert.AreEqual(codedType.ValidTime, actualValue.ValidTime);
            Assert.AreEqual(codedType.Qty, actualValue.Qty);
        }
Beispiel #4
0
 public virtual void TestConvertCodedTypeR2ToSpecificTypeNullArgument()
 {
     Assert.IsNull(CodedTypeR2Helper.ConvertCodedTypeR2(null, typeof(UnitsOfMeasureCaseSensitive)));
 }
Beispiel #5
0
 public virtual void TestConvertCodedTypeR2FromSpecificTypeNullArgument()
 {
     Assert.IsNull(CodedTypeR2Helper.ConvertCodedTypeR2(null));
 }