Example #1
0
        public Referral Save(Referral referral)
        {
            Context.SaveChanges();
            var r = ReferralAcceptanceService.HandleAcceptedReferral(referral);

            if (r)
            {
                PatientSearchService.UpdateEntry(referral.GeneratedPatientID.Value);
            }
            return(referral);
        }
Example #2
0
        public void Case_and_patient_are_not_created_when_referral_is_not_accepted_and_has_no_associated_case()
        {
            var random         = new Random();
            var patientId      = random.Next(1, 1000);
            var caseId         = random.Next(1, 1000);
            var mockedServices = CreateMockedServices(patientId, caseId);
            var service        = new ReferralAcceptanceService(mockedServices.ContextMock.Object);
            var referral       = new Referral()
            {
                Status          = ReferralStatus.New,
                GeneratedCaseID = null
            };

            service.HandleAcceptedReferral(referral);
            mockedServices.PatientDbSetMock.Verify(m => m.Add(It.IsAny <Domain2.Patients.Patient>()), Times.Never());
            mockedServices.CaseDbSetMock.Verify(m => m.Add(It.IsAny <Domain2.Cases.Case>()), Times.Never());
            mockedServices.ContextMock.Verify(m => m.SaveChanges(), Times.Never());
        }