diff options
Diffstat (limited to 'src/DotNetOpenAuth.InfoCard.UI/InfoCard')
6 files changed, 9 insertions, 21 deletions
diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs index 831e38d..53898ba 100644 --- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs +++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.InfoCard { using System; using System.ComponentModel; - using System.Diagnostics.Contracts; using System.IdentityModel.Claims; using System.Web.UI; @@ -16,7 +15,6 @@ namespace DotNetOpenAuth.InfoCard { /// </summary> [PersistChildren(false)] [Serializable] - [ContractVerification(true)] public class ClaimType { /// <summary> /// Initializes a new instance of the <see cref="ClaimType"/> class. diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs index 821ea1b..cdb0562 100644 --- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs +++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs @@ -23,7 +23,6 @@ namespace DotNetOpenAuth.InfoCard { using System; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Globalization; /// <summary> @@ -130,7 +129,7 @@ namespace DotNetOpenAuth.InfoCard { /// <returns>The manifest resource stream name.</returns> internal static string GetImageManifestResourceStreamName(InfoCardImageSize size) { string imageSize = size.ToString(); - Contract.Assume(imageSize.Length >= 6); + Assumes.True(imageSize.Length >= 6); imageSize = imageSize.Substring(4); return string.Format(CultureInfo.InvariantCulture, UrlFormatString, imageSize); } diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs index 3862e39..3b6b368 100644 --- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs +++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs @@ -24,6 +24,7 @@ namespace DotNetOpenAuth.InfoCard { using System.Web.UI.WebControls; using System.Xml; using DotNetOpenAuth.Messaging; + using Validation; /// <summary> /// The style to use for NOT displaying a hidden region. @@ -47,7 +48,6 @@ namespace DotNetOpenAuth.InfoCard { [PersistChildren(false)] [DefaultEvent("ReceivedToken")] [ToolboxData("<{0}:InfoCardSelector runat=\"server\"><ClaimsRequested><{0}:ClaimType Name=\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier\" /></ClaimsRequested><UnsupportedTemplate><p>Your browser does not support Information Cards.</p></UnsupportedTemplate></{0}:InfoCardSelector>")] - [ContractVerification(true)] public class InfoCardSelector : CompositeControl, IPostBackEventHandler { /// <summary> /// The resource name for getting at the SupportingScript.js embedded manifest stream. @@ -229,7 +229,6 @@ namespace DotNetOpenAuth.InfoCard { [PersistenceMode(PersistenceMode.InnerProperty), Category(InfoCardCategory)] public Collection<ClaimType> ClaimsRequested { get { - Contract.Ensures(Contract.Result<Collection<ClaimType>>() != null); if (this.ViewState[ClaimsRequestedViewStateKey] == null) { var claims = new Collection<ClaimType>(); this.ViewState[ClaimsRequestedViewStateKey] = claims; @@ -547,7 +546,6 @@ namespace DotNetOpenAuth.InfoCard { /// <param name="value">The parameter value.</param> /// <returns>The control that renders to the Param tag.</returns> private static string CreateParamJs(string name, string value) { - Contract.Ensures(Contract.Result<string>() != null); string scriptFormat = @" objp = document.createElement('param'); objp.name = {0}; objp.value = {1}; @@ -567,8 +565,6 @@ namespace DotNetOpenAuth.InfoCard { /// <returns>The Panel control</returns> [Pure] private Panel CreateInfoCardSupportedPanel() { - Contract.Ensures(Contract.Result<Panel>() != null); - Panel supportedPanel = new Panel(); try { @@ -626,8 +622,6 @@ namespace DotNetOpenAuth.InfoCard { /// <returns>The Panel control.</returns> [Pure] private Panel CreateInfoCardUnsupportedPanel() { - Contract.Ensures(Contract.Result<Panel>() != null); - Panel unsupportedPanel = new Panel(); try { if (this.UnsupportedTemplate != null) { @@ -724,9 +718,7 @@ namespace DotNetOpenAuth.InfoCard { /// <param name="optional">A space-delimited list of claim type URIs for claims that may optionally be included in a submitted Information Card.</param> [Pure] private void GetRequestedClaims(out string required, out string optional) { - Requires.ValidState(this.ClaimsRequested != null); - Contract.Ensures(Contract.ValueAtReturn<string>(out required) != null); - Contract.Ensures(Contract.ValueAtReturn<string>(out optional) != null); + RequiresEx.ValidState(this.ClaimsRequested != null); var nonEmptyClaimTypes = this.ClaimsRequested.Where(c => c.Name != null); @@ -741,8 +733,8 @@ namespace DotNetOpenAuth.InfoCard { string[] optionalClaimsArray = optionalClaims.ToArray(); required = string.Join(" ", requiredClaimsArray); optional = string.Join(" ", optionalClaimsArray); - Contract.Assume(required != null); - Contract.Assume(optional != null); + Assumes.True(required != null); + Assumes.True(optional != null); } /// <summary> @@ -750,7 +742,7 @@ namespace DotNetOpenAuth.InfoCard { /// or to downgrade gracefully if the user agent lacks an Information Card selector. /// </summary> private void RenderSupportingScript() { - Requires.ValidState(this.infoCardSupportedPanel != null); + RequiresEx.ValidState(this.infoCardSupportedPanel != null); this.Page.ClientScript.RegisterClientScriptResource(typeof(InfoCardSelector), ScriptResourceName); diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs index 94d3d63..2ec124b 100644 --- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs +++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.InfoCard { using System; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.Xml.XPath; /// <summary> diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs index 3d7e3d3..6de2ef0 100644 --- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs +++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs @@ -8,9 +8,9 @@ namespace DotNetOpenAuth.InfoCard { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; using System.IdentityModel.Tokens; using System.Security.Cryptography.X509Certificates; + using Validation; /// <summary> /// Arguments for the <see cref="InfoCardSelector.ReceivingToken"/> event. @@ -74,7 +74,7 @@ namespace DotNetOpenAuth.InfoCard { [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "False positive")] public void AddDecryptingToken(X509Certificate2 certificate) { Requires.NotNull(certificate, "certificate"); - Requires.True(certificate.HasPrivateKey, "certificate"); + Requires.That(certificate.HasPrivateKey, "certificate", "requires private key"); var cert = new X509SecurityToken(certificate); try { this.AddDecryptingToken(cert); diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs index d9c38f6..104df15 100644 --- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs +++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs @@ -6,7 +6,7 @@ namespace DotNetOpenAuth.InfoCard { using System; using System.Diagnostics.CodeAnalysis; - using System.Diagnostics.Contracts; + using Validation; /// <summary> /// Arguments for the <see cref="InfoCardSelector.TokenProcessingError"/> event. |