diff options
Diffstat (limited to 'src/DotNetOpenAuth.OpenId.RelyingParty.UI')
17 files changed, 35 insertions, 91 deletions
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj index 4d376bf..3d2661f 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj @@ -28,14 +28,13 @@ <Compile Include="OpenId\RelyingParty\OpenIdButton.cs" /> <Compile Include="OpenId\RelyingParty\OpenIdEventArgs.cs" /> <Compile Include="OpenId\RelyingParty\OpenIdLogin.cs" /> - <Compile Include="OpenId\RelyingParty\OpenIdMobileTextBox.cs" Condition=" '$(ClrVersion)' != '4' "/> + <Compile Include="OpenId\RelyingParty\OpenIdMobileTextBox.cs" Condition=" '$(ClrVersion)' != '4' " /> <Compile Include="OpenId\RelyingParty\OpenIdRelyingPartyAjaxControlBase.cs" /> <Compile Include="OpenId\RelyingParty\OpenIdRelyingPartyControlBase.cs" /> <Compile Include="OpenId\RelyingParty\OpenIdSelector.cs" /> <Compile Include="OpenId\RelyingParty\OpenIdTextBox.cs" /> <Compile Include="OpenId\RelyingParty\PopupBehavior.cs" /> <Compile Include="OpenId\RelyingParty\SelectorButton.cs" /> - <Compile Include="OpenId\RelyingParty\SelectorButtonContract.cs" /> <Compile Include="OpenId\RelyingParty\SelectorOpenIdButton.cs" /> <Compile Include="OpenId\RelyingParty\SelectorProviderButton.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> @@ -64,6 +63,10 @@ </ItemGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="Validation, Version=2.0.0.0, Culture=neutral, PublicKeyToken=2fc06f0d701809a7, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\Validation.2.0.0.12319\lib\portable-windows8+net40+sl5+windowsphone8\Validation.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <EmbeddedResource Include="OpenId\RelyingParty\login_failure.png" /> @@ -80,6 +83,7 @@ </ItemGroup> <ItemGroup> <None Include="OpenId\RelyingParty\Controls.cd" /> + <None Include="packages.config" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.targets" /> diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs index 0573e0a..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; @@ -21,6 +20,7 @@ namespace DotNetOpenAuth.Mvc { using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.RelyingParty; + using Validation; /// <summary> /// Methods that generate HTML or Javascript for hosting AJAX OpenID "controls" on @@ -35,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); @@ -65,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) { @@ -211,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); } @@ -228,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); } @@ -246,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)) { @@ -313,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 ef6894b..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; @@ -21,6 +20,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Extensions; using DotNetOpenAuth.OpenId.Extensions.UI; + using Validation; /// <summary> /// Provides the programmatic facilities to act as an AJAX-enabled OpenID relying party. diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs index d00f920..b5b6162 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs @@ -19,13 +19,13 @@ 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; using System.Web.UI; using System.Web.UI.HtmlControls; using DotNetOpenAuth.Messaging; + using Validation; /// <summary> /// An ASP.NET control that provides a minimal text box that is OpenID-aware and uses AJAX for @@ -382,7 +382,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } set { - Requires.InRange(value >= 0, "value"); + Requires.Range(value >= 0, "value"); this.ViewState[ColumnsViewStateKey] = value; } } @@ -446,7 +446,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } set { - Requires.InRange(value.TotalMilliseconds > 0, "value"); + Requires.Range(value.TotalMilliseconds > 0, "value"); this.ViewState[TimeoutViewStateKey] = value; } } @@ -462,7 +462,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } set { - Requires.InRange(value > 0, "value"); + Requires.Range(value > 0, "value"); this.ViewState[ThrottleViewStateKey] = value; } } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs index 8b91b14..66d6df6 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs @@ -7,10 +7,10 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; + using Validation; /// <summary> /// The event details passed to event handlers. 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 b3d208a..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. @@ -583,8 +583,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </remarks> [SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Uri(Uri, string) accepts second arguments that Uri(Uri, new Uri(string)) does not that we must support.")] public IAuthenticationRequest CreateRequest() { - Requires.ValidState(this.Request == null, OpenIdStrings.CreateRequestAlreadyCalled); - Requires.ValidState(!string.IsNullOrEmpty(this.Text), OpenIdStrings.OpenIdTextBoxEmpty); + RequiresEx.ValidState(this.Request == null, OpenIdStrings.CreateRequestAlreadyCalled); + RequiresEx.ValidState(!string.IsNullOrEmpty(this.Text), OpenIdStrings.OpenIdTextBoxEmpty); try { // Resolve the trust root, and swap out the scheme and port if necessary to match the diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs index 34c4df4..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; @@ -21,6 +20,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Extensions; + using Validation; /// <summary> /// A common base class for OpenID Relying Party controls. @@ -395,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 c730dea..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; @@ -27,6 +26,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using DotNetOpenAuth.OpenId.Extensions; using DotNetOpenAuth.OpenId.Extensions.UI; using DotNetOpenAuth.OpenId.Messages; + using Validation; /// <summary> /// Methods of indicating to the rest of the web site that the user has logged in. @@ -604,7 +604,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// used to determine the user's control of the <see cref="IAuthenticationRequest.ClaimedIdentifier"/>. /// </returns> protected IEnumerable<IAuthenticationRequest> CreateRequests() { - Requires.ValidState(this.Identifier != null, OpenIdStrings.NoIdentifierSet); + RequiresEx.ValidState(this.Identifier != null, OpenIdStrings.NoIdentifierSet); return this.CreateRequests(this.Identifier); } @@ -715,7 +715,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="response">The response.</param> protected virtual void OnLoggedIn(IAuthenticationResponse response) { Requires.NotNull(response, "response"); - Requires.True(response.Status == AuthenticationStatus.Authenticated, "response"); + Requires.That(response.Status == AuthenticationStatus.Authenticated, "response", "response not authenticatedl"); var loggedIn = this.LoggedIn; OpenIdEventArgs args = new OpenIdEventArgs(response); @@ -765,7 +765,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="response">The response.</param> protected virtual void OnCanceled(IAuthenticationResponse response) { Requires.NotNull(response, "response"); - Requires.True(response.Status == AuthenticationStatus.Canceled, "response"); + Requires.That(response.Status == AuthenticationStatus.Canceled, "response", "response not canceled"); var canceled = this.Canceled; if (canceled != null) { @@ -779,7 +779,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="response">The response.</param> protected virtual void OnFailed(IAuthenticationResponse response) { Requires.NotNull(response, "response"); - Requires.True(response.Status == AuthenticationStatus.Failed, "response"); + Requires.That(response.Status == AuthenticationStatus.Failed, "response", "response not failed"); var failed = this.Failed; if (failed != null) { @@ -1016,7 +1016,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="request">The request.</param> private void ScriptPopupWindow(IAuthenticationRequest request) { Requires.NotNull(request, "request"); - Requires.ValidState(this.RelyingParty != null); + RequiresEx.ValidState(this.RelyingParty != null); StringBuilder startupScript = new StringBuilder(); 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 8ba689f..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; @@ -29,6 +28,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.Extensions.UI; + using Validation; /// <summary> /// An ASP.NET control that provides a minimal text box that is OpenID-aware. @@ -584,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( @@ -627,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. @@ -666,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 b57b73b..0000000 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButtonContract.cs +++ /dev/null @@ -1,46 +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; - - /// <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 0041ad7..2ede5d6 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs @@ -7,10 +7,10 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.ComponentModel; - using System.Diagnostics.Contracts; using System.Drawing.Design; using System.Web.UI; using DotNetOpenAuth.Messaging; + using Validation; /// <summary> /// A button that appears in the <see cref="OpenIdSelector"/> control that @@ -47,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 7c71a37..e60d95d 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs @@ -7,11 +7,11 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; using System.ComponentModel; - using System.Diagnostics.Contracts; using System.Drawing.Design; using System.Web.UI; using DotNetOpenAuth.ComponentModel; using DotNetOpenAuth.Messaging; + using Validation; /// <summary> /// A button that appears in the <see cref="OpenIdSelector"/> control that @@ -69,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"); diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs index 5ea4ad7..0b03770 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs @@ -7,7 +7,6 @@ // We DON'T put an AssemblyVersionAttribute in here because it is generated in the build. using System; -using System.Diagnostics.Contracts; using System.Net; using System.Reflection; using System.Resources; @@ -33,8 +32,6 @@ using System.Web.UI; // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")] -[assembly: ContractVerification(true)] - #if StrongNameSigned // See comment at top of this file. We need this so that strong-naming doesn't // keep this assembly from being useful to shared host (medium trust) web sites. diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/packages.config b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/packages.config new file mode 100644 index 0000000..10eec89 --- /dev/null +++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Validation" version="2.0.0.12319" targetFramework="net40" /> +</packages>
\ No newline at end of file |