public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); /* FIXME: I could not figure out how to instantiate a * DatabaseOptions object in the clever way that * Microsoft.Extensions.Options does it, so I gave up and passed * the connection string. --Jonathan */ string connectionString = (string)Configuration .GetSection("Database") .GetValue(typeof(string), "ConnectionString"); //force dapper to see a system datetime as an sql datetime 2 SqlMapper.AddTypeMap(typeof(System.DateTime), System.Data.DbType.DateTime2); SqlMapper.AddTypeMap(typeof(Guid), System.Data.DbType.Guid); DatabaseTools.InitializeDatabase(connectionString); //if (env.IsDevelopment()) { // DatabaseTools.AddExampleData(connectionString); //} }
public void ThenIAssignTheStudyPlanToNthDateAndEnsureThatItIsPastDueThroughPropertiesWindow() { try { string Actname = DatabaseTools.GetActivityName(Enumerations.ActivityType.StudyPlan);// "SP2012118115736 ";// _studyplan;// "Readiness Check Ch04"; _calendarHedDefaultUxPage.ClickMyProfile(); _myAccountSettingPage.SelectFrame(); string Date = _myAccountSettingPage.GetMyProfileDate(); string Time = _myAccountSettingPage.GetMyProfileTime(); _myAccountSettingPage.ClickCancel(); GenericHelper.SelectDefaultWindow(); _calendarHedDefaultUxPage.SearchActivty(Actname); _calendarHedDefaultUxPage.ClickActivityCmenuInSearchView(Actname); _calendarHedDefaultUxPage.SelectAssignmentPropertiesCmenuOption(); _assignContentPage.SetDateAndTime(Date, Time); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { string username = Request.Form.Get("signUp_username"); string password = Request.Form.Get("signUp_password"); if (username != null && password != null) { if (DatabaseTools.singUptUser("%", username, password)) { if (DatabaseTools.singUptUser("localhost", username, password)) { if (DatabaseTools.insertProfile(username)) { Response.Redirect("Page_Login.aspx"); } else { Response.Write("<p>Error, failed to create account</p>"); } } else { Response.Write("<p>Error, failed to create account</p>"); } } else { Response.Write("<p>Error, failed to create account</p>"); } } }
static public void CreateTable() { SQLiteConnection db = DatabaseTools.getSystemConnection(); db.CreateTable <Species>(); db.Close(); }
public void Insert() { SQLiteConnection db = DatabaseTools.getSystemConnection(); db.Insert(this); db.Close(); }
private void buttonNewJob_Click(object sender, EventArgs e) { JobName = BoxName.Text; JobID = DatabaseTools.addSupplier(JobName, BoxAddress.Text, BoxPostCode.Text, datePicker.Value); this.DialogResult = DialogResult.OK; this.Close(); }
// method to fill the details for multiple choice questions public void ToFillTheDetailsForMultiple() { try { GenericHelper.SelectWindow("Create Multiple Choice"); GenericHelper.WaitUntilElement(By.Id("_ctl1_txtQuestionLabel")); string questionName = GenericHelper.GenerateUniqueVariable("Multiple_Choice"); DatabaseTools.UpdateQuestions(Enumerations.QuestionType.MultipleChoice, questionName); WebDriver.FindElement(By.Id("_ctl1_txtQuestionLabel")).SendKeys(questionName); WebDriver.SwitchTo().Frame("_ctl1_ifrmEditor_A"); GenericHelper.WaitUntilElement(By.Id("viewsource")); WebDriver.FindElement(By.Id("viewsource")).Click(); GenericHelper.WaitUntilElement(By.Id("ucEditorA_textarea")); WebDriver.FindElement(By.Id("ucEditorA_textarea")).SendKeys("Which is the best framework for automation testing"); GenericHelper.WaitUntilElement(By.Id("viewsource")); WebDriver.FindElement(By.Id("viewsource")).Click(); WebDriver.SwitchTo().DefaultContent(); GenericHelper.WaitUntilElement(By.Id("spnAnswer")); WebDriver.FindElement(By.Id("spnAnswer")).Click(); GenericHelper.WaitUntilElement(By.Id("_ctl1_dgdChoices__ctl2_txtChoice")); WebDriver.FindElement(By.Id("_ctl1_dgdChoices__ctl2_txtChoice")).SendKeys("BDD"); WebDriver.FindElement(By.Id("_ctl1_dgdChoices__ctl3_txtChoice")).SendKeys("TDD"); WebDriver.FindElement(By.Id("_ctl1_dgdChoices__ctl4_txtChoice")).SendKeys("ATDD"); WebDriver.FindElement(By.Id("_ctl1_dgdChoices__ctl5_txtChoice")).SendKeys("New One"); WebDriver.SwitchTo().DefaultContent(); WebDriver.FindElement(By.Id("imgReturnf")).Click(); //GenericHelper.IsPopUpClosed("Create Multiple Choice"); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "Failed"); } }
public void SyncDatabase<Y>(int BulkSize, string table, string idColumn, Func<T, Y> create) { lock (lck) { log.Info("Updating " + table); DatabaseTools.Update(table, idColumn, Update.Select(create)); var insertedCount = 0; log.Info("Inserting " + table); foreach (var list in Insert.Chunk(BulkSize)) { DatabaseTools.BulkInsert(table, list.Select(create)); insertedCount += list.Count(); log.Info("Inserted " + insertedCount + "/" + Insert.Count); } foreach (var kvp in NewlyInserted) { AlreadyExists.Add(GetKey(kvp.Value), kvp.Value); } NewlyInserted = new Dictionary<string, T>(); Update = new HashSet<T>(); Insert = new List<T>(); } }
public void GivenCourseAssociationToProgramTypeProductIsAlreadyCreatedIfNotThenCreateAssociation() { try { string productName = DatabaseTools.GetProduct(Enumerations.ProductInstance.HedCoreProgram); string isMasterCourseAlreadyAssociatedToProduct = DatabaseTools.GetProductMaterCourseAssociatedStatus(productName); if (isMasterCourseAlreadyAssociatedToProduct == null || isMasterCourseAlreadyAssociatedToProduct.Equals("False") || isMasterCourseAlreadyAssociatedToProduct.Equals("")) { GenericTestStep.StepToBrowsedUrlForPegasusUser("HED CS Admin"); GenericTestStep.StepToLoggedIntoTheCourseSpaceAsHedCSAdmin(); GenericTestStep.StepToItShouldShowTheManageProductsPage(); GenericTestStep.StepToSelectCourseInManageProductsPage("MySpanishLab Master Course"); GenericTestStep.StepToSelectTheProductInTheRightFrame("HedCoreProgram"); GenericTestStep.StepToAssociateTheCourseToProduct(); GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Approved courses programmed successfully."); DatabaseTools.UpdateProductMaterCourseAssociatedStatus(productName); GenericTestStep.StepToIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
public void WhenICreatedTheUserAsStudent(Table table) { try { bool isWindowPresent = GenericHelper.IsPopUpWindowPresent("Manage Organization"); if (isWindowPresent) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.SwitchTo().DefaultContent(); } else { // WebDriver.Close(); string schoolName = DatabaseTools.GetOrganization(Enumerations.OrgLevelType.School); _organizationManagement.SearchAndSelectOrg(schoolName); } // Purpose: To Create Users _manageUserPage.Createusers(table); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } GenericDefinitions.ThenIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); throw new Exception(e.ToString()); } }
public void WhenISelectTheWsUser() { try { string username = DatabaseTools.GetUsername(Enumerations.UserType.WsTeacher); _wSEnrollmentpage.SelectUser(username); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (Browser.Equals("FF") || Browser.Equals("IE")) { BackedSelenium.SelectWindow(""); } if (Browser.Equals("GC")) { GenericHelper.SelectDefaultWindow(); } IWebElement clickLogoutLink = WebDriver.FindElement((By.XPath(LogOut))); if (clickLogoutLink.Displayed && clickLogoutLink.Enabled) { WebDriver.SwitchTo().DefaultContent(); new Actions(WebDriver).Click(clickLogoutLink).Perform(); } Thread.Sleep(7000); throw new Exception(e.ToString()); } }
public static string GetNameFromID(int i) { SQLiteConnection db = DatabaseTools.getSystemConnection(); TrophyOrgane sp = db.Query <TrophyOrgane>("SELECT name FROM TrophyOrgane WHERE id = " + i)[0]; return(sp.name); }
static public void CreateTable() { SQLiteConnection db = DatabaseTools.getSystemConnection(); db.CreateTable <TrophyOrgane>(); db.Close(); }
//te devuelve los datos de la tabla webcommands, imprescindible para trabajar!! public List <Dictionary <string, object> > GetWebCommands() { string sql = "SELECT commandname, commandparameters, tablename, uidtablename, sqlcommand FROM webcommands WHERE active = ? ORDER BY ordercommand ASC"; Dictionary <string, object> parameters = new Dictionary <string, object> { { "active", 1 } }; Dictionary <string, OdbcType> types = new Dictionary <string, OdbcType> { { "active", OdbcType.Int } }; OdbcCommand commandOdbc = new OdbcCommand(sql, Infx.Database.Connection); DatabaseTools.InsertParameters(parameters, types, commandOdbc); List <Dictionary <string, object> > result = new List <Dictionary <string, object> >(); try { Infx.Database.Connection.Open(); result = Infx.ExecuteSelectCommand(commandOdbc); Infx.Database.Connection.Close(); } catch (MyOdbcException e) { if (Infx.Database.Connection.State == System.Data.ConnectionState.Open) { Infx.Database.Connection.Close(); } Sender.Singelton().GetServices().GetRequiredService <ILogger <ConsultasPreparadas> >().LogError(e.Message); } return(result); }
public void GivenAutohoredCourseIsAlreayApprovedInTheCourseSpaceIfNotThenApproveTheAuthoredCourseInCourseSpace() { try { //Purpose: Steps To Create Test Data string isCourseAlreadyApproved = DatabaseTools.GetCourseApproveStatus(Enumerations.CourseType.MySpanishLabMasterCourse); if (isCourseAlreadyApproved == null || isCourseAlreadyApproved.Equals("False") || isCourseAlreadyApproved.Equals("")) { string getCopiedCourse = DatabaseTools.GetCourse(Enumerations.CourseType.MySpanishLabMasterCourse); GenericTestStep.StepToBrowsedUrlForPegasusUser("HED CS Admin"); GenericTestStep.StepToLoggedIntoTheCourseSpaceAsHedCSAdmin(); GenericTestStep.StepToItShouldBeOnPage("Course Enrollment"); GenericTestStep.StepToNavigateToTheTab("Publishing"); GenericTestStep.StepToSwitchToTheTab("Manage Products"); GenericTestStep.StepToItShouldShowTheManageProductsPage(); GenericTestStep.StepToSelectTheCourseToApprove("MySpanishLab Master Course"); GenericTestStep.StepToClickedOnTheApproveCourseLink("Approve"); GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Published course marked as Approved."); DatabaseTools.UpdateCourseApproveStatusTrue(getCopiedCourse); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
public void GivenAuthoredCourseCopyAlreadyCreatedIfNotThenCreateTheAuthoredCourseCopy() { try { string isCourseAlreadyCopied = DatabaseTools.GetCourse(Enumerations.CourseType.MySpanishLabMasterCourse); if (isCourseAlreadyCopied == null) { //Purpose: Steps To Create Test Data GenericTestStep.StepToBrowsedUrlForPegasusUser("HED WS Admin"); GenericTestStep.StepToLoggedIntoTheWorkspaceAsHedWsAdmin(); GenericTestStep.StepToItShouldBeOnPage("Course Enrollment"); GenericTestStep.StepToIAmOnTheUserCreationPage(); GenericTestStep.StepToSelectTheCourse("MySpanishLab AuthoredCourse"); GenericTestStep.StepToClickOnTheCmenuOfCourse(); GenericTestStep.StepToClickOnTheCourseCMenuOptionLink("Copy as Master Course"); GenericTestStep.StepToIShouldSeeTheNewPopup("Copy as Master Course"); GenericTestStep.StepToCopyTheCourseInSameWorkspace("Master"); GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Copied as master course."); GenericTestStep.StepToWaitForTheCourseOutFromAssignToCopyState(); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
public IEnumerable <Dictionary <string, object> > Posts() { if (MvcApplication.cache == null) { MvcApplication.refreshCache = Posts; MvcApplication.cache = DatabaseTools.ExecuteReader(@"select top 100 (select message from Posts where id = p.id) as message, max(pc.date) as last_comment, p.date as post_date, pe.name as post_name, pe.id as poster_id, count(distinct pc.id) as comments, (select count(*) from PostLikes pl where post_id = p.id) as likes, (select count(*) from PostLikes pl inner join Entities e on pl.entity_id = e.id where post_id = p.id and blok ='Blå') as blablok, (select count(*) from PostLikes pl inner join Entities e on pl.entity_id = e.id where post_id = p.id and blok ='Rød') as rodblok, (select count(*) from PostLikes pl inner join Entities e on pl.entity_id = e.id where post_id = p.id and blok ='Midt') as midtblok, (select count(*) from PostLikes pl inner join Entities e on pl.entity_id = e.id where post_id = p.id and blok is null) as noblok from dbo.Posts p inner join dbo.Entities pe on p.entity_id = pe.id inner join dbo.Comments pc on pc.post_id = p.id group by p.id, pe.id, pe.name, p.date order by max(pc.date) desc"); } return(MvcApplication.cache); }
public void GivenSMSUserIsAlreadyCreatedIfNotThenCreateSMSUser() { try { string isInstructorAlreadyCreated = DatabaseTools.GetUsername(Enumerations.UserType.CsSmsInstructor); if (isInstructorAlreadyCreated == null || isInstructorAlreadyCreated.Equals("False") || isInstructorAlreadyCreated.Equals("")) { GenericTestStep.StepToBrowsedUrlForPegasusUser("SMSRegistration"); GenericTestStep.StepToClickedTheIAcceptButton(); GenericTestStep.StepToCreateNewSmsUser("CsSmsInstructor"); } string isstudentAlreadyCreated = DatabaseTools.GetUsername(Enumerations.UserType.CsSmsStudent); if (isstudentAlreadyCreated == null || isstudentAlreadyCreated.Equals("False") || isstudentAlreadyCreated.Equals("")) { GenericTestStep.StepToBrowsedUrlForPegasusUser("SMSRegistration"); GenericTestStep.StepToClickedTheIAcceptButton(); GenericTestStep.StepToCreateNewSmsUser("CsSmsStudent"); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
private void button1_Click(object sender, EventArgs e) { if (BoxOrder.Checked) { int orderValidity = DatabaseTools.AddOrder(BoxOrderNum.Text, dateOrder.Value, jobID); switch (orderValidity) { case 2: //Order didn't exist but has been added Submit(); break; case 1: //Order exists but date/job don't match MessageBox.Show("Order number exists but input date and/or job does not match what is stored!"); break; case 0: //Order exists Submit(); break; } } else { Submit(); } }
public void GivenSMSUserIsAlreadyEnrolledIntoTheProgramIfNotThenEnrollTheSMSUserInProgram() { try { string isProgramCourseCreated = DatabaseTools.GetCourse(Enumerations.CourseType.ProgramCourse); if (isProgramCourseCreated == null || isProgramCourseCreated.Equals("False") || isProgramCourseCreated.Equals("")) { GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsInstructor"); GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSInstructor(); GenericTestStep.StepToIAmOnThePage("Global Home"); GenericTestStep.StepToCreateProgramCourse(); GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsStudent"); GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSStudent(); GenericTestStep.StepToCloseStudentHelpTextWindow(); GenericTestStep.StepToIAmOnThePage("Global Home"); GenericTestStep.StepToEnrolStudentToCourse("ProductTypeProg"); GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
static public void CreateTable() { SQLiteConnection db = DatabaseTools.getUserConnection(); db.CreateTable <TrueScore>(); db.Close(); }
public void GivenSmsStudentisalreadyenrolledintotheSectionifnotthenenrolltheSmSusertoSection() { try { string isStudentEnrolled = DatabaseTools.GetEnrolledUser(Enumerations.UserType.CsSmsStudent); if (isStudentEnrolled == null || isStudentEnrolled.Equals("False") || isStudentEnrolled.Equals("")) { GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsInstructor"); GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSInstructor(); GenericTestStep.StepToIAmOnThePage("Global Home"); GenericTestStep.StepToCreateProgramCourse(); GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsStudent"); GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSStudent(); GenericTestStep.StepToCloseStudentHelpTextWindow(); GenericTestStep.StepToIAmOnThePage("Global Home"); GenericTestStep.StepToEnrolStudentToCourse("ProductTypeProg"); GenericTestStep.StepToSelectTheSectionName(); GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
public static string GetNameFromID(int i) { SQLiteConnection db = DatabaseTools.getSystemConnection(); Species sp = db.Query <Species>("SELECT name FROM Species WHERE id = " + i)[0]; return(sp.name); }
public void SelectTheProgramCourseFromGlobalHomePage() { try { bool announcementClose = GenericHelper.CloseAnnouncementPage(); if (announcementClose) { GenericHelper.Logs("Annoucement page has been closed successfully", "Passed"); } else { GenericHelper.Logs("Annoucement page is still not closed", "Failed"); } string courseName = DatabaseTools.GetCourse(Enumerations.CourseType.ProgramCourse).Trim(); GenericHelper.WaitUntilElement(By.PartialLinkText(courseName)); WebDriver.FindElement(By.PartialLinkText(courseName)).SendKeys(""); WebDriver.FindElement(By.PartialLinkText(courseName)).Click(); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); GenericStepDefinition.ThenIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); Assert.Fail(string.Format("Exception of type {0} cau" + "ght: {1}", e.GetType(), e.Message)); } }
public async Task TestNotTeamDuplication() { var competition1 = new Competition() { AreaName = "Argentina", Code = "SL", Name = "SuperLiga", IdService = 24 }; var competition2 = new Competition() { AreaName = "South America", Code = "LIB", Name = "Libertadores", IdService = 22 }; var teams1 = GetGenericTeams(); var teams2 = GetGenericTeams(14, 15, 24, 23); await this.competitionService.CreateFullCompetitionAsync(competition1, teams1); await this.competitionService.CreateFullCompetitionAsync(competition2, teams2); var dbContext = DatabaseTools.NewFootballDbContext(DB_NAME); var list = dbContext.Teams.Include(t => t.Competitions).ThenInclude(ct => ct.Competition) .Where(t => t.IdService == 14).ToList(); Assert.Single(list); Assert.True(list.First().Competitions.Count == 2); Assert.Contains(list.First().Competitions.Select(ct => ct.Competition), t => t.IdService == competition1.IdService); }
public void WhenIEnterSectionAsTeacher() { try { string sectionName = DatabaseTools.GetSectionName(Enumerations.CourseType.ProgramCourse); GenericHelper.SelectWindow("Program Administration"); GenericHelper.WaitUntilElement(By.Id("_ctl0_PageContent_ifrmMiddle")); WebDriver.FindElement(By.Id("_ctl0_PageContent_ifrmMiddle")); WebDriver.SwitchTo().Frame("_ctl0_PageContent_ifrmMiddle"); GenericHelper.WaitUntilElement(By.PartialLinkText("Search")); WebDriver.FindElement(By.PartialLinkText("Search")).Click(); //WebDriver.SwitchTo().ActiveElement(); GenericHelper.WaitUntilElement(By.Id("txtSectionDetail")); WebDriver.FindElement(By.Id("txtSectionDetail")).Clear(); WebDriver.FindElement(By.Id("txtSectionDetail")).SendKeys(sectionName); GenericHelper.WaitUntilElement(By.Id("lnkbuttonsearch")); WebDriver.FindElement(By.Id("lnkbuttonsearch")).Click(); WebDriver.SwitchTo().DefaultContent(); GenericHelper.SelectWindow("Program Administration"); GenericHelper.WaitUntilElement(By.Id("_ctl0_PageContent_ifrmMiddle")); WebDriver.FindElement(By.Id("_ctl0_PageContent_ifrmMiddle")); WebDriver.SwitchTo().Frame("_ctl0_PageContent_ifrmMiddle"); GenericHelper.WaitUntilElement(By.XPath("//div[@id='grdTemplateSection$divContent']/descendant::th[@class='thCourseInQ']/span")); IWebElement sectionClick = WebDriver.FindElement(By.XPath("//div[@id='grdTemplateSection$divContent']/descendant::th[@class='thCourseInQ']/span")); sectionClick.Click(); GenericHelper.WaitUtilWindow("Calendar"); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); GenericStepDefinition.ThenIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); Assert.Fail(string.Format("Exception of type {0} cau" + "ght: {1}", e.GetType(), e.Message)); } }
public void ThenICreateStudyPlanFromCourseMaterialTab() { try { GenericHelper.WaitUtilWindow("Course Materials"); _contentLibraryUxPage.ClickAddCourseMaterialsButton(); if (!_contentLibraryUxPage.IsStudyPlanOptionPresent()) { GenericTestStep.StepToNavigateToTheTab("Preferences"); _generalPreferencesPage.SelectSkillsAndStandards(); _standardSkillPreferencesPage.SelectNeitherRadioButtonAndSave(); GenericTestStep.StepToNavigateToTheTab("Course Materials"); _contentLibraryUxPage.GetControlToLeftFrame(); _contentLibraryUxPage.ClickAddCourseMaterialsButton(); } //create study plan string studyPlanName = GenericHelper.GenerateUniqueVariable("SP"); _contentLibraryUxPage.StudyPlanCreation(studyPlanName); _contentLibraryUxPage.GetControlToLeftFrame(); string SPName = DatabaseTools.GetActivityName(Enumerations.ActivityType.StudyPlan); GenericTestStep.StepToAddTheActivityToMyCourse(SPName); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
public void GivenAuthoredCourseCopyIsAlreadyPublishedIfNotThenPublishTheAuthoredCourseCopy() { try { //Purpose: Steps To Create Test Data string isCourseAlreadyPublished = DatabaseTools.GetCoursePublishStatus(Enumerations.CourseType.MySpanishLabMasterCourse); if (isCourseAlreadyPublished == null || isCourseAlreadyPublished.Equals("False") || isCourseAlreadyPublished.Equals("")) { string getCopiedCourse = DatabaseTools.GetCourse(Enumerations.CourseType.MySpanishLabMasterCourse); if (getCopiedCourse == null) { throw new ArgumentNullException("getCo" + "piedCourse is null"); } GenericTestStep.StepToBrowsedUrlForPegasusUser("HED WS Admin"); GenericTestStep.StepToLoggedIntoTheWorkspaceAsHedWsAdmin(); GenericTestStep.StepToItShouldBeOnPage("Course Enrollment"); GenericTestStep.StepToSelectTheCourse("MySpanishLab Authored Master Course"); GenericTestStep.StepToClickOnTheCmenuOfCourse(); GenericTestStep.StepToClickOnTheCourseCMenuOptionLink("Publish Master Course"); GenericTestStep.StepToIShouldSeeTheNewPopup("Publishing Notes"); GenericTestStep.StepToEnterThePublishingNotes(); GenericTestStep.StepToClickOnThePublishButton(); GenericTestStep.StepToItShouldDisplaySuccessfulMessage("Course published successfully."); DatabaseTools.UpdateCoursePublishStatusTrue(getCopiedCourse); GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
//Purpose : To add new user as WSadmin public void AddNewUser(Table table, string username) { GenericHelper.SelectWindow("Create New User"); ((string[])(table.Rows[0].Values))[1] = username; ((string[])(table.Rows[1].Values))[1] = "bdd_pwd123"; ((string[])(table.Rows[2].Values))[1] = username; ((string[])(table.Rows[3].Values))[1] = username; ((string[])(table.Rows[4].Values))[1] = "*****@*****.**"; foreach (var tableRow in table.Rows) { GenericHelper.WaitUntilElement(By.Id(tableRow["Field"])); WebDriver.FindElement(By.Id(tableRow["Field"])).SendKeys(tableRow["Value"]); } WebDriver.FindElement(By.Id("imgBtnSave_Update")).Click(); Thread.Sleep(5000); bool isCreateNewUserWindowClosed = GenericHelper.IsPopUpClosed(2); if (isCreateNewUserWindowClosed) { DatabaseTools.UpdateUserDb(Enumerations.UserType.WsTeacher, username, "bdd_pwd123", "*****@*****.**", 3, true); GenericHelper.Logs("As 'Create New User' popup closed on clicking save button the username is updated in DB" + username, "PASSED"); } else { GenericHelper.Logs("As 'Create New User' popup not closed on clicking save button the username is not updated in DB" + username, "FAILED"); } }
/// <summary> /// Purpose: To Enrol Student In the Respective Instructor Course /// </summary> public void ToEnrolTheStudentToCourseID() { GenericHelper.SelectWindow("Global Home"); Assert.AreEqual("Global Home", WebDriver.Title); GenericHelper.WaitUntilElement((By.XPath("//a[@id='_ctl3:_ctl2:_ctl0:_ctl0:_ctl0:btnEnrollCourse']/span/span"))); WebDriver.FindElement(By.XPath("//a[@id='_ctl3:_ctl2:_ctl0:_ctl0:_ctl0:btnEnrollCourse']/span/span")).Click(); WebDriver.SwitchTo().DefaultContent(); GenericHelper.SelectWindow("Global Home"); WebDriver.SwitchTo().Frame(1); GenericHelper.WaitUntilElement(By.Id("txtCourseID")); WebDriver.FindElement(By.Id("txtCourseID")).Clear(); WebDriver.FindElement(By.Id("txtCourseID")).SendKeys(_enrolledCourseId); GenericHelper.WaitUntilElement(By.CssSelector("span > span")); WebDriver.FindElement(By.CssSelector("span > span")).Click(); GenericHelper.WaitUntilElement(By.CssSelector("#btnConfirm > span > span")); WebDriver.FindElement(By.CssSelector("#btnConfirm > span > span")).Click(); WebDriver.SwitchTo().DefaultContent(); GenericHelper.SelectWindow("Global Home"); IWebElement divData = WebDriver.FindElement(By.XPath("//table[@id='tblCourse']/tbody")); string dBcoursename = DatabaseTools.GetCourse(Enumerations.CourseType.InstructorCourse); if (divData.Text.Contains(dBcoursename)) { GenericHelper.Logs("Enrolled course has been shown on the global home page for student", "Passed"); } }