コード例 #1
0
 public void CheckElementIsDisabled(
     [NotNull] IWebElementWrapper element,
     [NotNull] AssertionBehavior behavior,
     bool enabled)
 {
     Assert.ShouldBecome(() => element.Enabled, enabled, behavior,
                         $"{element.Caption} is{behavior.BehaviorAppendix()} enabled");
 }
コード例 #2
0
 public void CheckElementTooltip(
     [NotNull] IWebElementWrapper element,
     [NotNull] AssertionBehavior behavior,
     [NotNull] string value)
 {
     Assert.ShouldBecome(() => element.Tooltip, value, behavior,
                         $"{element.Caption} tooltip is \"{element.Tooltip}\"");
 }
コード例 #3
0
 public void CheckSelectedText(
     [NotNull] IWebElementWrapper element,
     [NotNull] AssertionBehavior behavior,
     [NotNull] string value)
 {
     Assert.ShouldBecome(() => StringExtensions.GetElementTextOrValue(element), value, behavior,
                         $"{element.Caption} text is \"{StringExtensions.GetElementTextOrValue(element)}\"");
 }
コード例 #4
0
        public static string BehaviorAppendix(this AssertionBehavior behavior)
        {
            if (!behavior.Inversion)
            {
                return(" not");
            }

            return(string.Empty);
        }
コード例 #5
0
 public static void ShouldBecome <T>(this Func <T> predicate, T value, AssertionBehavior behavior, string message)
 {
     if (behavior.Type == AssertionType.Immediate)
     {
         var actualValue = TryGetValue(predicate, TimeSpan.FromMilliseconds(500));
         True(actualValue.Equals(value) == !behavior.Inversion, message);
     }
     else
     {
         ShouldBecome(predicate, value, message, !behavior.Inversion);
     }
 }
コード例 #6
0
 public void CheckSelectedValue([NotNull] IDropdownWrapper wrapper, AssertionBehavior behavior, [NotNull] string value)
 {
     Assert.ShouldBecome(() => wrapper.SelectedValue, value, behavior,
                         $"{wrapper.Caption} selected value is{behavior.BehaviorAppendix()} {value}");
 }
コード例 #7
0
 public void CheckDropdownIsEmpty([NotNull] IDropdownWrapper wrapper, [NotNull] AssertionBehavior behavior)
 {
     Assert.ShouldBecome(() => wrapper.Empty, true, behavior,
                         $"{wrapper.Caption} selected value is{behavior.BehaviorAppendix()} empty");
 }
コード例 #8
0
 public void CheckElementIsEmpty([NotNull] IWebElementWrapper element, AssertionBehavior behavior)
 {
     Assert.ShouldBecome(() => StringExtensions.GetElementTextOrValue(element), string.Empty, behavior,
                         $"{element.Caption} text is \"{StringExtensions.GetElementTextOrValue(element)}\"");
 }
コード例 #9
0
 public void CheckRelativeUrl([NotNull] AssertionBehavior behavior, [NotNull] string url)
 {
     Assert.ShouldBecome(() => new Uri(_driverService.CurrentUrl).PathAndQuery, url, behavior,
                         $"relative URL is {new Uri(_driverService.CurrentUrl).PathAndQuery}");
 }
コード例 #10
0
 public void CheckUrl([NotNull] string url, [NotNull] AssertionBehavior behavior)
 {
     Assert.ShouldBecome(() => _driverService.CurrentUrl, url, behavior,
                         $"current URL is {_driverService.CurrentUrl}");
 }
コード例 #11
0
 public void CheckPageTitle([NotNull] AssertionBehavior behavior, [CanBeNull] string title)
 {
     Assert.ShouldBecome(() => _driverService.Title, title, behavior,
                         $"page title is {_driverService.Title}");
 }
コード例 #12
0
 public void CheckElementShown([NotNull] IWebElementWrapper element, [NotNull] AssertionBehavior behavior)
 {
     Assert.ShouldBecome(() => element.Displayed, true, behavior, $"{element.Caption} is{behavior.BehaviorAppendix()} visible");
 }