Пример #1
0
        public void PostBundleAgain()
        {
            var bundle  = DemoData.GetDemoXdsBundle();
            var trans   = client.Transaction(bundle);
            var entries = trans.Entries.ToList();

            HttpTests.AssertEntryIdsArePresentAndAbsoluteUrls(trans);

            // If server honors the 'search' link, it might *not* re-create the patient
            if (entries[0].Id == connDoc.Id || entries[4].Id == binDoc.Id)  // etcetera
            {
                TestResult.Fail("submitting a bundle with identical cids should still create new resources");
            }

            //TODO: verify server honors the 'search' link
        }
Пример #2
0
        public void PostBundle()
        {
            var bundle = DemoData.GetDemoXdsBundle();

            postResult = client.Transaction(bundle);
            HttpTests.AssertEntryIdsArePresentAndAbsoluteUrls(postResult);
            if (postResult.Entries.Count != 5)
            {
                TestResult.Fail(String.Format("Bundle response contained {0} entries in stead of 5", postResult.Entries.Count));
            }

            postResult = client.RefreshBundle(postResult);
            HttpTests.AssertEntryIdsArePresentAndAbsoluteUrls(postResult);
            var entries = postResult.Entries.ToList();

            connDoc = entries[0];

            if (new ResourceIdentity(connDoc.Id).Id == null)
            {
                TestResult.Fail("failed to assign id to new xds document");
            }
            if (new ResourceIdentity(connDoc.SelfLink).VersionId == null)
            {
                TestResult.Fail("failed to assign a version id to new xds document");
            }

            patDoc = entries[1];
            if (new ResourceIdentity(patDoc.Id) == null)
            {
                TestResult.Fail("failed to assign id to new patient");
            }

            prac1Doc = entries[2];
            if (new ResourceIdentity(prac1Doc.Id).Id == null)
            {
                TestResult.Fail("failed to assign id to new practitioner (#1)");
            }
            if (new ResourceIdentity(prac1Doc.SelfLink).VersionId == null)
            {
                TestResult.Fail("failed to assign a version id to new practitioner (#1)");
            }

            prac2Doc = entries[3];
            if (new ResourceIdentity(prac2Doc.Id).Id == null)
            {
                TestResult.Fail("failed to assign id to new practitioner (#2)");
            }
            if (new ResourceIdentity(prac2Doc.SelfLink).VersionId == null)
            {
                TestResult.Fail("failed to assign a version id to new practitioner (#2)");
            }

            binDoc = entries[4];
            if (new ResourceIdentity(binDoc.Id).Id == null)
            {
                TestResult.Fail("failed to assign id to new binary");
            }
            if (new ResourceIdentity(binDoc.SelfLink).VersionId == null)
            {
                TestResult.Fail("failed to assign a version id to new binary");
            }

            var docResource = ((ResourceEntry <DocumentReference>)connDoc).Resource;

            if (!prac1Doc.Id.ToString().Contains(docResource.Author[0].Reference))
            {
                TestResult.Fail("doc reference's author[0] does not reference newly created practitioner #1");
            }
            if (!prac2Doc.Id.ToString().Contains(docResource.Author[1].Reference))
            {
                TestResult.Fail("doc reference's author[1] does not reference newly created practitioner #2");
            }

            var binRl = new ResourceIdentity(binDoc.Id);

            if (!docResource.Text.Div.Contains(binRl.OperationPath.ToString()))
            {
                TestResult.Fail("href in narrative was not fixed to point to newly created binary");
            }
        }