/// <summary> /// Read an attribute value from the given string and return true if it was successful, /// otherwise, return false. /// </summary> /// <param name="readerName"></param> /// <param name="readerValue"></param> /// <returns></returns> public bool ReadAttribute(string readerName, string readerValue) { switch (readerName) { case "Size": double[] size = FrameworkUtilities.GetDoubleAttributes(readerValue, 2, new double[] { DefaultXSize, DefaultYSize }); this.prop_PageSize = new Size(size[0], size[1]); return(true); case "xmlns": if (readerValue != PageViewModelBase.NameSpace) { throw new ArgumentException("XML namespace:'" + readerValue + "' is not supported."); } return(true); default: if (readerName.Trim().Length > 0 && readerName != PageViewModelBase.XmlComment) { throw new ArgumentException("XML node:'" + readerName + "' as child of '" + PageViewModel.XmlElementName + "' is not supported."); } break; } return(false); }
public void ClickFirstImage() { FrameworkUtilities.Sleep(500); var firstImage = GetFirstImage(); firstImage.Click(); }
public void WhenIEnterTheUsernameAndPasswordAs(Table table) { FrameworkUtilities.Sleep(1000); dynamic data = table.CreateDynamicInstance(); PageFactory.Instance.CurrentPage.As <LoginPage>().EmailSignInWithExistingAccount((string)data.Username, (string)data.Password); }
static void Main(string[] args) { int result; Console.WriteLine( "Solution computed in {0}", FrameworkUtilities.Measure(() => { var qualifications = new Qualification[uBound - lBound + 1]; for (int i = lBound; i <= uBound; i++) { qualifications[i - lBound] = GetQualification(i); } var abundants = qualifications.SelectWithPosition( (q, i) => new { q, Nbr = i + lBound - 1 } ).Where(a => a.q == Qualification.Abundant).Select(a => a.Nbr).ToList(); var crossSumOfAbundants = from x1 in abundants from x2 in abundants select x1 + x2; var excepts = Enumerable.Range(1, uBound).Except(crossSumOfAbundants); return(excepts.Sum()); }, out result)); Console.WriteLine(result); Console.ReadLine(); }
/// <summary> /// Read the attribute values of this class from XML. /// </summary> /// <param name="readerName"></param> /// <param name="readerValue"></param> /// <returns></returns> private bool ReadAttributes(string readerName, string readerValue) { switch (readerName) { case "Name": this.Name = readerValue; return(true); case "ID": this.ID = readerValue; return(true); case "Position": double[] size = FrameworkUtilities.GetDoubleAttributes(readerValue, 2, new double[] { 100, 100 }); this.Position = new Point(size[0], size[1]); return(true); case "xmlns": if (readerValue != NameSpace) { throw new ArgumentException("XML namespace:'" + readerValue + "' is not supported."); } return(true); default: return(false); } }
/// <summary> /// Read the attribute values of this class from XML. /// </summary> /// <param name="readerName"></param> /// <param name="readerValue"></param> /// <returns></returns> protected virtual bool ReadAttributes(string readerName, string readerValue) { switch (readerName) { case "Position": double[] size = FrameworkUtilities.GetDoubleAttributes(readerValue, 4, new double[] { 100, 100, 200, 200 }); this.Position = new System.Windows.Point(size[0], size[1]); this.Width = size[2]; this.Height = size[3]; return(true); case "ID": this.ID = readerValue; return(true); case "Name": this.Name = readerValue; return(true); case "xmlns": if (readerValue != NameSpace) { throw new ArgumentException("XML namespace:'" + readerValue + "' is not supported."); } return(true); default: return(false); } }
public void ThenIGoBackToTheHomePage() { FrameworkUtilities.Sleep(1500); PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <SettingsPage>().GotoHomePage(); FrameworkUtilities.Sleep(1500); Assert.That(PageFactory.Instance.CurrentPage.As <HomePage>().IsHomePage, Is.True, "You are not on the home page"); }
public void AddTitle() { FrameworkUtilities.Sleep(1000); ParagraphTitle.Click(); FrameworkUtilities.Sleep(250); GenerateRandomPostTitle(); ParagraphTitle.SendKeys(PostTitle); }
internal void EmailSignInWithExistingAccount(string email, string password) { FrameworkUtilities.Sleep(1000); FillEmail(email); ClickNextButton(); FrameworkUtilities.Sleep(500); FillPassword(password); }
public AppiumWebElement GetFirstImage() { FrameworkUtilities.Sleep(1000); var firstPic = DownloadPictures[1]; FrameworkUtilities.Sleep(250); return(firstPic); }
public void SendMessage() { ClickSendMessageTextbox(); GenerateRandomMessage(); SendMessageTextbox.SendKeys(Message); FrameworkUtilities.Sleep(1000); SendMessageButton.Click(); }
public void ThenIDeleteTheLastPostGeneretedByThisTestrunAndTheCorespondentImage() { FrameworkUtilities.ExecuteProcess(Settings.DeletePostFromDatabaseScriptPath, postAfterSendingPicture.PId); var post = GetPostForId(postAfterSendingPicture.PId); if (post != string.Empty) { Assert.Fail($"The post with ID {postAfterSendingPicture.PId} was not deleted"); } }
public void WhenIToggleTheNightMode() { var byteArrayLightMode = PageFactory.Instance.CurrentPage.As <SettingsPage>().TakeScreenshot(); LightModeBrightness = FrameworkUtilities.ImageBrightness(byteArrayLightMode); PageFactory.Instance.CurrentPage.As <SettingsPage>().ToggleNightMode(); FrameworkUtilities.Sleep(1500); var byteArrayNightMode = PageFactory.Instance.CurrentPage.As <SettingsPage>().TakeScreenshot(); DarkModeBrighness = FrameworkUtilities.ImageBrightness(byteArrayNightMode); }
public void GivenIGoToTheChatsPage() { PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <HomePage>().GotoChatPage(); FrameworkUtilities.Sleep(1000); PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <ChatPage>().GotoHomePage(); FrameworkUtilities.Sleep(1000); PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <HomePage>().GotoChatPage(); FrameworkUtilities.Sleep(1000); Assert.That(PageFactory.Instance.CurrentPage.As <ChatPage>().IsChatPage, Is.True, "You are not on the settings page"); }
private void rerouteLine() { Point from = new Point(this.FromX, this.FromY); Point to = new Point(this.ToX, this.ToY); this.mLine.Points.Clear(); this.mLine.Points.Add(from); if (this.FromOrientation != this.ToOrientation) { // Fine, we'll just do a two-piece line, then. if (this.FromOrientation == Orientation.Horizontal) { this.mLine.Points.Add(new Point(to.X, from.Y)); } else { this.mLine.Points.Add(new Point(from.X, to.Y)); } } else if (this.FromOrientation /* == ToOrientation */ == Orientation.Horizontal) { double mid = from.X + ((to.X - from.X) / 2); this.mLine.Points.Add(new Point(mid, from.Y)); this.mLine.Points.Add(new Point(mid, to.Y)); } else /* FromOrientation == ToOrientation == Orientation.Vertical */ { double mid = from.Y + ((to.Y - from.Y) / 2); this.mLine.Points.Add(new Point(from.X, mid)); this.mLine.Points.Add(new Point(to.X, mid)); } this.mLine.Points.Add(to); Vector firstSegment = from - this.mLine.Points[1]; Vector lastSegment = to - this.mLine.Points[this.mLine.Points.Count() - 2]; this.mFromAngleInDegrees = FrameworkUtilities.RadiansToDegrees(firstSegment.GetAngularCoordinate()); this.mToAngleInDegrees = FrameworkUtilities.RadiansToDegrees(lastSegment.GetAngularCoordinate()); if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs("FromAngleInDegrees")); this.PropertyChanged(this, new PropertyChangedEventArgs("ToAngleInDegrees")); } this.NotifySnapTargetUpdate(new SnapTargetUpdateEventArgs()); }
private void setAngle(double a) { a = FrameworkUtilities.NormalizeAngle(a); if (Angle == a) { return; // no change } Angle = a; if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("SnapOrientation")); PropertyChanged(this, new PropertyChangedEventArgs("Angle")); PropertyChanged(this, new PropertyChangedEventArgs("AngleInDegrees")); } }
public void AddPictureFromGallery() { FrameworkUtilities.Sleep(1000); ClickSelectImage(); FrameworkUtilities.Sleep(1000); GaleryUpload.Click(); FrameworkUtilities.Sleep(1000); AllowGalleryAccess.Click(); FrameworkUtilities.Sleep(1000); CameraDownloadsSection.Click(); FrameworkUtilities.Sleep(1000); ClickFirstImage(); }
public void WhenIKeepChangingTheTabsManyTimes() { for (int i = 0; i < 50; i++) { FrameworkUtilities.Sleep(1000); PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <SettingsPage>().GotoHomePage(); FrameworkUtilities.Sleep(1000); PageFactory.Instance.CurrentPage.As <HomePage>().IsHomePage(); PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <HomePage>().GotoChatPage(); FrameworkUtilities.Sleep(1000); PageFactory.Instance.CurrentPage.As <ChatPage>().IsChatPage(); PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <ChatPage>().GotoProfilePage(); FrameworkUtilities.Sleep(1000); PageFactory.Instance.CurrentPage.As <ProfilePage>().IsProfilePage(); PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <ProfilePage>().GotoSettingsPage(); FrameworkUtilities.Sleep(1000); PageFactory.Instance.CurrentPage.As <SettingsPage>().IsSettingsPage(); } }
internal void FillUsername(string username) { UsernameTextbox.SendKeys(username); FrameworkUtilities.Sleep(500); }
public void GivenIChooseSignInWithEmail() { FrameworkUtilities.Sleep(1000); Assert.That(PageFactory.Instance.CurrentPage.As <LoginPage>().IsSignInWithEmailExist, Is.True, "Login with email button was not found"); PageFactory.Instance.CurrentPage.As <LoginPage>().ClickEmailSignIn(); }
public void WhenIClickTheLoginButton() { FrameworkUtilities.Sleep(1000); PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <LoginPage>().SignInUser(); }
public void ThenISeeTheHomepage() { FrameworkUtilities.Sleep(5000); Assert.That(PageFactory.Instance.CurrentPage.As <HomePage>().IsHomePage, Is.True, "Hot Button was not found - you are probably not on the home page"); }
public void ToggleNightMode() { FrameworkUtilities.Sleep(500); ThemeChange.Click(); }
internal void ClickCancelPreviousUser() { CancelPreviousUser.Click(); FrameworkUtilities.Sleep(500); }
internal void FillEmail(string email) { EmailTextBox.SendKeys(email); FrameworkUtilities.Sleep(500); }
public void ThenIClickTheSettingsTab() { PageFactory.Instance.CurrentPage = PageFactory.Instance.CurrentPage.As <HomePage>().GotoSettingsPage(); FrameworkUtilities.Sleep(1000); Assert.That(PageFactory.Instance.CurrentPage.As <SettingsPage>().IsSettingsPage, Is.True, "You are not on the settings page"); }
internal void ClickSignIn() { SignIn.Click(); FrameworkUtilities.Sleep(500); }
internal void ClickCreateUser() { CreateUser.Click(); FrameworkUtilities.Sleep(500); }
internal void FillPassword(string password) { PasswordTextBox.SendKeys(password); FrameworkUtilities.Sleep(500); }
internal void ClickNextButton() { NextButton.Click(); FrameworkUtilities.Sleep(500); }