public void Test_Init() { FHIRbase = new FHIRbaseApi(); CommonPatient = (Patient) FhirParser.ParseFromJson(File.ReadAllText("Examples/common_patient.json")); SimplePatient = new Patient(); SimplePatient.Name.Add(HumanName.ForFamily("Hello").WithGiven("World")); SimplePatient.Telecom.Add(new ContactPoint { System = ContactPoint.ContactPointSystem.Phone, Use = ContactPoint.ContactPointUse.Mobile, Value = "123456789" }); RemovedPatient = FHIRbase.Search("Patient"); foreach (var entryComponent in RemovedPatient.Entry) FHIRbase.Delete(entryComponent.Resource); SearchPatients = new List<Patient> { (Patient) FHIRbase.Create(SimplePatient), (Patient) FHIRbase.Create(SimplePatient), (Patient) FHIRbase.Create(SimplePatient), (Patient) FHIRbase.Create(CommonPatient), (Patient) FHIRbase.Create(CommonPatient), (Patient) FHIRbase.Create(CommonPatient), (Patient) FHIRbase.Create(CommonPatient) }; }
static void ClearTable <T>() where T : Resource, new() { Console.WriteLine("Deleting {0}", typeof(T)); var api = new Fhirbase.Net.Api.FHIRbaseApi(); var type = new T().ResourceType.ToString(); while (true) { var response = api.Search(type, new SearchParameters()); if (!response.Entry.Any()) { break; } foreach (var component in response.Entry) { api.Delete(component.Resource); } } }
public void Init() { FHIRbase = new FHIRbaseApi(); }