/// <summary> /// Maps object model to dictionary of parameters in cloudinary notation. /// </summary> /// <returns>Sorted dictionary of parameters.</returns> public override SortedDictionary <string, object> ToParamsDictionary() { var dict = base.ToParamsDictionary(); AddParam(dict, "tag", Tag); AddParam(dict, "notification_url", NotificationUrl); AddParam(dict, "format", Format); AddParam(dict, "async", Async); if (Urls != null && Urls.Any()) { AddParam(dict, "urls", Urls); } if (Transformation != null) { AddParam(dict, "transformation", Transformation.Generate()); } if (Mode.HasValue) { AddParam(dict, "mode", Api.GetCloudinaryParam(Mode.Value)); } return(dict); }
/// <summary> /// Validate object model. /// </summary> public override void Check() { var isUrlsEmpty = Urls == null || !Urls.Any(); if (string.IsNullOrEmpty(Tag) && isUrlsEmpty) { throw new ArgumentException("Either Tag or Urls must be specified"); } }
public void WaitForPageLoad(int timeout = waitForPageTimeout) { try { var wait = WebDriver.Wait(timeout); if (Urls != null) { wait.Until(driver => (Urls.Any(x => driver.Url.Contains(x)))); } else if (!string.IsNullOrEmpty(Url)) { wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.UrlContains(Url)); } else if (!string.IsNullOrEmpty(Title)) { wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.TitleIs(Title)); } // Wait for required element if (RequiredElementLocator != null) { wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(RequiredElementLocator)); } } catch (Exception e) { Console.WriteLine(e.ToString()); } // Handle notification bar on IE browser if (WebDriver.Property.DriverType == DriverType.InternetExplorer) { try { var action = WebDriver.Actions; action.KeyDown(Keys.Alt); action.SendKeys("q"); action.KeyUp(Keys.Alt); action.Perform(); } catch (Exception) { // Skip exception } } if ((new ErrorPage()).IsPageDisplayed()) { throw new Exception("A system error occurred"); } }
public void AddSelectionDelegate(object sender) { var youtubeResult = (YoutubeResult)sender; Console.WriteLine("result that's being added = {0}", youtubeResult.Title); if (Urls.Any(url => url.Item1 == youtubeResult.Url)) { return; } var tup = Tuple.Create(youtubeResult.Url, youtubeResult.Title); Urls.Add(tup); }
public bool IsPageDisplayed() { if (Urls != null) { return(Urls.Any(x => WebDriver.Url.Contains(x))); } else if (!string.IsNullOrEmpty(Url)) { return(WebDriver.Url.Contains(Url)); } else if (!string.IsNullOrEmpty(Title)) { return(WebDriver.Title == Title); } else if (RequiredElementLocator != null) { return(IsElementDisplayed(RequiredElementLocator)); } else { return(false); } }
public override void RetrieveImagePath() { UrlImagePath = m_autoResult.Where(r => Urls.Any(u => u.Contains(r.Url))).Select(r => new KeyValuePair <string, string>(r.Url, r.ImagePath)). ToDictionary(r => r.Key, r => r.Value); }
private bool CheckIfKeyExist(string key) { return(Urls.Any(u => u.Short == key)); }