本文整理汇总了C#中FhirClient.CreateAsync方法的典型用法代码示例。如果您正苦于以下问题:C# FhirClient.CreateAsync方法的具体用法?C# FhirClient.CreateAsync怎么用?C# FhirClient.CreateAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FhirClient
的用法示例。
在下文中一共展示了FhirClient.CreateAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEditDeleteAsync
public void CreateEditDeleteAsync()
{
var furore = new Organization
{
Name = "Furore",
Identifier = new List<Identifier> { new Identifier("http://hl7.org/test/1", "3141") },
Telecom = new List<Contact> { new Contact { System = Contact.ContactSystem.Phone, Value = "+31-20-3467171" } }
};
FhirClient client = new FhirClient(testEndpoint);
var tags = new List<Tag> { new Tag("http://nu.nl/testname", Tag.FHIRTAGSCHEME_GENERAL, "TestCreateEditDelete") };
var fe = client.CreateAsync<Organization>(furore, tags: tags, refresh: true).Result;
Assert.IsNotNull(furore);
Assert.IsNotNull(fe);
Assert.IsNotNull(fe.Id);
Assert.IsNotNull(fe.SelfLink);
Assert.AreNotEqual(fe.Id, fe.SelfLink);
Assert.IsNotNull(fe.Tags);
Assert.AreEqual(1, fe.Tags.Count(), "Tag count on new organization record don't match");
Assert.AreEqual(fe.Tags.First(), tags[0]);
createdTestOrganizationUrl = fe.Id;
fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
var fe2 = client.UpdateAsync(fe, refresh: true).Result;
Assert.IsNotNull(fe2);
Assert.AreEqual(fe.Id, fe2.Id);
Assert.AreNotEqual(fe.SelfLink, fe2.SelfLink);
Assert.AreEqual(2, fe2.Resource.Identifier.Count);
Assert.IsNotNull(fe2.Tags);
Assert.AreEqual(1, fe2.Tags.Count(), "Tag count on updated organization record don't match");
Assert.AreEqual(fe2.Tags.First(), tags[0]);
fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
var fe3 = client.UpdateAsync(fe2.Id, fe.Resource, refresh: true).Result;
Assert.IsNotNull(fe3);
Assert.AreEqual(3, fe3.Resource.Identifier.Count);
client.DeleteAsync(fe3).Wait();
try
{
// Get most recent version
fe = client.ReadAsync<Organization>(new ResourceIdentity(fe.Id)).Result;
Assert.Fail();
}
catch
{
Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.Gone);
}
}