public void ShouldPassAskChurchQuestions(bool memberus, bool otherchurch, bool nochurch) { var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager); OrgId = FakeOrg.org.OrganizationId; var model = FakeOrganizationUtils.GetFakeOnlineRegModel(OrgId); model.List[0].memberus = memberus; model.List[0].otherchurch = otherchurch; model.List[0].nochurch = nochurch; model.List[0].paydeposit = true; var resultSubmitQuestions = controller.SubmitQuestions(0, model); var resultCompleteRegistration = controller.CompleteRegistration(model); Assert.NotNull(resultSubmitQuestions); Assert.NotNull(resultCompleteRegistration); FakeOrganizationUtils.DeleteOrg(OrgId); }
public void Should_Use_MasterOrg_DOB_Phone_Settings() { int MasterOrgId = 0; int ChildOrgId = 0; var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); // Create Master Org var MasterOrgconfig = new Organization() { OrganizationName = "MockMasterName", RegistrationTitle = "MockMasterTitle", Location = "MockLocation", RegistrationTypeId = 20, RegSetting = XMLSettings(MasterOrgId) }; var FakeMasterOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, MasterOrgconfig); MasterOrgId = FakeMasterOrg.org.OrganizationId; // Create Child Org var ChildOrgconfig = new Organization() { OrganizationName = "MockMasterName", RegistrationTitle = "MockMasterTitle", Location = "MockLocation", RegistrationTypeId = 8, ParentOrgId = MasterOrgId }; var FakeChildOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, ChildOrgconfig); ChildOrgId = FakeChildOrg.org.OrganizationId; var MasterOnlineRegModel = FakeOrganizationUtils.GetFakeOnlineRegModel(ChildOrgId); var ChildOnlineRegModel = FakeOrganizationUtils.GetFakeOnlineRegModel(MasterOrgId); var MasterOnlineRegPersonModel = MasterOnlineRegModel.LoadExistingPerson(ChildOnlineRegModel.UserPeopleId ?? 0, 0); var ChildOnlineRegPersonModel = ChildOnlineRegModel.LoadExistingPerson(ChildOnlineRegModel.UserPeopleId ?? 0, 0); ChildOnlineRegPersonModel.ShowDOBOnFind().ShouldBe(true); ChildOnlineRegPersonModel.ShowPhoneOnFind().ShouldBe(true); FakeOrganizationUtils.DeleteOrg(MasterOrgId); FakeOrganizationUtils.DeleteOrg(ChildOrgId); }
public void Column_Number_Out_Of_Range_Should_Show_Error() { CMSDataContext db = CMSDataContext.Create(DatabaseFixture.Host); var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, new CmsData.Organization() { OrganizationName = "MockName", RegistrationTitle = "MockTitle", Location = "MockLocation", RegistrationTypeId = RegistrationTypeCode.JoinOrganization }); OrgId = FakeOrg.org.OrganizationId; username = RandomString(); password = RandomString(); var user = CreateUser(username, password, roles: new string[] { "Edit", "Access" }); Login(); Wait(3); Open($"{rootUrl}Org/{OrgId}#tab-Registrations-tab"); WaitForElementToDisappear(loadingUI); Find(css: "#Questions-tab > .ajax").Click(); WaitForElementToDisappear(loadingUI); Find(css: ".row:nth-child(1) > .col-sm-12 .edit").Click(); WaitForElementToDisappear(loadingUI); Find(text: "Add Question").Click(); Wait(2); Find(text: "Checkboxes").Click(); Wait(2); Find(text: "Done").Click(); Wait(2); Find(css: ".confirm").Click(); Wait(2); Find(xpath: "//div[4]/div/div/input").SendKeys("5"); Find(text: "Save").Click(); Wait(2); PageSource.ShouldContain("The field Columns must be between 0 and 4."); }
public void Should_SendAllConfirmations_ToStaff() { db = CMSDataContext.Create(DatabaseFixture.Host); var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, new CmsData.Organization() { OrganizationName = RandomString(), RegistrationTitle = RandomString(), Location = RandomString(), RegistrationTypeId = RegistrationTypeCode.JoinOrganization, NotifyIds = "1" }); OrgId = FakeOrg.org.OrganizationId; username = RandomString(); password = RandomString(); var CurrentUser = CreateUser(username, password); EmailAddress = CurrentUser.EmailAddress; Login(); Open($"{rootUrl}OnlineReg/{OrgId}"); WaitForElement("#otheredit", 5); Find(id: "otheredit").Click(); WaitForElement("#submitit", 5); Find(id: "submitit").Click(); WaitForElement("p:nth-child(3) > a", 5); var log = db.ActivityLogs.FirstOrDefault(p => p.OrgId == OrgId & p.Activity.Contains("SentConfirmationsToStaff")); log.ShouldNotBeNull(); }
public void Should_Store_and_Populate_RegEmail() { db = CMSDataContext.Create(DatabaseFixture.Host); var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, new CmsData.Organization() { OrganizationName = "MockName", RegistrationTitle = "MockTitle", Location = "MockLocation", RegistrationTypeId = RegistrationTypeCode.JoinOrganization }); OrgId = FakeOrg.org.OrganizationId; username = RandomString(); password = RandomString(); var CurrentUser = CreateUser(username, password); EmailAddress = CurrentUser.EmailAddress; Login(); Open($"{rootUrl}OnlineReg/{OrgId}"); WaitForElement("#otheredit", 5); Find(id: "otheredit").Click(); WaitForElement("#submitit", 5); Find(id: "submitit").Click(); WaitForElement("p:nth-child(3) > a", 5); var RegEmail = db.RecRegs.Where(x => x.PeopleId == CurrentUser.PeopleId).Select(x => x.Email).FirstOrDefault(); RegEmail.ShouldBe(CurrentUser.EmailAddress); }
private void createOrgWithFee() { var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, new Organization() { OrganizationName = "MockName", RegistrationTitle = "MockTitle", Location = "MockLocation", RegistrationTypeId = RegistrationTypeCode.JoinOrganization }); OrgId = FakeOrg.org.OrganizationId; }
public void Relaxed_Questions_Should_Not_Be_Visible() { CMSDataContext db = CMSDataContext.Create(DatabaseFixture.Host); var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, new CmsData.Organization() { OrganizationName = "MockName", RegistrationTitle = "MockTitle", Location = "MockLocation", RegistrationTypeId = RegistrationTypeCode.JoinOrganization }); OrgId = FakeOrg.org.OrganizationId; username = RandomString(); password = RandomString(); var user = CreateUser(username, password, roles: new string[] { "Edit", "Access" }); Login(); SettingUtils.UpdateSetting("RelaxedReqAdminOnly", "true"); Open($"{rootUrl}Org/{OrgId}#tab-Registrations-tab"); WaitForElementToDisappear(loadingUI); Find(css: "#Registration > form > div.row > div:nth-child(2) > div > a.btn.edit.ajax.btn-primary").Click(); WaitForElementToDisappear(loadingUI); var inputDOB = Find(id: "ShowDOBOnFind"); inputDOB.ShouldBeNull(); }
protected int CreateOrgWithFee() { var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, new Organization() { OrganizationName = "MockName", RegistrationTitle = "MockTitle", Location = "MockLocation", RegistrationTypeId = RegistrationTypeCode.JoinOrganization }); var OrgId = FakeOrg.org.OrganizationId; Open($"{rootUrl}Org/{OrgId}#tab-Registrations-tab"); WaitForElementToDisappear(loadingUI, maxWaitTimeInSeconds: 10); ScrollTo(css: "#Registration > form > h4:nth-child(3)"); Find(css: "#Fees-tab > a").Click(); WaitForElementToDisappear(loadingUI, maxWaitTimeInSeconds: 10); Find(css: "#Fees .row .edit").Click(); WaitForElementToDisappear(loadingUI, maxWaitTimeInSeconds: 10); ScrollTo(id: "Fee"); Find(id: "Fee").Clear(); Find(id: "Fee").SendKeys(RandomNumber(1, 1000).ToString()); Find(css: ".pull-right:nth-child(1) > .validate").Click(); Wait(5); return(OrgId); }
public void InvolvementList_Should_Have_FamilyId() { var requestManager = FakeRequestManager.Create(); var db = requestManager.CurrentDatabase; var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var m = OrganizationModel.Create(db, requestManager.CurrentUser); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager); var model = FakeOrganizationUtils.GetFakeOnlineRegModel(FakeOrg.org.OrganizationId); m.OrgId = FakeOrg.org.OrganizationId; var resultSubmitQuestions = controller.SubmitQuestions(0, model); var resultCompleteRegistration = controller.CompleteRegistration(model); var TestInvolvementList = ExportInvolvements.InvolvementList(m.QueryId); var pkg = typeof(EpplusResult).GetField("pkg", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(TestInvolvementList); using (ExcelPackage package = (ExcelPackage)pkg) { ExcelWorksheet worksheet = package.Workbook.Worksheets[1]; object[,] cellValues = (object[, ])worksheet.Cells.Value; List <string> ReportColumns = cellValues.Cast <object>().ToList().ConvertAll(x => Convert.ToString(x)); var FamilyId = worksheet.Cells[1, 2].Value.ToString().Trim(); ReportColumns.ShouldContain("FamilyId"); FamilyId.ShouldBe("FamilyId"); } FakeOrganizationUtils.DeleteOrg(FakeOrg.org.OrganizationId); }