Example #1
0
 public InternalPharmacistController(
     DrugstoreDbContext context,
     GetUnverifiedPrescriptionsUseCase getUnverifiedPrescriptions,
     GetPrescriptionUseCase getPrescription,
     AcceptPrescriptionUseCase acceptPrescription,
     RejectPrescriptionUseCase rejectPrescription)
 {
     this.context = context;
     this.getUnverifiedPrescriptions = getUnverifiedPrescriptions;
     this.getPrescription            = getPrescription;
     this.acceptPrescription         = acceptPrescription;
     this.rejectPrescription         = rejectPrescription;
 }
        public void Should_Accept_Prescription()
        {
            // given
            var loggerMock   = new Mock <ILogger <AcceptPrescriptionUseCase> >();
            var useCase      = new AcceptPrescriptionUseCase(context, loggerMock.Object);
            var prescription = context.MedicalPrescriptions.First();


            // when
            var actualResult = useCase.Execute(prescription.ID);

            // then
            Assert.AreEqual(actualResult.Succes, true);
            Assert.AreEqual(prescription.VerificationState, VerificationState.Accepted);
        }
        public void Should_Not_Accept_Prescription()
        {
            // given
            var loggerMock   = new Mock <ILogger <AcceptPrescriptionUseCase> >();
            var useCase      = new AcceptPrescriptionUseCase(context, loggerMock.Object);
            var prescription = context.MedicalPrescriptions.First();

            prescription.Medicines.First().AssignedQuantity = 1000;

            // when
            var actualResult = useCase.Execute(prescription.ID);

            // then
            Assert.AreEqual(actualResult.Succes, false);
            Assert.AreEqual(prescription.VerificationState, VerificationState.NotVerified);
        }