public void CreateMedication_GivenValidArguments_Succeeds() { var mediationRepository = new Mock<IMedicationRepository> (); var medicationFactory = new MedicationFactory ( mediationRepository.Object ); var patient = new Mock<Patient> (); var medicationCode = new CodedConceptBuilder().WithCodedConceptCode("TheCode"); var medication = medicationFactory.CreateMedication ( patient.Object, medicationCode, medicationCode ); Assert.IsNotNull ( medication ); }
public void CreateMedication_GivenValidArguments_MedicationIsEditable() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup var mediationRepository = new Mock<IMedicationRepository>(); var medicationFactory = new MedicationFactory( mediationRepository.Object); var patient = new Mock<Patient>(); var medicationCode = new CodedConceptBuilder().WithCodedConceptCode("TheCode"); var medication = medicationFactory.CreateMedication(patient.Object, medicationCode, medicationCode); medication.ReviseInstructionsNote ( "some instruction" ); } }
public void CreateMedication_GivenValidArguments_MedicationMadePersistent() { var isPersistent = false; var mediationRepository = new Mock<IMedicationRepository> (); mediationRepository .Setup ( m => m.MakePersistent ( It.IsAny<Medication> () ) ) .Callback ( () => isPersistent = true ); var medicationFactory = new MedicationFactory ( mediationRepository.Object ); var patient = new Mock<Patient> (); var medicationCode = new CodedConceptBuilder().WithCodedConceptCode("TheCode"); medicationFactory.CreateMedication ( patient.Object, medicationCode, medicationCode ); Assert.IsTrue ( isPersistent ); }
private Allergy CreateAllergyByAllergyFactory() { var allergyRepository = new Mock<IAllergyRepository> (); var allergyFactory = new AllergyFactory ( allergyRepository.Object ); var patient = new Mock<Patient> (); var allergyStatus = new Mock<AllergyStatus> (); var allergen = new CodedConceptBuilder().WithCodedConceptCode("TheCode"); var allergy = allergyFactory.CreateAllergy ( patient.Object, allergyStatus.Object, allergen ); return allergy; }