using System; using System.Configuration; using System.Xml.Serialization; namespace Endpoint { /// /// Defines a configuration for an html webpage endpoint /// public class HtmlEndpointConfiguration : ConfigurationElement, IHttpEndpointConfiguration { /// /// Gets or sets the name. /// /// The name. [ConfigurationProperty("name", DefaultValue = "", IsKey = true, IsRequired = true)] public string Name { get { return (string)base["name"]; } set { base["name"] = value; } } /// /// URI of the service /// [XmlIgnore] public Uri Uri { get { return new Uri(UriString); } } /// /// Gets or sets the URI string. /// /// The URI string. [ConfigurationProperty("uri", DefaultValue = "", IsKey = false, IsRequired = true)] public string UriString { get { return (string)base["uri"]; } set { base["uri"] = value; } } /// /// Gets or sets the xpath query for the html document /// /// The xpath query. [ConfigurationProperty("xpathQuery", DefaultValue = "", IsKey = false, IsRequired = true)] public string XpathQuery { get { return (string)base["xpathQuery"]; } set { base["xpathQuery"] = value; } } /// /// Gets or sets the expected query results. /// /// The expected query results. [ConfigurationProperty("expectedXpathResult", DefaultValue = "", IsKey = false, IsRequired = true)] public string ExpectedXpathResult { get { return (string)base["expectedXpathResult"]; } set { base["expectedXpathResult"] = value; } } /// /// Gets or sets the post. /// /// The post. [ConfigurationProperty("requestContent", DefaultValue = "", IsKey = false, IsRequired = false)] public string RequestContent { get { return (string)base["requestContent"]; } set { base["requestContent"] = value; } } } /// /// /// public class HtmlEndpointConfigurationCollection : ConfigurationElementCollection { /// /// When overridden in a derived class, creates a new . /// /// /// A new . /// protected override ConfigurationElement CreateNewElement() { return new HtmlEndpointConfiguration(); } /// /// Gets the element key for a specified configuration element when overridden in a derived class. /// /// /// An that acts as the key for the specified . /// /// The to return the key for. protected override object GetElementKey(ConfigurationElement element) { return ((HtmlEndpointConfiguration)element).Name; } } /// /// /// public class HtmlEndpointConfigurationSection : ConfigurationSection { [ConfigurationProperty("endpoints")] public HtmlEndpointConfigurationCollection Endpoints { get { return (HtmlEndpointConfigurationCollection)(base["endpoints"]); } } } }