public void CanConvert() { // Arrange const GmailScopes scopes = GmailScopes.Readonly; string readOnlyScope = GmailHelper.GetGmailScopesField("ReadOnlyScope"); // Act string scopeString = scopes.ToScopeString(); // Assert scopeString.ShouldBeEquivalentTo(readOnlyScope); }
private static void Main(string[] args) { // For Yandex Mail Server // App Config: Must - MailFrom // Must - SmtpUserName // Must - SmtpPassword IMailHelper yandexMailHelper = new YandexMailHelper(); yandexMailHelper.AddTo("*****@*****.**", "Çağdaş KARADEMİR"); yandexMailHelper.AddCc("*****@*****.**", "Çağdaş KARADEMİR"); yandexMailHelper.AddBcc("*****@*****.**", "Çağdaş KARADEMİR"); yandexMailHelper.Body = @"Quisque velit nisi, pretium ut lacinia in, elementum id enim. Vivamus suscipit tortor eget felis porttitor volutpat. Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Donec sollicitudin molestie malesuada. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eget tortor risus. Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Donec sollicitudin molestie malesuada. Praesent sapien massa, convallis a pellentesque nec, egestas non nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec velit neque, auctor sit amet aliquam vel, ullamcorper sit amet ligula."; yandexMailHelper.Subject = "Check Email"; yandexMailHelper.Send(); // For Gmail Server // App Config: Must - MailFrom // Must - SmtpUserName // Must - SmtpPassword IMailHelper gmailHelper = new GmailHelper(); gmailHelper.AddTo("*****@*****.**", "Çağdaş KARADEMİR"); gmailHelper.AddCc("*****@*****.**", "Çağdaş KARADEMİR"); gmailHelper.AddBcc("*****@*****.**", "Çağdaş KARADEMİR"); gmailHelper.Body = @"Quisque velit nisi, pretium ut lacinia in, elementum id enim. Vivamus suscipit tortor eget felis porttitor volutpat. Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Donec sollicitudin molestie malesuada. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eget tortor risus. Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Donec sollicitudin molestie malesuada. Praesent sapien massa, convallis a pellentesque nec, egestas non nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec velit neque, auctor sit amet aliquam vel, ullamcorper sit amet ligula."; gmailHelper.Subject = "Check Email"; gmailHelper.Send(); // For Any Smtp Server // App Config: Must - MailFrom // Must - SmtpUserName // Must - SmtpPassword // Must - SmtpHost // Optional - If SmtpPort Is Not 587 - Ex : 25 // Optional - If SmtpIsEnableSsl Is Not true - Ex : false // Optional - If MailIsBodyHtml Is Not true - Ex : false IMailHelper smtpMailHelper = new SmtpMailHelper(); smtpMailHelper.AddTo("*****@*****.**", "Çağdaş KARADEMİR"); smtpMailHelper.AddCc("*****@*****.**", "Çağdaş KARADEMİR"); smtpMailHelper.AddBcc("*****@*****.**", "Çağdaş KARADEMİR"); smtpMailHelper.Body = @"Quisque velit nisi, pretium ut lacinia in, elementum id enim. Vivamus suscipit tortor eget felis porttitor volutpat. Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Donec sollicitudin molestie malesuada. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eget tortor risus. Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Donec sollicitudin molestie malesuada. Praesent sapien massa, convallis a pellentesque nec, egestas non nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec velit neque, auctor sit amet aliquam vel, ullamcorper sit amet ligula."; smtpMailHelper.Subject = "Check Email"; smtpMailHelper.Send(); }
public ActionResult UserDetails(FormCollection fc) { StringBuilder str = new StringBuilder(); str.Append("Dear " + fc["VenderName"]); str.Append("<br/><br/>"); str.Append("Enquiry Details:- <br/>"); str.Append("Name:" + fc["name"] + "<br/> EmailId:" + fc["email"] + "<br/> Phone Number:" + fc["phoneNumber"] + "<br/> enquiry:" + fc["enquiry"]); str.Append($"<p>This is an automatically generated message to confirm receipt of your Booking via the Internet.You do not need to reply to this e - mail, but you may wish to save it for your records.<br/>Thank you.</p>"); str.Append($"<br/>WarmRegards,<br/> SupportTeam"); GmailHelper.Send(fc["VendorEmailId"], "Regarding Enquiry", str.ToString()); Roleslst(); int id = Convert.ToInt32(Request.QueryString.Get("id")); return(View(DbHelper.GetTeacherTimeDetails(id))); }
public static GmailProxy GetGmailProxy() { string privateKey = GetPrivateKey(); string tokenUri = GetTokenUri(); string clientEmail = GetClientEmail(); string emailAddress = GetEmailAddress(); ServiceAccountCredential accountCredential = new ServiceAccountCredential { PrivateKey = privateKey, TokenUri = tokenUri, ClientEmail = clientEmail }; //TODO: get GmailClient.ConvertToScopes using reflection in ReflectionHelper string scope = GmailHelper.GetGmailScopesField("ModifyScope"); return(new GmailProxy(new AuthorizationDelegatingHandler(accountCredential, emailAddress, scope))); }
public ActionResult TeacherBooking(TeacherTimeDetails objTeacherDetails) { Roleslst(); UserEnquiry objUserEnquiry = new UserEnquiry(); objUserEnquiry.FollowUP = true; objUserEnquiry.FKUserId = Helper.UserId; objUserEnquiry.FKClassId = objTeacherDetails.ClassId; objUserEnquiry.FKTeacherId = objTeacherDetails.TeacherId; objUserEnquiry.FKAvailableTimeId = objTeacherDetails.AvailableTeacherTimeId; objUserEnquiry.BookedFromDate = Convert.ToDateTime(objTeacherDetails.FromAvailableDate).Date; objUserEnquiry.BookedFromTime = new TimeSpan(Convert.ToInt32((objTeacherDetails.FromAvailableTime).Split(':')[0]), 0, 0); objUserEnquiry.BookedToTime = new TimeSpan(Convert.ToInt32((objTeacherDetails.ToAvailableTime).Split(':')[0]), 0, 0).Duration(); objUserEnquiry.BookedToDate = Convert.ToDateTime(objTeacherDetails.ToAvailableDate).Date; objUserEnquiry.CreatedDate = DateTime.Now; objUserEnquiry.BookingStatus = "Processing"; DbHelper.InsertUserEnquiry(objUserEnquiry); var enquiryId = objUserEnquiry.PKEnquiryId; //var enquiryId = 23; TeacherProfile obj = DbHelper.GetTeacher(objUserEnquiry.FKTeacherId); UserProfile objUser = DbHelper.GetUserProfile(obj.FKUserId); StringBuilder str = new StringBuilder(); str.Append("Dear " + objUser.UserName + ","); str.Append("<br/><br/>"); str.Append($"Thank you for Booking the {objTeacherDetails.TeacherName}.Your Order or Enquiry Id is {enquiryId}<br/>"); str.Append($"Your Booking Dates and Times are:-<br/><br/>"); str.Append($"<table border=1><tr><th>From Date</th><th> ToDate</th><th> FromTime</th><th> ToTime</th><th>Booking Status</th></tr>"); str.Append($"<tr><th>{ objUserEnquiry.BookedFromDate.ToShortDateString()}</th><th> { objUserEnquiry.BookedToDate.ToShortDateString()}</th><th> {objTeacherDetails.FromAvailableTime}</th><th> {objTeacherDetails.ToAvailableTime}</th><th>{objUserEnquiry.BookingStatus}</th></tr></table>"); str.Append($"<br/><p><strong>The Teacher has to accept your booking,So please wait for confirmation from Teacher</strong></p>"); str.Append($"<p>This is an automatically generated message to confirm receipt of your Booking via the Internet.You do not need to reply to this e - mail, but you may wish to save it for your records.<br/>Thank you.</p>"); str.Append($"<br/>WarmRegards,<br/> SupportTeam"); GmailHelper.Send(objUser.EmailId, "Regarding TeacherBooking", str.ToString()); // GmailHelper.Send("*****@*****.**", "Regarding TeacherBooking", str.ToString()); // str.Replace("Dear " + objUser.UserName + ",", "Dear " + obj.UserProfile.UserName + ","); //GmailHelper.Send(obj.UserProfile.EmailId, "Regarding User Booking ", str.ToString()); return(View("SuccessPage", objUserEnquiry)); }
public void WithMultipleScopes_ReturnsSpaceSeparatedString() { // Arrange const GmailScopes scopes = GmailScopes.Readonly | GmailScopes.Modify | GmailScopes.Labels | GmailScopes.Insert | GmailScopes.Send; // order shouldn't matter var scopeList = new List <string> { GmailHelper.GetGmailScopesField("LabelsScope"), GmailHelper.GetGmailScopesField("ReadOnlyScope"), GmailHelper.GetGmailScopesField("ModifyScope"), GmailHelper.GetGmailScopesField("SendScope"), GmailHelper.GetGmailScopesField("InsertScope"), }; // Act string scopeString = scopes.ToScopeString(); // Assert var parsedScopeList = scopeString.Split(' ').ToList(); parsedScopeList.ShouldAllBeEquivalentTo(scopeList); }
public ActionResult EditUserEnquiry(UserEnquiry objUserEnquiry) { if (ModelState.IsValid) { if (objUserEnquiry.FollowUP == false) { objUserEnquiry.BookingStatus = "Cancelled By Teacher"; StringBuilder str = new StringBuilder(); str.Append("Dear " + objUserEnquiry.UserName + ","); str.Append("<br/><br/>"); str.Append($"Thank you for Booking the {objUserEnquiry.TeacherName}.Your Order or Enquiry Id is {objUserEnquiry.PKEnquiryId}<br/>"); str.Append($"Your Booking Dates and Times are:-<br/><br/>"); str.Append($"<table border=1><tr><th>From Date</th><th> ToDate</th><th> FromTime</th><th> ToTime</th><th>Booking Status</th></tr>"); str.Append($"<tr><th>{ objUserEnquiry.BookedFromDate.ToShortDateString()}</th><th> { objUserEnquiry.BookedToDate.ToShortDateString()}</th><th> {objUserEnquiry.BookedFromTime}</th><th> {objUserEnquiry.BookedToTime}</th><th>{objUserEnquiry.BookingStatus}</th></tr></table>"); str.Append($"<br/><p><strong>Congra the teacher has to accepted your booking,So please Send your PayPal Id to Teacher. Teacher Email Id is {objUserEnquiry.TeacherProfile.UserProfile.EmailId} </strong></p>"); str.Append($"<p>This is an automatically generated message to confirm receipt of your Booking via the Internet.You do not need to reply to this e - mail, but you may wish to save it for your records.<br/>Thank you.</p>"); str.Append($"<br/>WarmRegards,<br/> SupportTeam"); GmailHelper.Send(objUserEnquiry.EmailId, "Regarding TeacherBooking", str.ToString()); } else { objUserEnquiry.BookingStatus = "Accepted By Teacher"; StringBuilder str = new StringBuilder(); str.Append("Dear " + objUserEnquiry.UserName + ","); str.Append("<br/><br/>"); str.Append($"Thank you for choosing the {objUserEnquiry.TeacherName}.Your Order or Enquiry Id is {objUserEnquiry.PKEnquiryId}<br/>"); str.Append($"Sorry say that teacher has cancelled the booking due to heavy booking on teacher"); str.Append($"<table border=1><tr><th>From Date</th><th> ToDate</th><th> FromTime</th><th> ToTime</th><th>Booking Status</th></tr>"); str.Append($"<tr><th>{ objUserEnquiry.BookedFromDate.ToShortDateString()}</th><th> { objUserEnquiry.BookedToDate.ToShortDateString()}</th><th> {objUserEnquiry.BookedFromTime}</th><th> {objUserEnquiry.BookedToTime}</th><th>{objUserEnquiry.BookingStatus}</th></tr></table>"); str.Append($"<p>This is an automatically generated message to confirm receipt of your Booking via the Internet.You do not need to reply to this e - mail, but you may wish to save it for your records.<br/>Thank you.</p>"); str.Append($"<br/>WarmRegards,<br/> SupportTeam"); GmailHelper.Send(objUserEnquiry.EmailId, "Regarding TeacherBooking", str.ToString()); } DbHelper.UpdateUserEnquiry(objUserEnquiry); return(View("Index")); } return(View(objUserEnquiry)); }
public void authenticateWithGoogleCalendar() { string[] username = null; string[] password = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); username = oXMLData.getData("settings/Credentials", "username_corp"); password = oXMLData.getData("settings/Credentials", "password"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var corpOffice_OfficeHelper = new CorpOffice_OfficeHelper(GetWebDriver()); var yopmail_Helper = new YopMailHelper(GetWebDriver()); var gmailHelper = new GmailHelper(GetWebDriver()); var officeActivities_MeetingHelper = new OfficeActivities_MeetingHelper(GetWebDriver()); // Variable random var username1 = "GoogleAuth" + RandomNumber(44, 99999); var name = "Test" + RandomNumber(999, 999999); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("AuthenticateWithGoogleCalendar", "Login with valid username and password"); Login(username[0], password[0]); executionLog.Log("AuthenticateWithGoogleCalendar", "Verify Page title"); VerifyTitle("Dashboard"); executionLog.Log("AuthenticateWithGoogleCalendar", "Visit Corp offices"); VisitCorp("offices"); corpOffice_OfficeHelper.WaitForWorkAround(3000); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on create office button"); corpOffice_OfficeHelper.ClickElement("Create"); corpOffice_OfficeHelper.WaitForWorkAround(3000); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter Name"); corpOffice_OfficeHelper.TypeText("Name", name); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter DBAName"); corpOffice_OfficeHelper.TypeText("DBAName", "TESTDBA"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter Website"); corpOffice_OfficeHelper.TypeText("Website", "TEST.COM"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter OfficeCode"); corpOffice_OfficeHelper.TypeText("OfficeCode", "12345"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter VenderName"); corpOffice_OfficeHelper.TypeText("VendorName", "VenderTEST"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter VenderName"); corpOffice_OfficeHelper.TypeText("VendorCode", "1234"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter VenderName"); corpOffice_OfficeHelper.TypeText("OfficePhoneNumber", "1234567890"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter VenderName"); corpOffice_OfficeHelper.TypeText("BusinessPhoneNumber", "1234567890"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter VenderName"); corpOffice_OfficeHelper.TypeText("FaxNumber", "1234567890"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter VenderName"); corpOffice_OfficeHelper.TypeText("LinkedURL", "Linked.com"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter VenderName"); corpOffice_OfficeHelper.TypeText("FacebookURL", "Facebook.com"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter TwitterURL"); corpOffice_OfficeHelper.TypeText("TwitterURL", "Twitter.com"); executionLog.Log("AuthenticateWithGoogleCalendar", "Select Address"); corpOffice_OfficeHelper.Select("AddressType", "Office"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter AddressLine1"); corpOffice_OfficeHelper.TypeText("AddressLine1", "FC-89"); executionLog.Log("AuthenticateWithGoogleCalendar", "Select Zip Code"); corpOffice_OfficeHelper.TypeText("ZIpCode", "60601"); corpOffice_OfficeHelper.WaitForWorkAround(3000); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter PrimaryUserName"); corpOffice_OfficeHelper.TypeText("PrimaryUserName", username1); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on AutoGenPassword checkbox"); corpOffice_OfficeHelper.ClickElement("AutoGenPassword"); corpOffice_OfficeHelper.WaitForWorkAround(1000); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter PrimaryPassword"); corpOffice_OfficeHelper.TypeText("PrimaryPassword", "123456"); executionLog.Log("AuthenticateWithGoogleCalendar", "Select Salutation"); corpOffice_OfficeHelper.Select("Salutation", "Mr"); //corpOffice_OfficeHelper.WaitForWorkAround(2000); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter FirstName"); corpOffice_OfficeHelper.TypeText("FirstName", "Test"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter LastName"); corpOffice_OfficeHelper.TypeText("LastName", "Tester"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter eAddress"); corpOffice_OfficeHelper.TypeText("eAddress", "*****@*****.**"); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on save button."); try { corpOffice_OfficeHelper.ClickElement("Save"); } catch (OpenQA.Selenium.WebDriverException) { } yopmail_Helper.WaitForWorkAround(7000); executionLog.Log("AuthenticateWithGoogleCalendar", "Go to yopmail.com"); GetWebDriver().Navigate().GoToUrl("http://www.yopmail.com/en/"); Console.WriteLine("Redirected to yopmail.com"); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter eAddress in yopmail"); yopmail_Helper.TypeText("Yopmail", "aslam.pegasus"); executionLog.Log("AuthenticateWithGoogleCalendar", "Check Inbox"); yopmail_Helper.ClickElement("YopmailClick"); yopmail_Helper.switchFrame("ifmail"); yopmail_Helper.VerifyText("MailSecondPoint", username1); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Office Link"); yopmail_Helper.ClickElement("OfficeLink"); corpOffice_OfficeHelper.SwitchToWindow(); yopmail_Helper.WaitForWorkAround(5000); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Profile Icon"); VisitCorp("logout"); corpOffice_OfficeHelper.WaitForWorkAround(3000); executionLog.Log("AuthenticateWithGoogleCalendar", "Login to office"); Login(username1, "123456"); executionLog.Log("AuthenticateWithGoogleCalendar", "Verify Page title"); VerifyTitle("Dashboard"); executionLog.Log("AuthenticateWithGoogleCalendar", "Redirect at My Calendar page"); GetWebDriver().Navigate().GoToUrl("https://www.mypegasuscrm.com/newthemecorp/" + username1 + "/meetings/calendar/my"); officeActivities_MeetingHelper.WaitForWorkAround(3000); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Authenticate with Google button"); officeActivities_MeetingHelper.ClickElement("GoogleAuth"); officeActivities_MeetingHelper.WaitForWorkAround(3000); if (gmailHelper.IsElementPresent("//div[@id='identifierLink']/div[2]/p")) { executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Use Another Account"); gmailHelper.ClickElement("UseAnotherAccBtn"); gmailHelper.WaitForWorkAround(1000); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter email address"); gmailHelper.TypeText("EnterEmail", "*****@*****.**"); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Next button"); gmailHelper.ClickElement("NextBtn"); gmailHelper.WaitForWorkAround(1000); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter password address"); gmailHelper.TypeText("EnterPswrd", "selenium123456"); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Next button"); gmailHelper.ClickElement("NextBtn"); gmailHelper.WaitForWorkAround(1000); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Allow button"); gmailHelper.ClickElement("AllowBtn"); gmailHelper.WaitForWorkAround(4000); } else { executionLog.Log("AuthenticateWithGoogleCalendar", "Enter email address"); gmailHelper.TypeText("EnterEmail", "*****@*****.**"); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Next button"); gmailHelper.ClickElement("NextBtn"); gmailHelper.WaitForWorkAround(1000); executionLog.Log("AuthenticateWithGoogleCalendar", "Enter password address"); gmailHelper.TypeText("EnterPswrd", "selenium123456"); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Next button"); gmailHelper.ClickElement("NextBtn"); gmailHelper.WaitForWorkAround(1000); executionLog.Log("AuthenticateWithGoogleCalendar", "Click on Allow button"); gmailHelper.ClickElement("AllowBtn"); gmailHelper.WaitForWorkAround(4000); } executionLog.Log("AuthenticateWithGoogleCalendar", "Verify successfully Google Calendar Synced"); officeActivities_MeetingHelper.VerifyPageText("Last Sync Time"); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("AuthenticateWithGoogleCalendar"); String Error = executionLog.GetAllTextFile("Error"); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("Authenticate With Google Calendar"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("Authenticate With Google Calendar", "Bug", "Medium", "Create Office page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("Authenticate With Google Calendar"); TakeScreenshot("AuthenticateWithGoogleCalendar"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\AuthenticateWithGoogleCalendar.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("AuthenticateWithGoogleCalendar"); string id = loginHelper.getIssueID("Authenticate With Google Calendar"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\AuthenticateWithGoogleCalendar.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("Authenticate With Google Calendar"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("Authenticate With Google Calendar"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("AuthenticateWithGoogleCalendar"); executionLog.WriteInExcel("Authenticate With Google Calendar", Status, JIRA, "Corp Office"); } }