예제 #1
0
        protected override int FreezeImpl()
        {
            int code = base.FreezeImpl();

            if (Acceptable != null)
            {
                code = code * 31 + Acceptable.GetHashCode();
            }
            return(code);
        }
예제 #2
0
        /// <summary>
        /// Navigates the browser to the target URL if necessary.
        /// </summary>
        /// <param name="actor">The screenplay actor.</param>
        public void PerformAs(IActor actor)
        {
            string currentUrl = actor.AsksFor(CurrentUrl.FromBrowser());

            if (Acceptable.Match(currentUrl).Success)
            {
                actor.Logger.Info("The current URL is acceptable, so navigation will not be attempted");
            }
            else
            {
                actor.Logger.Info("The current URL is not acceptable, so navigation will be attempted");
                actor.AttemptsTo(Navigate.ToUrl(Url));

                if (AcceptAlerts)
                {
                    actor.AttemptsTo(AcceptAlert.IfItExists());
                }
            }
        }