Exemplo n.º 1
0
 public DoctorController(DrugstoreDbContext context,
                         UserManager <SystemUser> userManager,
                         GetPrescriptionsListUseCase getPrescriptions,
                         GetPrescriptionDetailsUseCase getPrescriptionDetails,
                         GetPrescriptionUseCase getPrescription,
                         GetMedicinesUseCase getMedicines,
                         GetPatientsUseCase getPatients,
                         DeletePrescriptionUseCase deletePrescription,
                         GetTreatmentHistoryUseCase getTreatmentHistory,
                         GetPrescriptionMedicinesUseCase getPrescriptionMedicines,
                         EditPrescriptionUseCase editPrescription,
                         AddPrescriptionUseCase addPrescription)
 {
     this.context                  = context;
     this.userManager              = userManager;
     this.getPrescription          = getPrescription;
     this.getMedicines             = getMedicines;
     this.getPatients              = getPatients;
     this.deletePrescription       = deletePrescription;
     this.getTreatmentHistory      = getTreatmentHistory;
     this.getPrescriptionMedicines = getPrescriptionMedicines;
     this.editPrescription         = editPrescription;
     this.addPrescription          = addPrescription;
     getPrescriptionsList          = getPrescriptions;
     this.getPrescriptionDetails   = getPrescriptionDetails;
 }
Exemplo n.º 2
0
        public void Should_Not_Edit_Prescription_No_Meds()
        {
            // given
            var expectedResult            = false;
            var expectedPrescriptionCount = context.MedicalPrescriptions.Count();
            var loggerMock = new Mock <ILogger <EditPrescriptionUseCase> >();
            var useCase    = new EditPrescriptionUseCase(context, loggerMock.Object);
            var doctor     = context.Doctors.First();

            var meds = new MedicineViewModel [] { };
            // when
            var actualResult = useCase.Execute(meds, context.MedicalPrescriptions.First().ID, doctor.ID);

            // then
            Assert.AreEqual(expectedResult, actualResult.Succes);
        }
Exemplo n.º 3
0
        public void Should_Edit_Prescription()
        {
            // given
            var expectedResult            = true;
            var expectedPrescriptionCount = context.MedicalPrescriptions.Count();
            var loggerMock = new Mock <ILogger <EditPrescriptionUseCase> >();
            var useCase    = new EditPrescriptionUseCase(context, loggerMock.Object);
            var doctor     = context.Doctors.First();
            var onlyMed    = Map <MedicineViewModel>(context.Medicines.First());

            onlyMed.Quantity = 5;


            var meds = new MedicineViewModel [] { onlyMed };
            // when
            var actualResult = useCase.Execute(meds, context.MedicalPrescriptions.First().ID, doctor.ID);

            // then
            Assert.AreEqual(expectedResult, actualResult.Succes);
            Assert.AreEqual(expectedPrescriptionCount, context.MedicalPrescriptions.Count());
        }