示例#1
0
        public virtual void TestEverythingSpecified()
        {
            CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>();

            codedType.Code              = CeRxDomainTestValues.CENTIMETRE;
            codedType.CodeSystemName    = "aCodeSystemName";
            codedType.CodeSystemVersion = "aCodeSystemVersion";
            codedType.DisplayName       = "aDisplayName";
            codedType.SimpleValue       = "simpleValue";
            codedType.Operator          = SetOperator.CONVEX_HULL;
            codedType.Value             = BigDecimal.ONE;
            codedType.Translation.Add(new CodedTypeR2 <Code>());
            codedType.Qualifier.Add(new CodeRole());
            codedType.Value = new BigDecimal("1.234");
            EncapsulatedData originalText = new EncapsulatedData();

            originalText.Content   = "some original text";
            codedType.OriginalText = originalText;
            PQR <Code> pqr    = new PQRImpl <Code>(codedType);
            string     result = new PqrR2PropertyFormatter().Format(GetContext("name", "PQR"), pqr);

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(4, this.result.GetHl7Errors().Count);
            AssertXml("result", "<name code=\"cm\" codeSystem=\"1.2.3.4\" codeSystemName=\"aCodeSystemName\" codeSystemVersion=\"aCodeSystemVersion\" displayName=\"aDisplayName\" value=\"1.234\"><originalText>some original text</originalText></name>"
                      , StringUtils.Trim(result), true);
        }
示例#2
0
        public virtual void TestOriginalTextAndNullFlavor()
        {
            CodedTypeR2 <Code> codedType    = new CodedTypeR2 <Code>();
            EncapsulatedData   originalText = new EncapsulatedData();

            originalText.Content   = "original text allowed for PQR";
            codedType.OriginalText = originalText;
            PQR <Code> pqr = new PQRImpl <Code>(codedType);

            pqr.NullFlavor = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION;
            string result = new PqrR2PropertyFormatter().Format(GetContext("name", "PQR"), pqr);

            Assert.IsTrue(this.result.IsValid());
            AssertXml("result", "<name nullFlavor=\"NI\"><originalText>original text allowed for PQR</originalText></name>", StringUtils
                      .Trim(result), true);
        }