diff options
Diffstat (limited to 'src/DotNetOpenAuth.Test')
26 files changed, 38 insertions, 154 deletions
diff --git a/src/DotNetOpenAuth.Test/AssemblyTesting.cs b/src/DotNetOpenAuth.Test/AssemblyTesting.cs deleted file mode 100644 index dac5bea..0000000 --- a/src/DotNetOpenAuth.Test/AssemblyTesting.cs +++ /dev/null @@ -1,26 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="AssemblyTesting.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.Test { - using System.Diagnostics.Contracts; - using NUnit.Framework; - - [SetUpFixture] - public class AssemblyTesting { - [SetUp] - public static void AssemblyInitialize() { - // Make contract failures become test failures. - Contract.ContractFailed += (sender, e) => { - // For now, we have tests that verify that preconditions throw exceptions. - // So we don't want to fail a test just because a precondition check failed. - if (e.FailureKind != ContractFailureKind.Precondition) { - e.SetHandled(); - Assert.Fail(e.FailureKind.ToString() + ": " + e.Message); - } - }; - } - } -} diff --git a/src/DotNetOpenAuth.Test/CoordinatorBase.cs b/src/DotNetOpenAuth.Test/CoordinatorBase.cs index 1b4a5cd..d1c6f85 100644 --- a/src/DotNetOpenAuth.Test/CoordinatorBase.cs +++ b/src/DotNetOpenAuth.Test/CoordinatorBase.cs @@ -6,12 +6,12 @@ namespace DotNetOpenAuth.Test { using System; - using System.Diagnostics.Contracts; using System.Threading; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.RelyingParty; using DotNetOpenAuth.Test.Mocks; using NUnit.Framework; + using Validation; internal abstract class CoordinatorBase<T1, T2> { private Action<T1> party1Action; diff --git a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj index 189a569..1ecfa30 100644 --- a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj +++ b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj @@ -5,7 +5,6 @@ <ProjectRoot Condition="'$(ProjectRoot)' == ''">$(MSBuildProjectDirectory)\..\..\</ProjectRoot> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <CodeContractsAssemblyMode>0</CodeContractsAssemblyMode> </PropertyGroup> <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.props" /> <PropertyGroup> @@ -44,41 +43,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> - <CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking> - <CodeContractsCustomRewriterAssembly> - </CodeContractsCustomRewriterAssembly> - <CodeContractsCustomRewriterClass> - </CodeContractsCustomRewriterClass> - <CodeContractsRuntimeCheckingLevel>None</CodeContractsRuntimeCheckingLevel> - <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis> - <CodeContractsBuildReferenceAssembly>False</CodeContractsBuildReferenceAssembly> - <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations> - <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations> - <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations> - <CodeContractsLibPaths> - </CodeContractsLibPaths> - <CodeContractsPlatformPath> - </CodeContractsPlatformPath> - <CodeContractsExtraAnalysisOptions> - </CodeContractsExtraAnalysisOptions> - <CodeContractsBaseLineFile> - </CodeContractsBaseLineFile> - <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine> - <CodeContractsRunInBackground>True</CodeContractsRunInBackground> - <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies> - <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface> - <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure> - <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions> - <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs> - <CodeContractsExtraRewriteOptions /> - <CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers> - <CodeContractsEnumObligations>False</CodeContractsEnumObligations> - <CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults> - <CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -86,41 +51,7 @@ <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> - <CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking> - <CodeContractsCustomRewriterAssembly> - </CodeContractsCustomRewriterAssembly> - <CodeContractsCustomRewriterClass> - </CodeContractsCustomRewriterClass> - <CodeContractsRuntimeCheckingLevel>None</CodeContractsRuntimeCheckingLevel> - <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface> - <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure> - <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires> - <CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis> - <CodeContractsBuildReferenceAssembly>False</CodeContractsBuildReferenceAssembly> - <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations> - <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations> - <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations> - <CodeContractsLibPaths> - </CodeContractsLibPaths> - <CodeContractsPlatformPath> - </CodeContractsPlatformPath> - <CodeContractsExtraAnalysisOptions> - </CodeContractsExtraAnalysisOptions> - <CodeContractsBaseLineFile> - </CodeContractsBaseLineFile> - <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine> - <CodeContractsRunInBackground>True</CodeContractsRunInBackground> - <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies> - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions> - <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs> - <CodeContractsExtraRewriteOptions /> - <CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers> - <CodeContractsEnumObligations>False</CodeContractsEnumObligations> - <CodeContractsCacheAnalysisResults>False</CodeContractsCacheAnalysisResults> - <CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -130,36 +61,7 @@ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> <ErrorReport>prompt</ErrorReport> - <CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking> - <CodeContractsCustomRewriterAssembly> - </CodeContractsCustomRewriterAssembly> - <CodeContractsCustomRewriterClass> - </CodeContractsCustomRewriterClass> - <CodeContractsRuntimeCheckingLevel>None</CodeContractsRuntimeCheckingLevel> - <CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis> - <CodeContractsBuildReferenceAssembly>False</CodeContractsBuildReferenceAssembly> - <CodeContractsNonNullObligations>False</CodeContractsNonNullObligations> - <CodeContractsBoundsObligations>False</CodeContractsBoundsObligations> - <CodeContractsLibPaths> - </CodeContractsLibPaths> - <CodeContractsPlatformPath> - </CodeContractsPlatformPath> - <CodeContractsExtraAnalysisOptions> - </CodeContractsExtraAnalysisOptions> - <CodeContractsBaseLineFile> - </CodeContractsBaseLineFile> - <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine> - <CodeContractsRunInBackground>True</CodeContractsRunInBackground> - <CodeContractsShowSquigglies>True</CodeContractsShowSquigglies> - <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface> - <CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure> - <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires> - <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> - <CodeContractsRedundantAssumptions>False</CodeContractsRedundantAssumptions> - <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs> - <CodeContractsExtraRewriteOptions /> - <CodeContractsReferenceAssembly>%28none%29</CodeContractsReferenceAssembly> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> @@ -189,9 +91,12 @@ <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> + <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> - <Compile Include="AssemblyTesting.cs" /> <Compile Include="Configuration\SectionTests.cs" /> <Compile Include="CoordinatorBase.cs" /> <Compile Include="Hosting\AspNetHost.cs" /> @@ -373,6 +278,7 @@ </ItemGroup> <ItemGroup> <None Include="App.config" /> + <None Include="packages.config" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="OpenId\Discovery\xrdsdiscovery\xrds20dual.xml" /> diff --git a/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs b/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs index 117cde2..40dcc09 100644 --- a/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs +++ b/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs @@ -8,10 +8,10 @@ namespace DotNetOpenAuth.Test.Messaging { using System; using System.Collections; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using DotNetOpenAuth.Messaging; using NUnit.Framework; + using Validation; internal class CollectionAssert<T> { internal static void AreEquivalent(ICollection<T> expected, ICollection<T> actual) { diff --git a/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs b/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs index 39267ca..e9ac5aa 100644 --- a/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs +++ b/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs @@ -7,11 +7,11 @@ namespace DotNetOpenAuth.Test.Messaging { using System.CodeDom.Compiler; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.IO; using System.Net; using DotNetOpenAuth.Messaging; using NUnit.Framework; + using Validation; [TestFixture] public class MultipartPostPartTests : TestBase { @@ -77,7 +77,7 @@ namespace DotNetOpenAuth.Test.Messaging { } private static void VerifyLength(MultipartPostPart part) { - Contract.Requires(part != null); + Requires.NotNull(part, "part"); var expectedLength = part.Length; var ms = new MemoryStream(); diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs index 50eff97..475f4b5 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Net; using System.Text; @@ -17,6 +16,7 @@ namespace DotNetOpenAuth.Test.Mocks { using DotNetOpenAuth.Messaging.Reflection; using DotNetOpenAuth.Test.OpenId; using NUnit.Framework; + using Validation; internal class CoordinatingChannel : Channel { /// <summary> diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs index 2713765..497503c 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs @@ -7,11 +7,11 @@ namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Net; using System.Web; using DotNetOpenAuth.Messaging; + using Validation; internal class CoordinatingHttpRequestInfo : HttpRequestInfo { private readonly Channel channel; @@ -40,9 +40,9 @@ namespace DotNetOpenAuth.Test.Mocks { MessageReceivingEndpoint recipient, HttpCookieCollection cookies) : this(recipient, cookies) { - Contract.Requires(channel != null); - Contract.Requires(messageFactory != null); - Contract.Requires(messageData != null); + Requires.NotNull(channel, "channel"); + Requires.NotNull(messageFactory, "messageFactory"); + Requires.NotNull(messageData, "messageData"); this.channel = channel; this.messageData = messageData; this.messageFactory = messageFactory; diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs index e145952..9b552d3 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs @@ -6,7 +6,6 @@ namespace DotNetOpenAuth.Test.Mocks { using System; - using System.Diagnostics.Contracts; using System.Threading; using System.Web; @@ -14,6 +13,7 @@ namespace DotNetOpenAuth.Test.Mocks { using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.OAuth.Messages; + using Validation; /// <summary> /// A special channel used in test simulations to pass messages directly between two parties. diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs index 012173c..a6f2a7f 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs @@ -6,7 +6,6 @@ namespace DotNetOpenAuth.Test.Mocks { using System; - using System.Diagnostics.Contracts; using System.Threading; using System.Web; @@ -15,6 +14,7 @@ namespace DotNetOpenAuth.Test.Mocks { using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.OAuth.Messages; using NUnit.Framework; + using Validation; /// <summary> /// A special channel used in test simulations to pass messages directly between two parties. diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs index 90dbd7d..9df791c 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs @@ -8,10 +8,10 @@ namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; using System.ComponentModel; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; + using Validation; internal class CoordinatingOutgoingWebResponse : OutgoingWebResponse { private CoordinatingChannel receivingChannel; diff --git a/src/DotNetOpenAuth.Test/Mocks/MockHttpMessageHandler.cs b/src/DotNetOpenAuth.Test/Mocks/MockHttpMessageHandler.cs index fba107e..87e8196 100644 --- a/src/DotNetOpenAuth.Test/Mocks/MockHttpMessageHandler.cs +++ b/src/DotNetOpenAuth.Test/Mocks/MockHttpMessageHandler.cs @@ -12,6 +12,7 @@ namespace DotNetOpenAuth.Test.Mocks { using System.Text; using System.Threading; using System.Threading.Tasks; + using Validation; /// <summary> /// An <see cref="HttpMessageHandler"/> that sends each request to the specified delegate. diff --git a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs index 88c0a55..d20671e 100644 --- a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs +++ b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Globalization; using System.IO; using System.Net; @@ -18,6 +17,7 @@ namespace DotNetOpenAuth.Test.Mocks { using DotNetOpenAuth.OpenId.RelyingParty; using DotNetOpenAuth.Test.OpenId; using DotNetOpenAuth.Yadis; + using Validation; internal class MockHttpRequest { private readonly Dictionary<Uri, IncomingWebResponse> registeredMockResponses = new Dictionary<Uri, IncomingWebResponse>(); diff --git a/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs b/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs index e10ba2b..f020923 100644 --- a/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs +++ b/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs @@ -7,10 +7,10 @@ namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.RelyingParty; + using Validation; /// <summary> /// Performs similar to an ordinary <see cref="Identifier"/>, but when called upon diff --git a/src/DotNetOpenAuth.Test/Mocks/MockRealm.cs b/src/DotNetOpenAuth.Test/Mocks/MockRealm.cs index 1b66da6..8509c03 100644 --- a/src/DotNetOpenAuth.Test/Mocks/MockRealm.cs +++ b/src/DotNetOpenAuth.Test/Mocks/MockRealm.cs @@ -7,9 +7,9 @@ namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; + using Validation; internal class MockRealm : Realm { private RelyingPartyEndpointDescription[] relyingPartyDescriptions; diff --git a/src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs b/src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs index 0ec4f46..5a47ab4 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.Test.Mocks { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text; using DotNetOpenAuth.Messaging; diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs index f80935c..b081038 100644 --- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs +++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs @@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements { using System; using System.Collections.Generic; using System.Collections.Specialized; - using System.Diagnostics.Contracts; using System.IO; using System.Net; using System.Text; @@ -20,6 +19,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements { using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.Test.Mocks; using NUnit.Framework; + using Validation; [TestFixture] public class OAuthChannelTests : TestBase { diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs index dffe6c1..490399c 100644 --- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs +++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs @@ -6,13 +6,13 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements { using System.Collections.Generic; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Reflection; using DotNetOpenAuth.OAuth; using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.OAuth.Messages; using NUnit.Framework; + using Validation; [TestFixture] public class SigningBindingElementBaseTests : MessagingTestBase { @@ -125,7 +125,8 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements { } internal AccessProtectedResourceRequest CreateResourceRequest(MessageReceivingEndpoint endpoint) { - Contract.Requires(endpoint != null); + Requires.NotNull(endpoint, "endpoint"); + var message = new AccessProtectedResourceRequest(endpoint, Protocol.V10.Version); return message; } diff --git a/src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs b/src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs index 24e512c..21c1775 100644 --- a/src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs +++ b/src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs @@ -6,12 +6,12 @@ namespace DotNetOpenAuth.Test.OAuth { using System; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OAuth; using DotNetOpenAuth.OAuth.ChannelElements; using DotNetOpenAuth.Test.Mocks; + using Validation; /// <summary> /// Runs a Consumer and Service Provider simultaneously so they can interact in a full simulation. diff --git a/src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs b/src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs index 6494585..eeda125 100644 --- a/src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs +++ b/src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs @@ -12,6 +12,7 @@ namespace DotNetOpenAuth.Test.OAuth2 { using System.Text; using DotNetOpenAuth.OAuth2; using DotNetOpenAuth.Test.Mocks; + using Validation; internal class OAuth2Coordinator<TClient> : CoordinatorBase<TClient, AuthorizationServer> where TClient : ClientBase { diff --git a/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs b/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs index 6129ee7..14bcaec 100644 --- a/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs @@ -6,7 +6,6 @@ namespace DotNetOpenAuth.Test.OpenId { using System; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OpenId; @@ -15,6 +14,7 @@ namespace DotNetOpenAuth.Test.OpenId { using DotNetOpenAuth.OpenId.RelyingParty; using DotNetOpenAuth.Test.Mocks; using NUnit.Framework; + using Validation; [TestFixture] public class AuthenticationTests : OpenIdTestBase { @@ -136,8 +136,8 @@ namespace DotNetOpenAuth.Test.OpenId { } private void ParameterizedAuthenticationTest(Protocol protocol, bool statelessRP, bool sharedAssociation, bool positive, bool immediate, bool tamper) { - Requires.True(!statelessRP || !sharedAssociation, null, "The RP cannot be stateless while sharing an association with the OP."); - Requires.True(positive || !tamper, null, "Cannot tamper with a negative response."); + Requires.That(!statelessRP || !sharedAssociation, null, "The RP cannot be stateless while sharing an association with the OP."); + Requires.That(positive || !tamper, null, "Cannot tamper with a negative response."); var securitySettings = new ProviderSecuritySettings(); var cryptoKeyStore = new MemoryCryptoKeyStore(); var associationStore = new ProviderAssociationHandleEncoder(cryptoKeyStore); diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs index 849c796..dd47782 100644 --- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using System.Text.RegularExpressions; using DotNetOpenAuth.Messaging; @@ -19,6 +18,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { using DotNetOpenAuth.Test.Mocks; using DotNetOpenAuth.Test.OpenId.Extensions; using NUnit.Framework; + using Validation; [TestFixture] public class ExtensionsBindingElementTests : OpenIdTestBase { diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs index fd5bba2..8d0e6ff 100644 --- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs +++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs @@ -7,7 +7,6 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { using System; using System.Collections.Generic; - using System.Diagnostics.Contracts; using System.Linq; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; @@ -18,6 +17,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions { using DotNetOpenAuth.OpenId.Provider; using DotNetOpenAuth.OpenId.RelyingParty; using DotNetOpenAuth.Test.Messaging; + using Validation; public static class ExtensionTestUtilities { /// <summary> diff --git a/src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs b/src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs index 41528a7..5000833 100644 --- a/src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs +++ b/src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs @@ -6,13 +6,13 @@ namespace DotNetOpenAuth.Test.OpenId { using System; - using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.Provider; using DotNetOpenAuth.OpenId.RelyingParty; using DotNetOpenAuth.Test.Mocks; + using Validation; internal class OpenIdCoordinator : CoordinatorBase<OpenIdRelyingParty, OpenIdProvider> { internal OpenIdCoordinator(Action<OpenIdRelyingParty> rpAction, Action<OpenIdProvider> opAction) diff --git a/src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs index 2960d75..723aabf 100644 --- a/src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs +++ b/src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs @@ -4,7 +4,6 @@ // </copyright> //----------------------------------------------------------------------- -using System.Diagnostics.Contracts; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -21,5 +20,3 @@ using System.Runtime.InteropServices; // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("aef0bb13-b79c-4854-a69a-de58b8feb5d1")] - -[assembly: ContractVerification(true)]
\ No newline at end of file diff --git a/src/DotNetOpenAuth.Test/TestUtilities.cs b/src/DotNetOpenAuth.Test/TestUtilities.cs index a526f7f..3d3e151 100644 --- a/src/DotNetOpenAuth.Test/TestUtilities.cs +++ b/src/DotNetOpenAuth.Test/TestUtilities.cs @@ -11,6 +11,7 @@ namespace DotNetOpenAuth.Test { using System.Linq; using System.Net; using log4net; + using Validation; /// <summary> /// An assortment of methods useful for testing. diff --git a/src/DotNetOpenAuth.Test/packages.config b/src/DotNetOpenAuth.Test/packages.config new file mode 100644 index 0000000..10eec89 --- /dev/null +++ b/src/DotNetOpenAuth.Test/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 |