public void TheListOfAllergyIntolerancesShouldBeValid() { Lists.ForEach(list => { AccessRecordSteps.BaseListParametersAreValid(list); // Added 1.2.1 RMB 1/10/2018 list.Meta.VersionId.ShouldBeNull("List Meta VersionId should be Null"); list.Meta.LastUpdated.ShouldBeNull("List Meta LastUpdated should be Null"); //Alergy specific checks CheckForValidMetaDataInResource(list, FhirConst.StructureDefinitionSystems.kList); if (list.Title.Equals(FhirConst.ListTitles.kActiveAllergies)) { list.Code.Coding.First().Code.Equals("886921000000105"); } else if (list.Title.Equals(FhirConst.ListTitles.kResolvedAllergies)) { // Changed from TBD to 1103671000000101 for 1.2.0 RMB 7/8/2018 list.Code.Coding.First().Code.Equals("1103671000000101"); // Amended github ref 89 // RMB 9/10/2018 // git hub ref 174 snomed code display set to Ended allergies // RMB 23/1/19 // list.Code.Coding.First().Display.ShouldBe("Ended allergies (record artifact)"); list.Code.Coding.First().Display.ShouldBe("Ended allergies"); } if (list.Entry.Count > 0) { list.Entry.ForEach(entry => { entry.Item.ShouldNotBeNull("The item field must be populated for each list entry."); entry.Item.Reference.ShouldMatch("AllergyIntolerance/.+|#.+"); if (entry.Item.IsContainedReference) { string id = entry.Item.Reference.Substring(1); List <Resource> contained = list.Contained.Where(allergy => allergy.Id.Equals(id)).ToList(); contained.Count.ShouldBe(1); contained.ForEach(allergy => { AllergyIntolerance allergyIntolerance = (AllergyIntolerance)allergy; allergyIntolerance.ClinicalStatus.Equals(AllergyIntolerance.AllergyIntoleranceClinicalStatus.Resolved); }); } }); } if (list.Entry.Count == 0) { list.EmptyReason.ShouldNotBeNull("The List's empty reason field must be populated if the list is empty."); list.Note.ShouldNotBeNull("The List's note field must be populated if the list is empty."); } }); }
public void TheListOfMedicationStatementsShouldBeValid() { Lists.ShouldHaveSingleItem("The medications data must contain a single list."); Lists.ForEach(list => { AccessRecordSteps.BaseListParametersAreValid(list); // Added 1.2.1 RMB 1/10/2018 list.Meta.VersionId.ShouldBeNull(); list.Meta.LastUpdated.ShouldBeNull(); //Medication specific checks CheckForValidMetaDataInResource(list, FhirConst.StructureDefinitionSystems.kList); MedicationStatements.Count().Equals(list.Entry.Count()); list.Title.Equals(FhirConst.ListTitles.kMedications); list.Code.Equals("933361000000108"); if (list.Entry.Count.Equals(0)) { list.EmptyReason.ShouldNotBeNull("The List's empty reason field must be populated if the list is empty."); // list.EmptyReason.Text.Equals("noContent"); // Added github ref 87 // RMB 9/10/2018 // if (list.EmptyReason.Coding.Count.Equals(1)) { list.EmptyReason.Coding.First().Code.ShouldBe("no-content-recorded"); list.EmptyReason.Coding.First().Display.ShouldBe("No content recorded"); } list.Note.ShouldNotBeNull("The List's note field must be populated if the list is empty."); // Added git hub ref 88 // RMB 9/10/2018 list.Note.First().Text.ShouldBe("Information not available"); } else { list.Entry.ForEach(entry => { entry.Item.ShouldNotBeNull("The item field must be populated for each list entry."); entry.Item.Reference.ShouldStartWith("MedicationStatement"); }); } }); }