Example #1
0
        /// <summary>
        /// Factory method for creating a new instance of WebWatcher with default name of Web Watcher.
        /// Uses the default HTTP GET request.
        /// </summary>
        /// <param name="url">Base URL of the request.</param>
        /// <param name="configurator">Optional lambda expression for configuring the WebWatcher.</param>
        /// <returns>Instance of WebWatcher.</returns>
        public static WebWatcher Create(string url, Action <WebWatcherConfiguration.Default> configurator = null)
        {
            var config = new WebWatcherConfiguration.Builder(url);

            configurator?.Invoke((WebWatcherConfiguration.Default)config);

            return(Create(DefaultName, config.Build()));
        }
Example #2
0
        /// <summary>
        /// Factory method for creating a new instance of WebWatcher.
        /// </summary>
        /// <param name="name">Name of the WebWatcher.</param>
        /// <param name="url">Base URL of the request.</param>
        /// <param name="request">Instance of the IHttpRequest.</param>
        /// <param name="configurator">Optional lambda expression for configuring the WebWatcher.</param>
        /// <param name="group">Optional name of the group that WebWatcher belongs to.</param>
        /// <returns>Instance of WebWatcher.</returns>
        public static WebWatcher Create(string name, string url, IHttpRequest request,
                                        Action <WebWatcherConfiguration.Default> configurator = null, string group = null)
        {
            var config = new WebWatcherConfiguration.Builder(url, request);

            configurator?.Invoke((WebWatcherConfiguration.Default)config);

            return(Create(name, config.Build(), group));
        }