public async void TestCreateAgreement_RegulatedUser(CareSettingType careSetting) { // Arrange var service = CreateService(); var enrollee = new EnrolleeFactory().Generate(); enrollee.EnrolleeCareSettings.Single().CareSettingCode = (int)careSetting; enrollee.Certifications = new CertificationFactory(enrollee).Generate(1, "default,licence.regulated"); enrollee.AccessAgreementNote = null; TestDb.Has(enrollee); TestDb.Entry(enrollee.Certifications.Single()).Reference(c => c.License).Load(); int expectedAgreementId = 0; switch (careSetting) { case CareSettingType.CommunityPractice: expectedAgreementId = TestDb.AgreementVersions.GetNewestIdOfType <RegulatedUserAgreement>(); break; case CareSettingType.CommunityPharmacy: expectedAgreementId = TestDb.AgreementVersions.GetNewestIdOfType <CommunityPharmacistAgreement>(); break; } // Act await service.CreateEnrolleeAgreementAsync(enrollee.Id); // Assert AssertAgreementGeneration(enrollee, expectedAgreementId); }
public ActionResult Edit(Category Category) { if (Category.Name != null) { db.Entry(Category).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewBag.message = "Updated"; } else { ViewBag.message = "Failed to Update"; } return(View()); }
public async void TestCreateAgreement_LicencedObo(CareSettingType careSetting) { // Arrange var service = CreateService(); var enrollee = new EnrolleeFactory().Generate(); enrollee.EnrolleeCareSettings.Single().CareSettingCode = (int)careSetting; enrollee.Certifications = new CertificationFactory(enrollee).Generate(1, "default,licence.nonRegulated"); enrollee.AccessAgreementNote = null; TestDb.Has(enrollee); TestDb.Entry(enrollee.Certifications.Single()).Reference(c => c.License).Load(); var expectedAgreementId = TestDb.AgreementVersions.GetNewestIdOfType <OboAgreement>(); // Act await service.CreateEnrolleeAgreementAsync(enrollee.Id); // Assert AssertAgreementGeneration(enrollee, expectedAgreementId); }