Пример #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 TestNullFlavor()
        {
            string result = new PqrR2PropertyFormatter().Format(GetContext("name", "PQR"), new PQRImpl <Code>(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor
                                                                                                              .NO_INFORMATION));

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual("<name nullFlavor=\"NI\"/>", StringUtils.Trim(result), "result");
        }
Пример #3
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);
        }
Пример #4
0
        public virtual void TestValidFull()
        {
            CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>();

            codedType.Code              = CeRxDomainTestValues.CENTIMETRE;
            codedType.CodeSystemName    = "aCodeSystemName";
            codedType.CodeSystemVersion = "aCodeSystemVersion";
            codedType.DisplayName       = "aDisplayName";
            codedType.Value             = new BigDecimal("1.234");
            EncapsulatedData originalText = new EncapsulatedData();

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

            Assert.IsTrue(this.result.IsValid());
            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);
        }