public void TestBuild()
        {
            var id = new ResourceIdentity("http://localhost/services/fhir/v012/Patient/3");
            var idb = ResourceIdentity.Build(new Uri("http://localhost/services/fhir/v012"), "Patient", "3");
            Assert.AreEqual("http://localhost/services/fhir/v012/Patient/3", id.ToString());
            Assert.AreEqual(id, idb);

            id = new ResourceIdentity("Patient/3");
            idb = ResourceIdentity.Build("Patient", "3");
            Assert.AreEqual("Patient/3", id.ToString());
            Assert.AreEqual(id, idb);

            id = ResourceIdentity.Build("Patient", "A100", "H2");
            Assert.AreEqual("Patient/A100/_history/H2", id.ToString());

            id = new ResourceIdentity("urn:oid:1.2.3.4.5.6");
            idb = ResourceIdentity.Build(UrnType.OID, "1.2.3.4.5.6");
            Assert.AreEqual("urn:oid:1.2.3.4.5.6", id.ToString());
            Assert.AreEqual(id, idb);

            id = new ResourceIdentity("#myid");
            idb = ResourceIdentity.Build("myid");
            Assert.AreEqual("#myid", id.ToString());
            Assert.AreEqual(id, idb);
        }
 public void TestResourceIdentity()
 {
     ResourceIdentity id = new ResourceIdentity("http://localhost/services/fhir/v012/patient/3");
     Assert.AreEqual("http://localhost/services/fhir/v012/patient/3", id.ToString());
     Assert.AreEqual("patient", id.Collection);
 }
        public void WithBase()
        {
            var id = new ResourceIdentity("http://localhost/services/fhir/v012/Patient/3");
            var id1 = id.WithBase("http://nu.nl/fhir");
            Assert.AreEqual("http://nu.nl/fhir/Patient/3", id1.ToString());

            var id2 = new ResourceIdentity("Patient/3").WithBase("http://nu.nl/fhir");
            Assert.AreEqual("http://nu.nl/fhir/Patient/3", id2.ToString());

            var id3 = id2.MakeRelative();
            Assert.AreEqual("Patient/3", id3.ToString());
        }