diff options
Diffstat (limited to 'src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId')
14 files changed, 6 insertions, 77 deletions
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs index f0e54a9..c78c6a7 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Mvc { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Globalization; using System.IO; using System.Linq; @@ -36,7 +35,6 @@ namespace DotNetOpenAuth.Mvc { [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "False positive.")] public static string OpenIdSelectorStyles(this HtmlHelper html) { Requires.NotNull(html, "html"); - Contract.Ensures(Contract.Result<string>() != null); using (var result = new StringWriter(CultureInfo.CurrentCulture)) { result.WriteStylesheetLink(OpenId.RelyingParty.OpenIdSelector.EmbeddedStylesheetResourceName); @@ -66,7 +64,6 @@ namespace DotNetOpenAuth.Mvc { [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "False positive")] public static string OpenIdSelectorScripts(this HtmlHelper html, OpenIdSelector selectorOptions, OpenIdAjaxOptions additionalOptions) { Requires.NotNull(html, "html"); - Contract.Ensures(Contract.Result<string>() != null); bool selectorOptionsOwned = false; if (selectorOptions == null) { @@ -212,7 +209,6 @@ window.openid_trace = {1}; // causes lots of messages"; Requires.NotNull(html, "html"); Requires.NotNull(providerIdentifier, "providerIdentifier"); Requires.NotNullOrEmpty(imageUrl, "imageUrl"); - Contract.Ensures(Contract.Result<string>() != null); return OpenIdSelectorButton(html, providerIdentifier, "OPButton", imageUrl); } @@ -229,7 +225,6 @@ window.openid_trace = {1}; // causes lots of messages"; public static string OpenIdSelectorOpenIdButton(this HtmlHelper html, string imageUrl) { Requires.NotNull(html, "html"); Requires.NotNullOrEmpty(imageUrl, "imageUrl"); - Contract.Ensures(Contract.Result<string>() != null); return OpenIdSelectorButton(html, "OpenIDButton", "OpenIDButton", imageUrl); } @@ -247,7 +242,6 @@ window.openid_trace = {1}; // causes lots of messages"; public static string OpenIdSelector(this HtmlHelper html, params SelectorButton[] buttons) { Requires.NotNull(html, "html"); Requires.NotNull(buttons, "buttons"); - Contract.Ensures(Contract.Result<string>() != null); using (var writer = new StringWriter(CultureInfo.CurrentCulture)) { using (var h = new HtmlTextWriter(writer)) { @@ -314,7 +308,6 @@ window.openid_trace = {1}; // causes lots of messages"; Requires.NotNull(html, "html"); Requires.NotNull(id, "id"); Requires.NotNullOrEmpty(imageUrl, "imageUrl"); - Contract.Ensures(Contract.Result<string>() != null); using (var writer = new StringWriter(CultureInfo.CurrentCulture)) { using (var h = new HtmlTextWriter(writer)) { diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs index 2d3b519..918efdf 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Globalization; using System.Linq; using System.Net; diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs index fa41efa..b5b6162 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs @@ -19,7 +19,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Drawing.Design; using System.Globalization; using System.Text; diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs index 489d2b5..66d6df6 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs index ffb619a..16f9462 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Globalization; using System.Linq; using System.Web.UI; diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs index c7c83a9..0c159a1 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs @@ -11,7 +11,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Globalization; using System.Text.RegularExpressions; using System.Web.Security; @@ -20,6 +19,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; + using Validation; /// <summary> /// An ASP.NET control for mobile devices that provides a minimal text box that is OpenID-aware. diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs index 3d42c85..9b4d271 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs @@ -11,7 +11,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Globalization; using System.Linq; using System.Text; @@ -396,7 +395,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param> protected override void Render(HtmlTextWriter writer) { - Contract.Assume(writer != null, "Missing contract."); + Assumes.True(writer != null, "Missing contract."); base.Render(writer); // Emit a hidden field to let the javascript on the user agent know if an diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs index cff00d5..7d616d2 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs @@ -12,7 +12,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Drawing.Design; using System.Globalization; using System.Linq; diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs index 91ff8c8..7881a8b 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs @@ -12,7 +12,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; - using System.Diagnostics.Contracts; using System.Globalization; using System.IdentityModel.Claims; using System.Linq; @@ -327,7 +326,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param> protected override void Render(HtmlTextWriter writer) { - Contract.Assume(writer != null, "Missing contract"); + Assumes.True(writer != null, "Missing contract"); writer.AddAttribute(HtmlTextWriterAttribute.Class, "OpenIdProviders"); writer.RenderBeginTag(HtmlTextWriterTag.Ul); diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs index e40d20e..7474854 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs @@ -15,7 +15,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Drawing.Design; using System.Globalization; using System.Net; @@ -585,7 +584,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param> protected override void Render(HtmlTextWriter writer) { - Contract.Assume(writer != null, "Missing contract."); + Assumes.True(writer != null, "Missing contract."); if (this.ShowLogo) { string logoUrl = Page.ClientScript.GetWebResourceUrl( @@ -628,7 +627,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// true if the server control's state changes as a result of the postback; otherwise, false. /// </returns> protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection) { - Contract.Assume(postCollection != null, "Missing contract"); + Assumes.True(postCollection != null, "Missing contract"); // If the control was temporarily hidden, it won't be in the Form data, // and we'll just implicitly keep the last Text setting. @@ -667,7 +666,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// used to determine the user's control of the <see cref="IAuthenticationRequest.ClaimedIdentifier"/>. /// </returns> private IEnumerable<IAuthenticationRequest> CreateRequestsCore(IEnumerable<IAuthenticationRequest> requests) { - Contract.Requires(requests != null); + Requires.NotNull(requests, "requests"); foreach (var request in requests) { if (this.EnableRequestProfile) { diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs index 670189c..82fd96b 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs @@ -6,13 +6,11 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; - using System.Diagnostics.Contracts; using System.Web.UI; /// <summary> /// A button that would appear in the <see cref="OpenIdSelector"/> control via its <see cref="OpenIdSelector.Buttons"/> collection. /// </summary> - [ContractClass(typeof(SelectorButtonContract))] [Serializable] public abstract class SelectorButton { /// <summary> diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButtonContract.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButtonContract.cs deleted file mode 100644 index 2f83b1d..0000000 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButtonContract.cs +++ /dev/null @@ -1,47 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="SelectorButtonContract.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.OpenId.RelyingParty { - using System; - using System.Diagnostics.Contracts; - using System.Web.UI; - using Validation; - - /// <summary> - /// The contract class for the <see cref="SelectorButton"/> class. - /// </summary> - [ContractClassFor(typeof(SelectorButton))] - internal abstract class SelectorButtonContract : SelectorButton { - /// <summary> - /// Ensures that this button has been initialized to a valid state. - /// </summary> - /// <remarks> - /// This is "internal" -- NOT "protected internal" deliberately. It makes it impossible - /// to derive from this class outside the assembly, which suits our purposes since the - /// <see cref="OpenIdSelector"/> control is not designed for an extensible set of button types. - /// </remarks> - internal override void EnsureValid() { - } - - /// <summary> - /// Renders the leading attributes for the LI tag. - /// </summary> - /// <param name="writer">The writer.</param> - protected internal override void RenderLeadingAttributes(HtmlTextWriter writer) { - Requires.NotNull(writer, "writer"); - } - - /// <summary> - /// Renders the content of the button. - /// </summary> - /// <param name="writer">The writer.</param> - /// <param name="selector">The containing selector control.</param> - protected internal override void RenderButtonContent(HtmlTextWriter writer, OpenIdSelector selector) { - Requires.NotNull(writer, "writer"); - Requires.NotNull(selector, "selector"); - } - } -} diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs index 432d54f..2ede5d6 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.ComponentModel; - using System.Diagnostics.Contracts; using System.Drawing.Design; using System.Web.UI; using DotNetOpenAuth.Messaging; @@ -48,8 +47,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// Ensures that this button has been initialized to a valid state. /// </summary> internal override void EnsureValid() { - Contract.Ensures(!string.IsNullOrEmpty(this.Image)); - // Every button must have an image. ErrorUtilities.VerifyOperation(!string.IsNullOrEmpty(this.Image), OpenIdStrings.PropertyNotSet, "SelectorButton.Image"); } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs index bc2b4c7..e60d95d 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.ComponentModel; - using System.Diagnostics.Contracts; using System.Drawing.Design; using System.Web.UI; using DotNetOpenAuth.ComponentModel; @@ -70,9 +69,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// Ensures that this button has been initialized to a valid state. /// </summary> internal override void EnsureValid() { - Contract.Ensures(!string.IsNullOrEmpty(this.Image)); - Contract.Ensures(this.OPIdentifier != null); - // Every button must have an image. ErrorUtilities.VerifyOperation(!string.IsNullOrEmpty(this.Image), OpenIdStrings.PropertyNotSet, "SelectorButton.Image"); |