public void Read() { FhirClient client = new FhirClient(testEndpoint); var loc = client.Read<Location>("1"); Assert.IsNotNull(loc); Assert.AreEqual("Den Burg", loc.Resource.Address.City); string version = new ResourceLocation(loc.SelfLink).VersionId; Assert.AreEqual("1", version); string id = new ResourceLocation(loc.Id).Id; Assert.AreEqual("1", id); try { var random = client.Read<Location>("45qq54"); Assert.Fail(); } catch (FhirOperationException) { Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.NotFound); } var loc2 = client.VRead<Location>("1", version); Assert.IsNotNull(loc2); Assert.AreEqual(FhirSerializer.SerializeBundleEntryToJson(loc), FhirSerializer.SerializeBundleEntryToJson(loc2)); var loc3 = client.Fetch<Location>(loc.SelfLink); Assert.IsNotNull(loc3); Assert.AreEqual(FhirSerializer.SerializeBundleEntryToJson(loc), FhirSerializer.SerializeBundleEntryToJson(loc3)); }
public void Read() { FhirClient client = new FhirClient(testEndpoint); var loc = client.Read <Location>("1"); Assert.IsNotNull(loc); Assert.AreEqual("Den Burg", loc.Resource.Address.City); string version = new ResourceLocation(loc.SelfLink).VersionId; Assert.AreEqual("1", version); string id = new ResourceLocation(loc.Id).Id; Assert.AreEqual("1", id); try { var random = client.Read <Location>("45qq54"); Assert.Fail(); } catch (FhirOperationException) { Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.NotFound); } var loc2 = client.VRead <Location>("1", version); Assert.IsNotNull(loc2); Assert.AreEqual(FhirSerializer.SerializeBundleEntryToJson(loc), FhirSerializer.SerializeBundleEntryToJson(loc2)); var loc3 = client.Fetch <Location>(loc.SelfLink); Assert.IsNotNull(loc3); Assert.AreEqual(FhirSerializer.SerializeBundleEntryToJson(loc), FhirSerializer.SerializeBundleEntryToJson(loc3)); }