summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-01-06 19:30:01 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2010-01-06 19:30:01 -0800
commitb4f047fc7af40f40149a84b58d8f3ad1632a48d5 (patch)
tree78ff419559a0496dbce02dc0140bd230218b79f8
parent408d636335d73d5520bc1f9fbfdab224d492b7cf (diff)
downloadDotNetOpenAuth-b4f047fc7af40f40149a84b58d8f3ad1632a48d5.zip
DotNetOpenAuth-b4f047fc7af40f40149a84b58d8f3ad1632a48d5.tar.gz
DotNetOpenAuth-b4f047fc7af40f40149a84b58d8f3ad1632a48d5.tar.bz2
Converted all the rest of the tests over to NUnit.
-rw-r--r--src/DotNetOpenAuth.Test/AssemblyTesting.cs8
-rw-r--r--src/DotNetOpenAuth.Test/Configuration/SectionTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/CoordinatorBase.cs4
-rw-r--r--src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj2
-rw-r--r--src/DotNetOpenAuth.Test/Hosting/HostingTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/LocalizationTests.cs4
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs16
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs90
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs2
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/EnumerableCacheTests.cs27
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/ErrorUtilitiesTests.cs14
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/HttpRequestInfoTests.cs28
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/MessageSerializerTests.cs22
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs8
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/MessagingUtilitiesTests.cs34
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/MultiPartPostPartTests.cs16
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs16
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/OutgoingWebResponseTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs14
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDescriptionTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs52
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs30
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Reflection/ValueMappingTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs2
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockReplayProtectionBindingElement.cs2
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockTransformationBindingElement.cs4
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs50
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs14
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs16
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ProtocolTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ServiceProviderDescriptionTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ServiceProviderTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/AssociationHandshakeTests.cs34
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/AssociationTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/AssociationsTests.cs14
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs24
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs28
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/ChannelElements/KeyValueFormEncodingTests.cs20
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs18
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/ChannelElements/SigningBindingElementTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/DiffieHellmanTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/UriDiscoveryServiceTests.cs36
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/XriDiscoveryProxyServiceTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeExchangeRoundtripTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeRequestTests.cs22
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeValuesTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchRequestTests.cs24
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchResponseTests.cs18
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreRequestTests.cs14
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreResponseTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperOPTests.cs16
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs18
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs14
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PapeRoundTripTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyRequestTests.cs18
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponseTests.cs26
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsRequestTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsResponseTests.cs16
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs30
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/AssociateDiffieHellmanRequestTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/AssociateRequestTests.cs22
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnencryptedResponseTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnsuccessfulResponseTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationRequestTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationResponseTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/CheckIdRequestTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/IndirectErrorResponseTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/IndirectSignedResponseTests.cs26
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/NegativeAssertionResponseTests.cs14
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/PositiveAssertionResponseTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Messages/SignedResponseRequestTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs7
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/OpenIdUtilitiesTests.cs4
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Provider/AnonymousRequestTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Provider/AuthenticationRequestTest.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Provider/HostProcessedRequestTests.cs16
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs30
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Provider/PerformanceTests.cs32
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/ProviderEndpointDescriptionTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RealmTests.cs38
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/AuthenticationRequestTests.cs30
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/FailedAuthenticationResponseTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/IdentifierDiscoveryResultTests.cs32
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/NegativeAuthenticationResponseTests.cs16
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs26
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdTextBoxTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs10
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs22
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/RelyingPartySecuritySettingsTests.cs14
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs48
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs30
-rw-r--r--src/DotNetOpenAuth.Test/TestBase.cs13
-rw-r--r--src/DotNetOpenAuth.Test/UriUtilTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/UtilTests.cs6
102 files changed, 825 insertions, 836 deletions
diff --git a/src/DotNetOpenAuth.Test/AssemblyTesting.cs b/src/DotNetOpenAuth.Test/AssemblyTesting.cs
index 7659a82..92b08ec 100644
--- a/src/DotNetOpenAuth.Test/AssemblyTesting.cs
+++ b/src/DotNetOpenAuth.Test/AssemblyTesting.cs
@@ -6,12 +6,12 @@
namespace DotNetOpenAuth.Test {
using System.Diagnostics.Contracts;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [SetUpFixture]
public class AssemblyTesting {
- [AssemblyInitialize]
- public static void AssemblyInitialize(TestContext tc) {
+ [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.
diff --git a/src/DotNetOpenAuth.Test/Configuration/SectionTests.cs b/src/DotNetOpenAuth.Test/Configuration/SectionTests.cs
index 73aad6d..e423053 100644
--- a/src/DotNetOpenAuth.Test/Configuration/SectionTests.cs
+++ b/src/DotNetOpenAuth.Test/Configuration/SectionTests.cs
@@ -9,11 +9,11 @@ namespace DotNetOpenAuth.Test.Configuration {
using System.Linq;
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class SectionTests {
- [TestMethod]
+ [TestCase]
public void UntrustedWebRequest() {
var uwr = DotNetOpenAuthSection.Configuration.Messaging.UntrustedWebRequest;
@@ -29,12 +29,12 @@ namespace DotNetOpenAuth.Test.Configuration {
Assert.IsTrue(uwr.WhitelistHostsRegex.KeysAsStrings.Contains(".+trusted.+"));
}
- [TestMethod]
+ [TestCase]
public void OpenIdMaxAuthenticationTime() {
Assert.AreEqual(TimeSpan.Parse("00:08:17"), DotNetOpenAuthSection.Configuration.OpenId.MaxAuthenticationTime);
}
- [TestMethod]
+ [TestCase]
public void OpenIdRelyingParty() {
var rp = DotNetOpenAuthSection.Configuration.OpenId.RelyingParty;
Assert.IsNull(rp.ApplicationStore.CustomType);
@@ -45,7 +45,7 @@ namespace DotNetOpenAuth.Test.Configuration {
Assert.IsFalse(rp.SecuritySettings.RequireSsl);
}
- [TestMethod]
+ [TestCase]
public void OpenIdProvider() {
var op = DotNetOpenAuthSection.Configuration.OpenId.Provider;
Assert.IsNull(op.ApplicationStore.CustomType);
diff --git a/src/DotNetOpenAuth.Test/CoordinatorBase.cs b/src/DotNetOpenAuth.Test/CoordinatorBase.cs
index df331f3..f25964c 100644
--- a/src/DotNetOpenAuth.Test/CoordinatorBase.cs
+++ b/src/DotNetOpenAuth.Test/CoordinatorBase.cs
@@ -11,7 +11,7 @@ namespace DotNetOpenAuth.Test {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
internal abstract class CoordinatorBase<T1, T2> {
private Action<T1> party1Action;
@@ -84,7 +84,7 @@ namespace DotNetOpenAuth.Test {
// Use the failing reason of a failing sub-thread as our reason, if anything failed.
if (failingException != null) {
- throw new AssertFailedException("Coordinator thread threw unhandled exception: " + failingException, failingException);
+ throw new AssertionException("Coordinator thread threw unhandled exception: " + failingException, failingException);
}
}
}
diff --git a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj
index a7635aa..d09c5fc 100644
--- a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj
+++ b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj
@@ -339,4 +339,4 @@
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\tools\DotNetOpenAuth.Versioning.targets" />
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/DotNetOpenAuth.Test/Hosting/HostingTests.cs b/src/DotNetOpenAuth.Test/Hosting/HostingTests.cs
index d7de7a1..7a725a7 100644
--- a/src/DotNetOpenAuth.Test/Hosting/HostingTests.cs
+++ b/src/DotNetOpenAuth.Test/Hosting/HostingTests.cs
@@ -12,11 +12,11 @@ namespace DotNetOpenAuth.Test.Hosting {
using System.Net;
using System.Text;
using DotNetOpenAuth.Test.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class HostingTests : TestBase {
- [TestMethod]
+ [TestCase]
public void AspHostBasicTest() {
try {
using (AspNetHost host = AspNetHost.CreateHost(TestWebDirectory)) {
diff --git a/src/DotNetOpenAuth.Test/LocalizationTests.cs b/src/DotNetOpenAuth.Test/LocalizationTests.cs
index 26b49cf..733e77d 100644
--- a/src/DotNetOpenAuth.Test/LocalizationTests.cs
+++ b/src/DotNetOpenAuth.Test/LocalizationTests.cs
@@ -10,17 +10,19 @@ namespace DotNetOpenAuth.Test {
using System.Threading;
using DotNetOpenAuth.Messaging;
using NUnit.Framework;
+ using System.Web;
/// <summary>
/// Tests various localized resources work as expected.
/// </summary>
[TestFixture]
- public class LocalizationTests {
+ public class LocalizationTests : TestBase {
/// <summary>
/// Tests that Serbian localized strings are correctly installed.
/// </summary>
[TestCase, ExpectedException(typeof(InvalidOperationException), ExpectedMessage = "Ovaj metod zahteva tekući HttpContext. Kao alternativa, koristite preklopljeni metod koji dozvoljava da se prosledi informacija bez HttpContext-a.")]
public void Serbian() {
+ HttpContext.Current = null; // our testbase initializes this, but it must be null to throw
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("sr");
ErrorUtilities.VerifyHttpContext();
}
diff --git a/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs b/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs
index 3cc792b..9ba433d 100644
--- a/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardExpirationBindingElementTests.cs
@@ -9,11 +9,11 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class StandardExpirationBindingElementTests : MessagingTestBase {
- [TestMethod]
+ [TestCase]
public void SendSetsTimestamp() {
TestExpiringMessage message = new TestExpiringMessage(MessageTransport.Indirect);
message.Recipient = new Uri("http://localtest");
@@ -24,13 +24,13 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings {
Assert.IsTrue(DateTime.UtcNow - ((IExpiringProtocolMessage)message).UtcCreationDate < TimeSpan.FromSeconds(3), "The timestamp on the message was not set on send.");
}
- [TestMethod]
+ [TestCase]
public void VerifyGoodTimestampIsAccepted() {
this.Channel = CreateChannel(MessageProtections.Expiration);
this.ParameterizedReceiveProtectedTest(DateTime.UtcNow, false);
}
- [TestMethod, ExpectedException(typeof(ExpiredMessageException))]
+ [TestCase, ExpectedException(typeof(ExpiredMessageException))]
public void VerifyBadTimestampIsRejected() {
this.Channel = CreateChannel(MessageProtections.Expiration);
this.ParameterizedReceiveProtectedTest(DateTime.UtcNow - StandardExpirationBindingElement.MaximumMessageAge - TimeSpan.FromSeconds(1), false);
diff --git a/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs b/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs
index 14651bc..d8698ce 100644
--- a/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/Bindings/StandardReplayProtectionBindingElementTests.cs
@@ -15,16 +15,16 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings {
using DotNetOpenAuth.OpenId.ChannelElements;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class StandardReplayProtectionBindingElementTests : MessagingTestBase {
private Protocol protocol;
private StandardReplayProtectionBindingElement nonceElement;
private IReplayProtectedProtocolMessage message;
private INonceStore nonceStore;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -39,7 +39,7 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings {
/// <summary>
/// Verifies that the generated nonce includes random characters.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RandomCharactersTest() {
Assert.IsNotNull(this.nonceElement.ProcessOutgoingMessage(this.message));
Assert.IsNotNull(this.message.Nonce, "No nonce was set on the message.");
@@ -56,7 +56,7 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings {
/// <summary>
/// Verifies that a message is received correctly.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ValidMessageReceivedTest() {
this.message.Nonce = "a";
Assert.IsNotNull(this.nonceElement.ProcessIncomingMessage(this.message));
@@ -65,7 +65,7 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings {
/// <summary>
/// Verifies that a message that doesn't have a string of random characters is received correctly.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ValidMessageNoNonceReceivedTest() {
this.message.Nonce = string.Empty;
this.nonceElement.AllowZeroLengthNonce = true;
@@ -75,7 +75,7 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings {
/// <summary>
/// Verifies that a message that doesn't have a string of random characters is received correctly.
/// </summary>
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void InvalidMessageNoNonceReceivedTest() {
this.message.Nonce = string.Empty;
this.nonceElement.AllowZeroLengthNonce = false;
@@ -85,7 +85,7 @@ namespace DotNetOpenAuth.Test.Messaging.Bindings {
/// <summary>
/// Verifies that a replayed message is rejected.
/// </summary>
- [TestMethod, ExpectedException(typeof(ReplayedMessageException))]
+ [TestCase, ExpectedException(typeof(ReplayedMessageException))]
public void ReplayDetectionTest() {
this.message.Nonce = "a";
Assert.IsNotNull(this.nonceElement.ProcessIncomingMessage(this.message));
diff --git a/src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs b/src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs
index 7846411..0781510 100644
--- a/src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/ChannelTests.cs
@@ -13,23 +13,23 @@ namespace DotNetOpenAuth.Test.Messaging {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ChannelTests : MessagingTestBase {
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNull() {
// This bad channel is deliberately constructed to pass null to
// its protected base class' constructor.
new TestBadChannel(true);
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestQueryString() {
this.ParameterizedReceiveTest("GET");
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestForm() {
this.ParameterizedReceiveTest("POST");
}
@@ -38,37 +38,37 @@ namespace DotNetOpenAuth.Test.Messaging {
/// Verifies compliance to OpenID 2.0 section 5.1.1 by verifying the channel
/// will reject messages that come with an unexpected HTTP verb.
/// </summary>
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void ReadFromRequestDisallowedHttpMethod() {
var fields = GetStandardTestFields(FieldFill.CompleteBeforeBindings);
fields["GetOnly"] = "true";
this.Channel.ReadFromRequest(CreateHttpRequestInfo("POST", fields));
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SendNull() {
this.Channel.PrepareResponse(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void SendIndirectedUndirectedMessage() {
IProtocolMessage message = new TestDirectedMessage(MessageTransport.Indirect);
this.Channel.PrepareResponse(message);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void SendDirectedNoRecipientMessage() {
IProtocolMessage message = new TestDirectedMessage(MessageTransport.Indirect);
this.Channel.PrepareResponse(message);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void SendInvalidMessageTransport() {
IProtocolMessage message = new TestDirectedMessage((MessageTransport)100);
this.Channel.PrepareResponse(message);
}
- [TestMethod]
+ [TestCase]
public void SendIndirectMessage301Get() {
TestDirectedMessage message = new TestDirectedMessage(MessageTransport.Indirect);
GetStandardTestMessage(FieldFill.CompleteBeforeBindings, message);
@@ -77,29 +77,29 @@ namespace DotNetOpenAuth.Test.Messaging {
OutgoingWebResponse response = this.Channel.PrepareResponse(message);
Assert.AreEqual(HttpStatusCode.Redirect, response.Status);
- StringAssert.StartsWith(response.Headers[HttpResponseHeader.Location], "http://provider/path");
+ StringAssert.StartsWith("http://provider/path", response.Headers[HttpResponseHeader.Location]);
foreach (var pair in expected) {
string key = MessagingUtilities.EscapeUriDataStringRfc3986(pair.Key);
string value = MessagingUtilities.EscapeUriDataStringRfc3986(pair.Value);
string substring = string.Format("{0}={1}", key, value);
- StringAssert.Contains(response.Headers[HttpResponseHeader.Location], substring);
+ StringAssert.Contains(substring, response.Headers[HttpResponseHeader.Location]);
}
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SendIndirectMessage301GetNullMessage() {
TestBadChannel badChannel = new TestBadChannel(false);
badChannel.Create301RedirectResponse(null, new Dictionary<string, string>());
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void SendIndirectMessage301GetEmptyRecipient() {
TestBadChannel badChannel = new TestBadChannel(false);
var message = new TestDirectedMessage(MessageTransport.Indirect);
badChannel.Create301RedirectResponse(message, new Dictionary<string, string>());
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SendIndirectMessage301GetNullFields() {
TestBadChannel badChannel = new TestBadChannel(false);
var message = new TestDirectedMessage(MessageTransport.Indirect);
@@ -107,7 +107,7 @@ namespace DotNetOpenAuth.Test.Messaging {
badChannel.Create301RedirectResponse(message, null);
}
- [TestMethod]
+ [TestCase]
public void SendIndirectMessageFormPost() {
// We craft a very large message to force fallback to form POST.
// We'll also stick some HTML reserved characters in the string value
@@ -122,29 +122,29 @@ namespace DotNetOpenAuth.Test.Messaging {
Assert.AreEqual(HttpStatusCode.OK, response.Status, "A form redirect should be an HTTP successful response.");
Assert.IsNull(response.Headers[HttpResponseHeader.Location], "There should not be a redirection header in the response.");
string body = response.Body;
- StringAssert.Contains(body, "<form ");
- StringAssert.Contains(body, "action=\"http://provider/path\"");
- StringAssert.Contains(body, "method=\"post\"");
- StringAssert.Contains(body, "<input type=\"hidden\" name=\"age\" value=\"15\" />");
- StringAssert.Contains(body, "<input type=\"hidden\" name=\"Location\" value=\"http://host/path\" />");
- StringAssert.Contains(body, "<input type=\"hidden\" name=\"Name\" value=\"" + HttpUtility.HtmlEncode(message.Name) + "\" />");
- StringAssert.Contains(body, ".submit()", "There should be some javascript to automate form submission.");
+ StringAssert.Contains("<form ", body);
+ StringAssert.Contains("action=\"http://provider/path\"", body);
+ StringAssert.Contains("method=\"post\"", body);
+ StringAssert.Contains("<input type=\"hidden\" name=\"age\" value=\"15\" />", body);
+ StringAssert.Contains("<input type=\"hidden\" name=\"Location\" value=\"http://host/path\" />", body);
+ StringAssert.Contains("<input type=\"hidden\" name=\"Name\" value=\"" + HttpUtility.HtmlEncode(message.Name) + "\" />", body);
+ StringAssert.Contains(".submit()", body, "There should be some javascript to automate form submission.");
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SendIndirectMessageFormPostNullMessage() {
TestBadChannel badChannel = new TestBadChannel(false);
badChannel.CreateFormPostResponse(null, new Dictionary<string, string>());
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void SendIndirectMessageFormPostEmptyRecipient() {
TestBadChannel badChannel = new TestBadChannel(false);
var message = new TestDirectedMessage(MessageTransport.Indirect);
badChannel.CreateFormPostResponse(message, new Dictionary<string, string>());
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SendIndirectMessageFormPostNullFields() {
TestBadChannel badChannel = new TestBadChannel(false);
var message = new TestDirectedMessage(MessageTransport.Indirect);
@@ -159,7 +159,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// Since this is a mock channel that doesn't actually formulate a direct message response,
/// we just check that the right method was called.
/// </remarks>
- [TestMethod, ExpectedException(typeof(NotImplementedException), "SendDirectMessageResponse")]
+ [TestCase, ExpectedException(typeof(NotImplementedException))]
public void SendDirectMessageResponse() {
IProtocolMessage message = new TestDirectedMessage {
Age = 15,
@@ -169,25 +169,25 @@ namespace DotNetOpenAuth.Test.Messaging {
this.Channel.PrepareResponse(message);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SendIndirectMessageNull() {
TestBadChannel badChannel = new TestBadChannel(false);
badChannel.PrepareIndirectResponse(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void ReceiveNull() {
TestBadChannel badChannel = new TestBadChannel(false);
badChannel.Receive(null, null);
}
- [TestMethod]
+ [TestCase]
public void ReceiveUnrecognizedMessage() {
TestBadChannel badChannel = new TestBadChannel(false);
Assert.IsNull(badChannel.Receive(new Dictionary<string, string>(), null));
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestWithContext() {
var fields = GetStandardTestFields(FieldFill.AllRequired);
TestMessage expectedMessage = GetStandardTestMessage(FieldFill.AllRequired);
@@ -195,24 +195,24 @@ namespace DotNetOpenAuth.Test.Messaging {
HttpContext.Current = new HttpContext(request, new HttpResponse(new StringWriter()));
IProtocolMessage message = this.Channel.ReadFromRequest();
Assert.IsNotNull(message);
- Assert.IsInstanceOfType(message, typeof(TestMessage));
+ Assert.IsInstanceOfType(typeof(TestMessage), message);
Assert.AreEqual(expectedMessage.Age, ((TestMessage)message).Age);
}
- [TestMethod, ExpectedException(typeof(InvalidOperationException))]
+ [TestCase, ExpectedException(typeof(InvalidOperationException))]
public void ReadFromRequestNoContext() {
HttpContext.Current = null;
TestBadChannel badChannel = new TestBadChannel(false);
badChannel.ReadFromRequest();
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void ReadFromRequestNull() {
TestBadChannel badChannel = new TestBadChannel(false);
badChannel.ReadFromRequest(null);
}
- [TestMethod]
+ [TestCase]
public void SendReplayProtectedMessageSetsNonce() {
TestReplayProtectedMessage message = new TestReplayProtectedMessage(MessageTransport.Indirect);
message.Recipient = new Uri("http://localtest");
@@ -222,33 +222,33 @@ namespace DotNetOpenAuth.Test.Messaging {
Assert.IsNotNull(((IReplayProtectedProtocolMessage)message).Nonce);
}
- [TestMethod, ExpectedException(typeof(InvalidSignatureException))]
+ [TestCase, ExpectedException(typeof(InvalidSignatureException))]
public void ReceivedInvalidSignature() {
this.Channel = CreateChannel(MessageProtections.TamperProtection);
this.ParameterizedReceiveProtectedTest(DateTime.UtcNow, true);
}
- [TestMethod]
+ [TestCase]
public void ReceivedReplayProtectedMessageJustOnce() {
this.Channel = CreateChannel(MessageProtections.ReplayProtection);
this.ParameterizedReceiveProtectedTest(DateTime.UtcNow, false);
}
- [TestMethod, ExpectedException(typeof(ReplayedMessageException))]
+ [TestCase, ExpectedException(typeof(ReplayedMessageException))]
public void ReceivedReplayProtectedMessageTwice() {
this.Channel = CreateChannel(MessageProtections.ReplayProtection);
this.ParameterizedReceiveProtectedTest(DateTime.UtcNow, false);
this.ParameterizedReceiveProtectedTest(DateTime.UtcNow, false);
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void MessageExpirationWithoutTamperResistance() {
new TestChannel(
new TestMessageFactory(),
new StandardExpirationBindingElement());
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void TooManyBindingElementsProvidingSameProtection() {
Channel channel = new TestChannel(
new TestMessageFactory(),
@@ -258,7 +258,7 @@ namespace DotNetOpenAuth.Test.Messaging {
accessor.ProcessOutgoingMessage(new TestSignedDirectedMessage());
}
- [TestMethod]
+ [TestCase]
public void BindingElementsOrdering() {
IChannelBindingElement transformA = new MockTransformationBindingElement("a");
IChannelBindingElement transformB = new MockTransformationBindingElement("b");
@@ -282,20 +282,20 @@ namespace DotNetOpenAuth.Test.Messaging {
Assert.AreSame(sign, channel.BindingElements[4]);
}
- [TestMethod, ExpectedException(typeof(UnprotectedMessageException))]
+ [TestCase, ExpectedException(typeof(UnprotectedMessageException))]
public void InsufficientlyProtectedMessageSent() {
var message = new TestSignedDirectedMessage(MessageTransport.Direct);
message.Recipient = new Uri("http://localtest");
this.Channel.PrepareResponse(message);
}
- [TestMethod, ExpectedException(typeof(UnprotectedMessageException))]
+ [TestCase, ExpectedException(typeof(UnprotectedMessageException))]
public void InsufficientlyProtectedMessageReceived() {
this.Channel = CreateChannel(MessageProtections.None, MessageProtections.TamperProtection);
this.ParameterizedReceiveProtectedTest(DateTime.Now, false);
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void IncomingMessageMissingRequiredParameters() {
var fields = GetStandardTestFields(FieldFill.IdentifiableButNotAllRequired);
this.Channel.ReadFromRequest(CreateHttpRequestInfo("GET", fields));
diff --git a/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs b/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs
index db136f5..506a6b2 100644
--- a/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs
@@ -11,7 +11,7 @@ namespace DotNetOpenAuth.Test.Messaging {
using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
internal class CollectionAssert<T> {
internal static void AreEquivalent(ICollection<T> expected, ICollection<T> actual) {
diff --git a/src/DotNetOpenAuth.Test/Messaging/EnumerableCacheTests.cs b/src/DotNetOpenAuth.Test/Messaging/EnumerableCacheTests.cs
index 55f4394..1c9f5a8 100644
--- a/src/DotNetOpenAuth.Test/Messaging/EnumerableCacheTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/EnumerableCacheTests.cs
@@ -11,12 +11,12 @@ namespace DotNetOpenAuth.Test.Messaging {
using System.Collections.ObjectModel;
using System.Linq;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
/// <summary>
/// Tests for cached enumeration.
/// </summary>
- [TestClass]
+ [TestFixture]
public class EnumerableCacheTests {
/// <summary>
/// The number of times the generator method's implementation is started.
@@ -29,20 +29,15 @@ namespace DotNetOpenAuth.Test.Messaging {
private int generatorCompleted;
/// <summary>
- /// Gets or sets the test context.
- /// </summary>
- public TestContext TestContext { get; set; }
-
- /// <summary>
/// Sets up a test.
/// </summary>
- [TestInitialize]
+ [SetUp]
public void Setup() {
this.generatorInvocations = 0;
this.generatorCompleted = 0;
}
- [TestMethod]
+ [TestCase]
public void EnumerableCache() {
// Baseline
var generator = this.NumberGenerator();
@@ -63,7 +58,7 @@ namespace DotNetOpenAuth.Test.Messaging {
CollectionAssert.AreEqual(list1, list4);
}
- [TestMethod]
+ [TestCase]
public void GeneratesOnlyRequiredElements() {
var generator = this.NumberGenerator().CacheGeneratedResults();
Assert.AreEqual(0, this.generatorInvocations);
@@ -72,28 +67,28 @@ namespace DotNetOpenAuth.Test.Messaging {
Assert.AreEqual(0, this.generatorCompleted, "Only taking part of the list should not have completed the generator.");
}
- [TestMethod]
+ [TestCase]
public void PassThruDoubleCache() {
var cache1 = this.NumberGenerator().CacheGeneratedResults();
var cache2 = cache1.CacheGeneratedResults();
Assert.AreSame(cache1, cache2, "Two caches were set up rather than just sharing the first one.");
}
- [TestMethod]
+ [TestCase]
public void PassThruList() {
var list = this.NumberGenerator().ToList();
var cache = list.CacheGeneratedResults();
Assert.AreSame(list, cache);
}
- [TestMethod]
+ [TestCase]
public void PassThruArray() {
var array = this.NumberGenerator().ToArray();
var cache = array.CacheGeneratedResults();
Assert.AreSame(array, cache);
}
- [TestMethod]
+ [TestCase]
public void PassThruCollection() {
var collection = new Collection<int>();
var cache = collection.CacheGeneratedResults();
@@ -103,7 +98,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Tests calling IEnumerator.Current before first call to MoveNext.
/// </summary>
- [TestMethod, ExpectedException(typeof(InvalidOperationException))]
+ [TestCase, ExpectedException(typeof(InvalidOperationException))]
public void EnumerableCacheCurrentThrowsBefore() {
var foo = this.NumberGenerator().CacheGeneratedResults().GetEnumerator().Current;
}
@@ -111,7 +106,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Tests calling IEnumerator.Current after MoveNext returns false.
/// </summary>
- [TestMethod, ExpectedException(typeof(InvalidOperationException))]
+ [TestCase, ExpectedException(typeof(InvalidOperationException))]
public void EnumerableCacheCurrentThrowsAfter() {
var enumerator = this.NumberGenerator().CacheGeneratedResults().GetEnumerator();
while (enumerator.MoveNext()) {
diff --git a/src/DotNetOpenAuth.Test/Messaging/ErrorUtilitiesTests.cs b/src/DotNetOpenAuth.Test/Messaging/ErrorUtilitiesTests.cs
index 36b6ae7..4408708 100644
--- a/src/DotNetOpenAuth.Test/Messaging/ErrorUtilitiesTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/ErrorUtilitiesTests.cs
@@ -7,31 +7,31 @@
namespace DotNetOpenAuth.Test.Messaging {
using System;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ErrorUtilitiesTests {
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void VerifyArgumentNotNullThrows() {
ErrorUtilities.VerifyArgumentNotNull(null, "someArg");
}
- [TestMethod]
+ [TestCase]
public void VerifyArgumentNotNullDoesNotThrow() {
ErrorUtilities.VerifyArgumentNotNull("hi", "someArg");
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void VerifyNonZeroLengthOnNull() {
ErrorUtilities.VerifyNonZeroLength(null, "someArg");
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void VerifyNonZeroLengthOnEmpty() {
ErrorUtilities.VerifyNonZeroLength(string.Empty, "someArg");
}
- [TestMethod]
+ [TestCase]
public void VerifyNonZeroLengthOnNonEmpty() {
ErrorUtilities.VerifyNonZeroLength("some Value", "someArg");
}
diff --git a/src/DotNetOpenAuth.Test/Messaging/HttpRequestInfoTests.cs b/src/DotNetOpenAuth.Test/Messaging/HttpRequestInfoTests.cs
index fd77746..0085d59 100644
--- a/src/DotNetOpenAuth.Test/Messaging/HttpRequestInfoTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/HttpRequestInfoTests.cs
@@ -9,17 +9,17 @@ namespace DotNetOpenAuth.Test.Messaging {
using System.Collections.Specialized;
using System.Web;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class HttpRequestInfoTests : TestBase {
- [TestMethod]
+ [TestCase]
public void CtorDefault() {
HttpRequestInfo info = new HttpRequestInfo();
Assert.AreEqual("GET", info.HttpMethod);
}
- [TestMethod]
+ [TestCase]
public void CtorRequest() {
HttpRequest request = new HttpRequest("file", "http://someserver?a=b", "a=b");
////request.Headers["headername"] = "headervalue"; // PlatformNotSupportedException prevents us mocking this up
@@ -33,7 +33,7 @@ namespace DotNetOpenAuth.Test.Messaging {
}
// All these tests are ineffective because ServerVariables[] cannot be set.
- ////[TestMethod]
+ ////[TestCase]
////public void CtorRequestWithDifferentPublicHttpHost() {
//// HttpRequest request = new HttpRequest("file", "http://someserver?a=b", "a=b");
//// request.ServerVariables["HTTP_HOST"] = "publichost";
@@ -44,7 +44,7 @@ namespace DotNetOpenAuth.Test.Messaging {
//// Assert.AreEqual(request.QueryString["a"], info.QueryString["a"]);
////}
- ////[TestMethod]
+ ////[TestCase]
////public void CtorRequestWithDifferentPublicHttpsHost() {
//// HttpRequest request = new HttpRequest("file", "https://someserver?a=b", "a=b");
//// request.ServerVariables["HTTP_HOST"] = "publichost";
@@ -55,7 +55,7 @@ namespace DotNetOpenAuth.Test.Messaging {
//// Assert.AreEqual(request.QueryString["a"], info.QueryString["a"]);
////}
- ////[TestMethod]
+ ////[TestCase]
////public void CtorRequestWithDifferentPublicHostNonstandardPort() {
//// HttpRequest request = new HttpRequest("file", "http://someserver?a=b", "a=b");
//// request.ServerVariables["HTTP_HOST"] = "publichost:550";
@@ -66,7 +66,7 @@ namespace DotNetOpenAuth.Test.Messaging {
//// Assert.AreEqual(request.QueryString["a"], info.QueryString["a"]);
////}
- ////[TestMethod]
+ ////[TestCase]
////public void CtorRequestWithDifferentPublicIPv6Host() {
//// HttpRequest request = new HttpRequest("file", "http://[fe80::587e:c6e5:d3aa:657a]:8089/v3.1/", "");
//// request.ServerVariables["HTTP_HOST"] = "[fe80::587e:c6e5:d3aa:657b]:8089";
@@ -80,7 +80,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// Checks that a property dependent on another null property
/// doesn't generate a NullReferenceException.
/// </summary>
- [TestMethod]
+ [TestCase]
public void QueryBeforeSettingUrl() {
HttpRequestInfo info = new HttpRequestInfo();
Assert.IsNull(info.Query);
@@ -89,7 +89,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies that looking up a querystring variable is gracefully handled without a query in the URL.
/// </summary>
- [TestMethod]
+ [TestCase]
public void QueryStringLookupWithoutQuery() {
HttpRequestInfo info = new HttpRequestInfo();
Assert.IsNull(info.QueryString["hi"]);
@@ -98,7 +98,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies SSL forwarders are correctly handled when they supply X_FORWARDED_PROTO and HOST
/// </summary>
- [TestMethod]
+ [TestCase]
public void GetPublicFacingUrlSSLForwarder1() {
HttpRequest req = new HttpRequest("a.aspx", "http://someinternalhost/a.aspx?a=b", "a=b");
var serverVariables = new NameValueCollection();
@@ -112,7 +112,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies SSL forwarders are correctly handled when they supply X_FORWARDED_PROTO and HOST:port
/// </summary>
- [TestMethod]
+ [TestCase]
public void GetPublicFacingUrlSSLForwarder2() {
HttpRequest req = new HttpRequest("a.aspx", "http://someinternalhost/a.aspx?a=b", "a=b");
var serverVariables = new NameValueCollection();
@@ -126,7 +126,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies SSL forwarders are correctly handled when they supply just HOST
/// </summary>
- [TestMethod]
+ [TestCase]
public void GetPublicFacingUrlSSLForwarder3() {
HttpRequest req = new HttpRequest("a.aspx", "http://someinternalhost/a.aspx?a=b", "a=b");
var serverVariables = new NameValueCollection();
@@ -139,7 +139,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies SSL forwarders are correctly handled when they supply just HOST:port
/// </summary>
- [TestMethod]
+ [TestCase]
public void GetPublicFacingUrlSSLForwarder4() {
HttpRequest req = new HttpRequest("a.aspx", "http://someinternalhost/a.aspx?a=b", "a=b");
var serverVariables = new NameValueCollection();
diff --git a/src/DotNetOpenAuth.Test/Messaging/MessageSerializerTests.cs b/src/DotNetOpenAuth.Test/Messaging/MessageSerializerTests.cs
index 481a715..91cccf1 100644
--- a/src/DotNetOpenAuth.Test/Messaging/MessageSerializerTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/MessageSerializerTests.cs
@@ -9,30 +9,30 @@ namespace DotNetOpenAuth.Test.Messaging {
using System.Collections.Generic;
using System.Xml;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
/// <summary>
/// Tests for the <see cref="MessageSerializer"/> class.
/// </summary>
- [TestClass()]
+ [TestFixture()]
public class MessageSerializerTests : MessagingTestBase {
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SerializeNull() {
var serializer = MessageSerializer.Get(typeof(Mocks.TestMessage));
serializer.Serialize(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void GetInvalidMessageType() {
MessageSerializer.Get(typeof(string));
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void GetNullType() {
MessageSerializer.Get(null);
}
- [TestMethod()]
+ [TestCase()]
public void SerializeTest() {
var serializer = MessageSerializer.Get(typeof(Mocks.TestMessage));
var message = GetStandardTestMessage(FieldFill.CompleteBeforeBindings);
@@ -52,13 +52,13 @@ namespace DotNetOpenAuth.Test.Messaging {
Assert.IsFalse(actual.ContainsKey("EmptyMember"));
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void DeserializeNull() {
var serializer = MessageSerializer.Get(typeof(Mocks.TestMessage));
serializer.Deserialize(null, null);
}
- [TestMethod]
+ [TestCase]
public void DeserializeSimple() {
var serializer = MessageSerializer.Get(typeof(Mocks.TestMessage));
Dictionary<string, string> fields = new Dictionary<string, string>(StringComparer.Ordinal);
@@ -81,7 +81,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// The element sorting rules are first inheritance order, then alphabetical order.
/// This test validates correct behavior on both.
/// </remarks>
- [TestMethod]
+ [TestCase]
public void DeserializeVerifyElementOrdering() {
var serializer = MessageSerializer.Get(typeof(Mocks.TestDerivedMessage));
Dictionary<string, string> fields = new Dictionary<string, string>(StringComparer.Ordinal);
@@ -105,7 +105,7 @@ namespace DotNetOpenAuth.Test.Messaging {
Assert.AreEqual("privateValue", actual.PrivatePropertyAccessor);
}
- [TestMethod]
+ [TestCase]
public void DeserializeWithExtraFields() {
var serializer = MessageSerializer.Get(typeof(Mocks.TestMessage));
Dictionary<string, string> fields = new Dictionary<string, string>(StringComparer.Ordinal);
@@ -122,7 +122,7 @@ namespace DotNetOpenAuth.Test.Messaging {
Assert.IsNull(actual.EmptyMember);
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void DeserializeInvalidMessage() {
IProtocolMessage message = new Mocks.TestDirectedMessage();
var serializer = MessageSerializer.Get(message.GetType());
diff --git a/src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs b/src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs
index accb182..af60632 100644
--- a/src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/MessagingTestBase.cs
@@ -13,7 +13,7 @@ namespace DotNetOpenAuth.Test {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
/// <summary>
/// The base class that all messaging test classes inherit from.
@@ -45,7 +45,7 @@ namespace DotNetOpenAuth.Test {
internal Channel Channel { get; set; }
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -156,7 +156,7 @@ namespace DotNetOpenAuth.Test {
IDirectedProtocolMessage requestMessage = this.Channel.ReadFromRequest(CreateHttpRequestInfo(method, fields));
Assert.IsNotNull(requestMessage);
- Assert.IsInstanceOfType(requestMessage, typeof(TestMessage));
+ Assert.IsInstanceOfType(typeof(TestMessage), requestMessage);
TestMessage actualMessage = (TestMessage)requestMessage;
Assert.AreEqual(expectedMessage.Age, actualMessage.Age);
Assert.AreEqual(expectedMessage.Name, actualMessage.Name);
@@ -174,7 +174,7 @@ namespace DotNetOpenAuth.Test {
}
IProtocolMessage requestMessage = this.Channel.ReadFromRequest(CreateHttpRequestInfo("GET", fields));
Assert.IsNotNull(requestMessage);
- Assert.IsInstanceOfType(requestMessage, typeof(TestSignedDirectedMessage));
+ Assert.IsInstanceOfType(typeof(TestSignedDirectedMessage), requestMessage);
TestSignedDirectedMessage actualMessage = (TestSignedDirectedMessage)requestMessage;
Assert.AreEqual(expectedMessage.Age, actualMessage.Age);
Assert.AreEqual(expectedMessage.Name, actualMessage.Name);
diff --git a/src/DotNetOpenAuth.Test/Messaging/MessagingUtilitiesTests.cs b/src/DotNetOpenAuth.Test/Messaging/MessagingUtilitiesTests.cs
index 26ce4cd..ce0928e 100644
--- a/src/DotNetOpenAuth.Test/Messaging/MessagingUtilitiesTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/MessagingUtilitiesTests.cs
@@ -13,11 +13,11 @@ namespace DotNetOpenAuth.Test.Messaging
using System.Net;
using System.Web;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class MessagingUtilitiesTests : TestBase {
- [TestMethod]
+ [TestCase]
public void CreateQueryString() {
var args = new Dictionary<string, string>();
args.Add("a", "b");
@@ -25,17 +25,17 @@ namespace DotNetOpenAuth.Test.Messaging
Assert.AreEqual("a=b&c%2Fd=e%2Ff", MessagingUtilities.CreateQueryString(args));
}
- [TestMethod]
+ [TestCase]
public void CreateQueryStringEmptyCollection() {
Assert.AreEqual(0, MessagingUtilities.CreateQueryString(new Dictionary<string, string>()).Length);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CreateQueryStringNullDictionary() {
MessagingUtilities.CreateQueryString(null);
}
- [TestMethod]
+ [TestCase]
public void AppendQueryArgs() {
UriBuilder uri = new UriBuilder("http://baseline.org/page");
var args = new Dictionary<string, string>();
@@ -49,17 +49,17 @@ namespace DotNetOpenAuth.Test.Messaging
Assert.AreEqual("http://baseline.org/page?a=b&c%2Fd=e%2Ff&g=h", uri.Uri.AbsoluteUri);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void AppendQueryArgsNullUriBuilder() {
MessagingUtilities.AppendQueryArgs(null, new Dictionary<string, string>());
}
- [TestMethod]
+ [TestCase]
public void AppendQueryArgsNullDictionary() {
MessagingUtilities.AppendQueryArgs(new UriBuilder(), null);
}
- [TestMethod]
+ [TestCase]
public void ToDictionary() {
NameValueCollection nvc = new NameValueCollection();
nvc["a"] = "b";
@@ -71,7 +71,7 @@ namespace DotNetOpenAuth.Test.Messaging
Assert.AreEqual(nvc["c"], actual["c"]);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void ToDictionaryWithNullKey() {
NameValueCollection nvc = new NameValueCollection();
nvc[null] = "a";
@@ -79,7 +79,7 @@ namespace DotNetOpenAuth.Test.Messaging
nvc.ToDictionary(true);
}
- [TestMethod]
+ [TestCase]
public void ToDictionaryWithSkippedNullKey() {
NameValueCollection nvc = new NameValueCollection();
nvc[null] = "a";
@@ -89,27 +89,27 @@ namespace DotNetOpenAuth.Test.Messaging
Assert.AreEqual(nvc["b"], dictionary["b"]);
}
- [TestMethod]
+ [TestCase]
public void ToDictionaryNull() {
Assert.IsNull(MessagingUtilities.ToDictionary(null));
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void ApplyHeadersToResponseNullAspNetResponse() {
MessagingUtilities.ApplyHeadersToResponse(new WebHeaderCollection(), (HttpResponse)null);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void ApplyHeadersToResponseNullListenerResponse() {
MessagingUtilities.ApplyHeadersToResponse(new WebHeaderCollection(), (HttpListenerResponse)null);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void ApplyHeadersToResponseNullHeaders() {
MessagingUtilities.ApplyHeadersToResponse(null, new HttpResponse(new StringWriter()));
}
- [TestMethod]
+ [TestCase]
public void ApplyHeadersToResponse() {
var headers = new WebHeaderCollection();
headers[HttpResponseHeader.ContentType] = "application/binary";
@@ -126,7 +126,7 @@ namespace DotNetOpenAuth.Test.Messaging
/// <remarks>
/// The tests in this method come from http://wiki.oauth.net/TestCases
/// </remarks>
- [TestMethod]
+ [TestCase]
public void EscapeUriDataStringRfc3986Tests() {
Assert.AreEqual("abcABC123", MessagingUtilities.EscapeUriDataStringRfc3986("abcABC123"));
Assert.AreEqual("-._~", MessagingUtilities.EscapeUriDataStringRfc3986("-._~"));
diff --git a/src/DotNetOpenAuth.Test/Messaging/MultiPartPostPartTests.cs b/src/DotNetOpenAuth.Test/Messaging/MultiPartPostPartTests.cs
index f87ae59..a293895 100644
--- a/src/DotNetOpenAuth.Test/Messaging/MultiPartPostPartTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/MultiPartPostPartTests.cs
@@ -11,14 +11,14 @@ namespace DotNetOpenAuth.Test.Messaging {
using System.IO;
using System.Net;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class MultipartPostPartTests : TestBase {
/// <summary>
/// Verifies that the Length property matches the length actually serialized.
/// </summary>
- [TestMethod]
+ [TestCase]
public void FormDataSerializeMatchesLength() {
var part = MultipartPostPart.CreateFormPart("a", "b");
VerifyLength(part);
@@ -27,7 +27,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies that the length property matches the length actually serialized.
/// </summary>
- [TestMethod]
+ [TestCase]
public void FileSerializeMatchesLength() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension(".txt");
@@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies MultiPartPost sends the right number of bytes.
/// </summary>
- [TestMethod]
+ [TestCase]
public void MultiPartPostAscii() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension("txt");
@@ -55,7 +55,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies MultiPartPost sends the right number of bytes.
/// </summary>
- [TestMethod]
+ [TestCase]
public void MultiPartPostMultiByteCharacters() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension("txt");
@@ -85,9 +85,9 @@ namespace DotNetOpenAuth.Test.Messaging {
bool posted = false;
handler.Callback = req => {
foreach (string header in req.Headers) {
- TestContext.WriteLine("{0}: {1}", header, req.Headers[header]);
+ TestUtilities.TestLogger.InfoFormat("{0}: {1}", header, req.Headers[header]);
}
- TestContext.WriteLine(handler.RequestEntityAsString);
+ TestUtilities.TestLogger.InfoFormat(handler.RequestEntityAsString);
Assert.AreEqual(req.ContentLength, handler.RequestEntityStream.Length);
posted = true;
return null;
diff --git a/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs b/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
index f87ae59..a293895 100644
--- a/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
@@ -11,14 +11,14 @@ namespace DotNetOpenAuth.Test.Messaging {
using System.IO;
using System.Net;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class MultipartPostPartTests : TestBase {
/// <summary>
/// Verifies that the Length property matches the length actually serialized.
/// </summary>
- [TestMethod]
+ [TestCase]
public void FormDataSerializeMatchesLength() {
var part = MultipartPostPart.CreateFormPart("a", "b");
VerifyLength(part);
@@ -27,7 +27,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies that the length property matches the length actually serialized.
/// </summary>
- [TestMethod]
+ [TestCase]
public void FileSerializeMatchesLength() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension(".txt");
@@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies MultiPartPost sends the right number of bytes.
/// </summary>
- [TestMethod]
+ [TestCase]
public void MultiPartPostAscii() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension("txt");
@@ -55,7 +55,7 @@ namespace DotNetOpenAuth.Test.Messaging {
/// <summary>
/// Verifies MultiPartPost sends the right number of bytes.
/// </summary>
- [TestMethod]
+ [TestCase]
public void MultiPartPostMultiByteCharacters() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension("txt");
@@ -85,9 +85,9 @@ namespace DotNetOpenAuth.Test.Messaging {
bool posted = false;
handler.Callback = req => {
foreach (string header in req.Headers) {
- TestContext.WriteLine("{0}: {1}", header, req.Headers[header]);
+ TestUtilities.TestLogger.InfoFormat("{0}: {1}", header, req.Headers[header]);
}
- TestContext.WriteLine(handler.RequestEntityAsString);
+ TestUtilities.TestLogger.InfoFormat(handler.RequestEntityAsString);
Assert.AreEqual(req.ContentLength, handler.RequestEntityStream.Length);
posted = true;
return null;
diff --git a/src/DotNetOpenAuth.Test/Messaging/OutgoingWebResponseTests.cs b/src/DotNetOpenAuth.Test/Messaging/OutgoingWebResponseTests.cs
index 35f9259..16576d6 100644
--- a/src/DotNetOpenAuth.Test/Messaging/OutgoingWebResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/OutgoingWebResponseTests.cs
@@ -8,14 +8,14 @@ namespace DotNetOpenAuth.Test.Messaging {
using System.Net;
using System.Text;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class OutgoingWebResponseTests {
/// <summary>
/// Verifies that setting the Body property correctly converts to a byte stream.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SetBodyToByteStream() {
var response = new OutgoingWebResponse();
string stringValue = "abc";
diff --git a/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs b/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs
index 430b929..c9e3d24 100644
--- a/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/ProtocolExceptionTests.cs
@@ -7,22 +7,22 @@
namespace DotNetOpenAuth.Test.Messaging {
using System;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ProtocolExceptionTests : TestBase {
- [TestMethod]
+ [TestCase]
public void CtorDefault() {
ProtocolException ex = new ProtocolException();
}
- [TestMethod]
+ [TestCase]
public void CtorWithTextMessage() {
ProtocolException ex = new ProtocolException("message");
Assert.AreEqual("message", ex.Message);
}
- [TestMethod]
+ [TestCase]
public void CtorWithTextMessageAndInnerException() {
Exception innerException = new Exception();
ProtocolException ex = new ProtocolException("message", innerException);
@@ -30,14 +30,14 @@ namespace DotNetOpenAuth.Test.Messaging {
Assert.AreSame(innerException, ex.InnerException);
}
- [TestMethod]
+ [TestCase]
public void CtorWithProtocolMessage() {
IProtocolMessage message = new Mocks.TestDirectedMessage();
ProtocolException ex = new ProtocolException("message", message);
Assert.AreSame(message, ex.FaultedMessage);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorWithNullProtocolMessage() {
new ProtocolException("message", (IProtocolMessage)null);
}
diff --git a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDescriptionTests.cs b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDescriptionTests.cs
index 76c454a..e57df65 100644
--- a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDescriptionTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDescriptionTests.cs
@@ -8,26 +8,26 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
using System;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class MessageDescriptionTests : MessagingTestBase {
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullType() {
new MessageDescription(null, new Version(1, 0));
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullVersion() {
new MessageDescription(typeof(Mocks.TestMessage), null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorNonMessageType() {
new MessageDescription(typeof(string), new Version(1, 0));
}
- [TestMethod]
+ [TestCase]
public void MultiVersionedMessageTest() {
var v10 = new MessageDescription(typeof(MultiVersionMessage), new Version(1, 0));
var v20 = new MessageDescription(typeof(MultiVersionMessage), new Version(2, 0));
diff --git a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs
index 24171e1..3517a2e 100644
--- a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs
@@ -12,20 +12,20 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
using System.Xml;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class MessageDictionaryTests : MessagingTestBase {
private Mocks.TestMessage message;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
this.message = new Mocks.TestDirectedMessage();
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNull() {
this.MessageDescriptions.GetAccessor(null);
}
@@ -33,7 +33,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.IDictionary&lt;System.String,System.String>.Values
/// </summary>
- [TestMethod]
+ [TestCase]
public void Values() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
Collection<string> expected = new Collection<string> {
@@ -59,7 +59,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.IDictionary&lt;System.String,System.String>.Keys
/// </summary>
- [TestMethod]
+ [TestCase]
public void Keys() {
// We expect that non-nullable value type fields will automatically have keys
// in the dictionary for them.
@@ -80,7 +80,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.IDictionary&lt;System.String,System.String>.Item
/// </summary>
- [TestMethod]
+ [TestCase]
public void Item() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
@@ -103,7 +103,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.ICollection&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.IsReadOnly
/// </summary>
- [TestMethod]
+ [TestCase]
public void IsReadOnly() {
ICollection<KeyValuePair<string, string>> target = this.MessageDescriptions.GetAccessor(this.message);
Assert.IsFalse(target.IsReadOnly);
@@ -112,7 +112,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.ICollection&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.Count
/// </summary>
- [TestMethod]
+ [TestCase]
public void Count() {
ICollection<KeyValuePair<string, string>> target = this.MessageDescriptions.GetAccessor(this.message);
IDictionary<string, string> targetDictionary = (IDictionary<string, string>)target;
@@ -124,7 +124,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.IEnumerable&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.GetEnumerator
/// </summary>
- [TestMethod]
+ [TestCase]
public void GetEnumerator() {
IEnumerable<KeyValuePair<string, string>> target = this.MessageDescriptions.GetAccessor(this.message);
IDictionary<string, string> targetDictionary = (IDictionary<string, string>)target;
@@ -147,7 +147,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
Assert.IsTrue(keysLast == valuesLast && keysLast == actualLast);
}
- [TestMethod]
+ [TestCase]
public void GetEnumeratorUntyped() {
IEnumerable target = this.MessageDescriptions.GetAccessor(this.message);
IDictionary<string, string> targetDictionary = (IDictionary<string, string>)target;
@@ -174,7 +174,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.IDictionary&lt;System.String,System.String>.TryGetValue
/// </summary>
- [TestMethod]
+ [TestCase]
public void TryGetValue() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
this.message.Name = "andrew";
@@ -194,7 +194,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.IDictionary&lt;System.String,System.String>.Remove
/// </summary>
- [TestMethod]
+ [TestCase]
public void RemoveTest1() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
this.message.Name = "andrew";
@@ -211,7 +211,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.IDictionary&lt;System.String,System.String>.ContainsKey
/// </summary>
- [TestMethod]
+ [TestCase]
public void ContainsKey() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
Assert.IsTrue(target.ContainsKey("age"), "Value type declared element should have a key.");
@@ -225,7 +225,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.IDictionary&lt;System.String,System.String&gt;.Add
/// </summary>
- [TestMethod]
+ [TestCase]
public void AddByKeyAndValue() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
target.Add("extra", "value");
@@ -234,7 +234,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
Assert.AreEqual("Andrew", this.message.Name);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void AddNullValue() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
target.Add("extra", null);
@@ -243,35 +243,35 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.ICollection&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.Add
/// </summary>
- [TestMethod]
+ [TestCase]
public void AddByKeyValuePair() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
target.Add(new KeyValuePair<string, string>("extra", "value"));
Assert.IsTrue(target.Contains(new KeyValuePair<string, string>("extra", "value")));
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void AddExtraFieldThatAlreadyExists() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
target.Add("extra", "value");
target.Add("extra", "value");
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void AddDeclaredValueThatAlreadyExists() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
target.Add("Name", "andrew");
target.Add("Name", "andrew");
}
- [TestMethod]
+ [TestCase]
public void DefaultReferenceTypeDeclaredPropertyHasNoKey() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
Assert.IsFalse(target.ContainsKey("Name"), "A null value should result in no key.");
Assert.IsFalse(target.Keys.Contains("Name"), "A null value should result in no key.");
}
- [TestMethod]
+ [TestCase]
public void RemoveStructDeclaredProperty() {
IDictionary<string, string> target = this.MessageDescriptions.GetAccessor(this.message);
this.message.Age = 5;
@@ -284,7 +284,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.ICollection&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.Remove
/// </summary>
- [TestMethod]
+ [TestCase]
public void RemoveByKeyValuePair() {
ICollection<KeyValuePair<string, string>> target = this.MessageDescriptions.GetAccessor(this.message);
this.message.Name = "Andrew";
@@ -297,7 +297,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.ICollection&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.CopyTo
/// </summary>
- [TestMethod]
+ [TestCase]
public void CopyTo() {
ICollection<KeyValuePair<string, string>> target = this.MessageDescriptions.GetAccessor(this.message);
IDictionary<string, string> targetAsDictionary = ((IDictionary<string, string>)target);
@@ -314,7 +314,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.ICollection&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.Contains
/// </summary>
- [TestMethod]
+ [TestCase]
public void ContainsKeyValuePair() {
ICollection<KeyValuePair<string, string>> target = this.MessageDescriptions.GetAccessor(this.message);
IDictionary<string, string> targetAsDictionary = ((IDictionary<string, string>)target);
@@ -330,7 +330,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// A test for System.Collections.Generic.ICollection&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.Clear
/// </summary>
- [TestMethod]
+ [TestCase]
public void ClearValues() {
MessageDictionary target = this.MessageDescriptions.GetAccessor(this.message);
IDictionary<string, string> targetAsDictionary = ((IDictionary<string, string>)target);
@@ -347,7 +347,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// <summary>
/// Verifies that the Clear method throws the expected exception.
/// </summary>
- [TestMethod, ExpectedException(typeof(NotSupportedException))]
+ [TestCase, ExpectedException(typeof(NotSupportedException))]
public void Clear() {
MessageDictionary target = this.MessageDescriptions.GetAccessor(this.message);
target.Clear();
diff --git a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs
index 19e6a82..524f440 100644
--- a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessagePartTests.cs
@@ -12,42 +12,42 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class MessagePartTests : MessagingTestBase {
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void OptionalNonNullableStruct() {
this.ParameterizedMessageTypeTest(typeof(MessageWithNonNullableOptionalStruct));
}
- [TestMethod]
+ [TestCase]
public void RequiredNonNullableStruct() {
this.ParameterizedMessageTypeTest(typeof(MessageWithNonNullableRequiredStruct));
}
- [TestMethod]
+ [TestCase]
public void OptionalNullableStruct() {
this.ParameterizedMessageTypeTest(typeof(MessageWithNullableOptionalStruct));
}
- [TestMethod]
+ [TestCase]
public void RequiredNullableStruct() {
this.ParameterizedMessageTypeTest(typeof(MessageWithNullableRequiredStruct));
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullMember() {
new MessagePart(null, new MessagePartAttribute());
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullAttribute() {
PropertyInfo field = typeof(MessageWithNullableOptionalStruct).GetProperty("OptionalInt", BindingFlags.NonPublic | BindingFlags.Instance);
new MessagePart(field, null);
}
- [TestMethod]
+ [TestCase]
public void SetValue() {
var message = new MessageWithNonNullableRequiredStruct();
MessagePart part = this.ParameterizedMessageTypeTest(message.GetType());
@@ -55,7 +55,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
Assert.AreEqual(5, message.OptionalInt);
}
- [TestMethod]
+ [TestCase]
public void GetValue() {
var message = new MessageWithNonNullableRequiredStruct();
message.OptionalInt = 8;
@@ -63,7 +63,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
Assert.AreEqual("8", part.GetValue(message));
}
- [TestMethod]
+ [TestCase]
public void Base64Member() {
var message = new MessageWithBase64EncodedString();
message.LastName = "andrew";
@@ -73,7 +73,7 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
Assert.AreEqual("arnott", message.LastName);
}
- [TestMethod]
+ [TestCase]
public void ConstantFieldMemberValidValues() {
var message = new MessageWithConstantField();
MessagePart part = GetMessagePart(message.GetType(), "ConstantField");
@@ -82,20 +82,20 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
Assert.AreEqual("abc", part.GetValue(message));
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void ConstantFieldMemberInvalidValues() {
var message = new MessageWithConstantField();
MessagePart part = GetMessagePart(message.GetType(), "ConstantField");
part.SetValue(message, "def");
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void NonFieldOrPropertyMember() {
MemberInfo method = typeof(MessageWithNullableOptionalStruct).GetMethod("Equals", BindingFlags.Public | BindingFlags.Instance);
new MessagePart(method, new MessagePartAttribute());
}
- [TestMethod]
+ [TestCase]
public void RequiredMinAndMaxVersions() {
Type messageType = typeof(MessageWithMinAndMaxVersionParts);
FieldInfo newIn2Field = messageType.GetField("NewIn2", BindingFlags.Public | BindingFlags.Instance);
diff --git a/src/DotNetOpenAuth.Test/Messaging/Reflection/ValueMappingTests.cs b/src/DotNetOpenAuth.Test/Messaging/Reflection/ValueMappingTests.cs
index c4a79b5..d556b11 100644
--- a/src/DotNetOpenAuth.Test/Messaging/Reflection/ValueMappingTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/Reflection/ValueMappingTests.cs
@@ -7,16 +7,16 @@
namespace DotNetOpenAuth.Test.Messaging.Reflection {
using System;
using DotNetOpenAuth.Messaging.Reflection;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ValueMappingTests {
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullToString() {
new ValueMapping(null, str => new object());
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullToObject() {
new ValueMapping(obj => obj.ToString(), null);
}
diff --git a/src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs b/src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs
index 89d165a..63be45a 100644
--- a/src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/ResponseTests.cs
@@ -9,17 +9,17 @@ namespace DotNetOpenAuth.Test.Messaging {
using System.IO;
using System.Web;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ResponseTests : TestBase {
- [TestMethod, ExpectedException(typeof(InvalidOperationException))]
+ [TestCase, ExpectedException(typeof(InvalidOperationException))]
public void SendWithoutAspNetContext() {
HttpContext.Current = null;
new OutgoingWebResponse().Send();
}
- [TestMethod]
+ [TestCase]
public void Send() {
StringWriter writer = new StringWriter();
HttpRequest httpRequest = new HttpRequest("file", "http://server", string.Empty);
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
index 16386de..0bb35bc 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
@@ -14,7 +14,7 @@ namespace DotNetOpenAuth.Test.Mocks {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.Test.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
internal class CoordinatingChannel : Channel {
/// <summary>
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockReplayProtectionBindingElement.cs b/src/DotNetOpenAuth.Test/Mocks/MockReplayProtectionBindingElement.cs
index 75281e2..96bd40d 100644
--- a/src/DotNetOpenAuth.Test/Mocks/MockReplayProtectionBindingElement.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/MockReplayProtectionBindingElement.cs
@@ -7,7 +7,7 @@
namespace DotNetOpenAuth.Test.Mocks {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
internal class MockReplayProtectionBindingElement : IChannelBindingElement {
private bool messageReceived;
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockTransformationBindingElement.cs b/src/DotNetOpenAuth.Test/Mocks/MockTransformationBindingElement.cs
index e88fe52..1db9c68 100644
--- a/src/DotNetOpenAuth.Test/Mocks/MockTransformationBindingElement.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/MockTransformationBindingElement.cs
@@ -10,7 +10,7 @@ namespace DotNetOpenAuth.Test.Mocks {
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
internal class MockTransformationBindingElement : IChannelBindingElement {
private string transform;
@@ -47,7 +47,7 @@ namespace DotNetOpenAuth.Test.Mocks {
MessageProtections? IChannelBindingElement.ProcessIncomingMessage(IProtocolMessage message) {
var testMessage = message as TestMessage;
if (testMessage != null) {
- StringAssert.StartsWith(testMessage.Name, this.transform);
+ StringAssert.StartsWith(this.transform, testMessage.Name);
testMessage.Name = testMessage.Name.Substring(this.transform.Length);
return MessageProtections.None;
}
diff --git a/src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs b/src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs
index c009a83..5584a7b 100644
--- a/src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/AppendixScenarios.cs
@@ -12,11 +12,11 @@ namespace DotNetOpenAuth.Test.OAuth {
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AppendixScenarios : TestBase {
- [TestMethod]
+ [TestCase]
public void SpecAppendixAExample() {
ServiceProviderDescription serviceDescription = new ServiceProviderDescription() {
RequestTokenEndpoint = new MessageReceivingEndpoint("https://photos.example.net/request_token", HttpDeliveryMethods.PostRequest),
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs
index fcdb5e8..a11c67d 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs
@@ -8,11 +8,11 @@ namespace DotNetOpenAuth.Test.ChannelElements {
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class HmacSha1SigningBindingElementTests : MessagingTestBase {
- [TestMethod]
+ [TestCase]
public void SignatureTest() {
UnauthorizedTokenRequest message = SigningBindingElementBaseTests.CreateTestRequestTokenMessage(this.MessageDescriptions, null);
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
index e0cc92a..d854ee3 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
@@ -19,9 +19,9 @@ namespace DotNetOpenAuth.Test.ChannelElements {
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class OAuthChannelTests : TestBase {
private OAuthChannel channel;
private OAuthChannel_Accessor accessor;
@@ -29,7 +29,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
private SigningBindingElementBase signingElement;
private INonceStore nonceStore;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -41,32 +41,32 @@ namespace DotNetOpenAuth.Test.ChannelElements {
this.channel.WebRequestHandler = this.webRequestHandler;
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullSigner() {
new OAuthChannel(null, this.nonceStore, new InMemoryTokenManager(), new TestMessageFactory());
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullStore() {
new OAuthChannel(new RsaSha1SigningBindingElement(new InMemoryTokenManager()), null, new InMemoryTokenManager(), new TestMessageFactory());
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullTokenManager() {
new OAuthChannel(new RsaSha1SigningBindingElement(new InMemoryTokenManager()), this.nonceStore, null, new TestMessageFactory());
}
- [TestMethod]
+ [TestCase]
public void CtorSimpleConsumer() {
new OAuthChannel(new RsaSha1SigningBindingElement(new InMemoryTokenManager()), this.nonceStore, (IConsumerTokenManager)new InMemoryTokenManager());
}
- [TestMethod]
+ [TestCase]
public void CtorSimpleServiceProvider() {
new OAuthChannel(new RsaSha1SigningBindingElement(new InMemoryTokenManager()), this.nonceStore, (IServiceProviderTokenManager)new InMemoryTokenManager());
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestAuthorization() {
this.ParameterizedReceiveTest(HttpDeliveryMethods.AuthorizationHeaderRequest);
}
@@ -75,7 +75,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
/// Verifies that the OAuth ReadFromRequest method gathers parameters
/// from the Authorization header, the query string and the entity form data.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ReadFromRequestAuthorizationScattered() {
// Start by creating a standard POST HTTP request.
var fields = new Dictionary<string, string> {
@@ -99,24 +99,24 @@ namespace DotNetOpenAuth.Test.ChannelElements {
IDirectedProtocolMessage requestMessage = this.channel.ReadFromRequest(requestInfo);
Assert.IsNotNull(requestMessage);
- Assert.IsInstanceOfType(requestMessage, typeof(TestMessage));
+ Assert.IsInstanceOfType(typeof(TestMessage), requestMessage);
TestMessage testMessage = (TestMessage)requestMessage;
Assert.AreEqual(15, testMessage.Age);
Assert.AreEqual("Andrew", testMessage.Name);
Assert.AreEqual("http://hostb/pathB", testMessage.Location.AbsoluteUri);
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestForm() {
this.ParameterizedReceiveTest(HttpDeliveryMethods.PostRequest);
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestQueryString() {
this.ParameterizedReceiveTest(HttpDeliveryMethods.GetRequest);
}
- [TestMethod]
+ [TestCase]
public void SendDirectMessageResponse() {
IProtocolMessage message = new TestDirectedMessage {
Age = 15,
@@ -135,7 +135,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.AreEqual("http://hostb/pathB", body["Location"]);
}
- [TestMethod]
+ [TestCase]
public void ReadFromResponse() {
var fields = new Dictionary<string, string> {
{ "age", "15" },
@@ -157,18 +157,18 @@ namespace DotNetOpenAuth.Test.ChannelElements {
}
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void RequestNull() {
this.channel.Request(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void RequestNullRecipient() {
IDirectedProtocolMessage message = new TestDirectedMessage(MessageTransport.Direct);
this.channel.Request(message);
}
- [TestMethod, ExpectedException(typeof(NotSupportedException))]
+ [TestCase, ExpectedException(typeof(NotSupportedException))]
public void RequestBadPreferredScheme() {
TestDirectedMessage message = new TestDirectedMessage(MessageTransport.Direct);
message.Recipient = new Uri("http://localtest");
@@ -176,7 +176,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
this.channel.Request(message);
}
- [TestMethod]
+ [TestCase]
public void RequestUsingAuthorizationHeader() {
this.ParameterizedRequestTest(HttpDeliveryMethods.AuthorizationHeaderRequest);
}
@@ -184,7 +184,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
/// <summary>
/// Verifies that message parts can be distributed to the query, form, and Authorization header.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RequestUsingAuthorizationHeaderScattered() {
TestDirectedMessage request = new TestDirectedMessage(MessageTransport.Direct) {
Age = 15,
@@ -217,12 +217,12 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.AreEqual("appearinform=formish", this.webRequestHandler.RequestEntityAsString);
}
- [TestMethod]
+ [TestCase]
public void RequestUsingGet() {
this.ParameterizedRequestTest(HttpDeliveryMethods.GetRequest);
}
- [TestMethod]
+ [TestCase]
public void RequestUsingPost() {
this.ParameterizedRequestTest(HttpDeliveryMethods.PostRequest);
}
@@ -230,7 +230,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
/// <summary>
/// Verifies that messages asking for special HTTP status codes get them.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SendDirectMessageResponseHonorsHttpStatusCodes() {
IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired);
OutgoingWebResponse directResponse = this.accessor.PrepareDirectResponse(message);
@@ -344,7 +344,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
IProtocolMessage response = this.channel.Request(request);
Assert.IsNotNull(response);
- Assert.IsInstanceOfType(response, typeof(TestMessage));
+ Assert.IsInstanceOfType(typeof(TestMessage), response);
TestMessage responseMessage = (TestMessage)response;
Assert.AreEqual(request.Age, responseMessage.Age);
Assert.AreEqual(request.Name, responseMessage.Name);
@@ -360,7 +360,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
};
IProtocolMessage requestMessage = this.channel.ReadFromRequest(CreateHttpRequestInfo(scheme, fields));
Assert.IsNotNull(requestMessage);
- Assert.IsInstanceOfType(requestMessage, typeof(TestMessage));
+ Assert.IsInstanceOfType(typeof(TestMessage), requestMessage);
TestMessage testMessage = (TestMessage)requestMessage;
Assert.AreEqual(15, testMessage.Age);
Assert.AreEqual("Andrew", testMessage.Name);
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
index 01d51a3..b81eefa 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
@@ -10,11 +10,11 @@ namespace DotNetOpenAuth.Test.ChannelElements {
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class PlaintextSigningBindingElementTest {
- [TestMethod]
+ [TestCase]
public void HttpsSignatureGeneration() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
@@ -27,7 +27,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.AreEqual("cs&ts", message.Signature);
}
- [TestMethod]
+ [TestCase]
public void HttpsSignatureVerification() {
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
ITamperProtectionChannelBindingElement target = new PlaintextSigningBindingElement();
@@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.IsNotNull(target.ProcessIncomingMessage(message));
}
- [TestMethod]
+ [TestCase]
public void HttpsSignatureVerificationNotApplicable() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
@@ -53,7 +53,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.AreEqual(MessageProtections.None, target.ProcessIncomingMessage(message), "PLAINTEXT binding element should opt-out where it doesn't understand.");
}
- [TestMethod]
+ [TestCase]
public void HttpSignatureGeneration() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
@@ -68,7 +68,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.IsNull(message.Signature);
}
- [TestMethod]
+ [TestCase]
public void HttpSignatureVerification() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
index 6e566c8..c2ae65e 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
@@ -10,11 +10,11 @@ namespace DotNetOpenAuth.Test.ChannelElements {
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class SigningBindingElementBaseTests : MessagingTestBase {
- [TestMethod]
+ [TestCase]
public void BaseSignatureStringTest() {
// Tests a message sent by HTTP GET, with no query string included in the endpoint.
UnauthorizedTokenRequest message = CreateTestRequestTokenMessage(
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs
index 40fc93e..715669a 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs
@@ -10,13 +10,13 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
using System.Linq;
using System.Text;
using DotNetOpenAuth.OAuth.ChannelElements;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class UriOrOobEncodingTests : TestBase {
private UriOrOobEncoding encoding;
- [TestInitialize]
+ [SetUp]
public void Setup() {
this.encoding = new UriOrOobEncoding();
}
@@ -24,7 +24,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies null value encoding
/// </summary>
- [TestMethod]
+ [TestCase]
public void NullValueEncoding() {
Assert.AreEqual("oob", this.encoding.EncodedNullValue);
}
@@ -32,7 +32,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies decoding "oob" results in a null uri.
/// </summary>
- [TestMethod]
+ [TestCase]
public void DecodeOobToNullUri() {
Assert.IsNull(this.encoding.Decode("oob"));
}
@@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies that decoding an empty string generates an exception.
/// </summary>
- [TestMethod, ExpectedException(typeof(UriFormatException))]
+ [TestCase, ExpectedException(typeof(UriFormatException))]
public void DecodeEmptyStringFails() {
this.encoding.Decode(string.Empty);
}
@@ -48,7 +48,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies proper decoding/encoding of a Uri
/// </summary>
- [TestMethod]
+ [TestCase]
public void UriEncodeDecode() {
Uri original = new Uri("http://somehost/p?q=a#frag");
string encodedValue = this.encoding.Encode(original);
@@ -60,7 +60,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies failure to decode a relative Uri
/// </summary>
- [TestMethod, ExpectedException(typeof(UriFormatException))]
+ [TestCase, ExpectedException(typeof(UriFormatException))]
public void RelativeUriDecodeFails() {
this.encoding.Decode("../a/b");
}
diff --git a/src/DotNetOpenAuth.Test/OAuth/ProtocolTests.cs b/src/DotNetOpenAuth.Test/OAuth/ProtocolTests.cs
index ce8070b..f866990 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ProtocolTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ProtocolTests.cs
@@ -6,27 +6,27 @@
namespace DotNetOpenAuth.Test {
using DotNetOpenAuth.OAuth;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ProtocolTests {
- [TestMethod]
+ [TestCase]
public void Default() {
Assert.AreSame(Protocol.V10a, Protocol.Default);
}
- [TestMethod]
+ [TestCase]
public void DataContractNamespace() {
Assert.AreEqual("http://oauth.net/core/1.0/", Protocol.V10.DataContractNamespace);
Assert.AreEqual("http://oauth.net/core/1.0/", Protocol.DataContractNamespaceV10);
}
- [TestMethod]
+ [TestCase]
public void AuthorizationHeaderScheme() {
Assert.AreEqual("OAuth", Protocol.AuthorizationHeaderScheme);
}
- [TestMethod]
+ [TestCase]
public void ParameterPrefix() {
Assert.AreEqual("oauth_", Protocol.ParameterPrefix);
}
diff --git a/src/DotNetOpenAuth.Test/OAuth/ServiceProviderDescriptionTests.cs b/src/DotNetOpenAuth.Test/OAuth/ServiceProviderDescriptionTests.cs
index 760a9e9..4ed1c74 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ServiceProviderDescriptionTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ServiceProviderDescriptionTests.cs
@@ -8,17 +8,17 @@ namespace DotNetOpenAuth.Test {
using System;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
/// <summary>
/// Tests for the <see cref="ServiceProviderEndpoints"/> class.
/// </summary>
- [TestClass]
+ [TestFixture]
public class ServiceProviderDescriptionTests : TestBase {
/// <summary>
/// A test for UserAuthorizationUri
/// </summary>
- [TestMethod]
+ [TestCase]
public void UserAuthorizationUriTest() {
ServiceProviderDescription target = new ServiceProviderDescription();
MessageReceivingEndpoint expected = new MessageReceivingEndpoint("http://localhost/authorization", HttpDeliveryMethods.GetRequest);
@@ -34,7 +34,7 @@ namespace DotNetOpenAuth.Test {
/// <summary>
/// A test for RequestTokenUri
/// </summary>
- [TestMethod]
+ [TestCase]
public void RequestTokenUriTest() {
var target = new ServiceProviderDescription();
MessageReceivingEndpoint expected = new MessageReceivingEndpoint("http://localhost/requesttoken", HttpDeliveryMethods.GetRequest);
@@ -51,7 +51,7 @@ namespace DotNetOpenAuth.Test {
/// Verifies that oauth parameters are not allowed in <see cref="ServiceProvider.RequestTokenUri"/>,
/// per section OAuth 1.0 section 4.1.
/// </summary>
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void RequestTokenUriWithOAuthParametersTest() {
var target = new ServiceProviderDescription();
target.RequestTokenEndpoint = new MessageReceivingEndpoint("http://localhost/requesttoken?oauth_token=something", HttpDeliveryMethods.GetRequest);
@@ -60,7 +60,7 @@ namespace DotNetOpenAuth.Test {
/// <summary>
/// A test for AccessTokenUri
/// </summary>
- [TestMethod]
+ [TestCase]
public void AccessTokenUriTest() {
var target = new ServiceProviderDescription();
MessageReceivingEndpoint expected = new MessageReceivingEndpoint("http://localhost/accesstoken", HttpDeliveryMethods.GetRequest);
diff --git a/src/DotNetOpenAuth.Test/OAuth/ServiceProviderTests.cs b/src/DotNetOpenAuth.Test/OAuth/ServiceProviderTests.cs
index 2a443ce..ceb9a60 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ServiceProviderTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ServiceProviderTests.cs
@@ -11,14 +11,14 @@ namespace DotNetOpenAuth.Test.OAuth {
using System.Text;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ServiceProviderTests : TestBase {
/// <summary>
/// Verifies the CreateVerificationCode method.
/// </summary>
- [TestMethod]
+ [TestCase]
public void CreateVerificationCode() {
this.TestCode(VerificationCodeFormat.Numeric, 3, MessagingUtilities.Digits);
this.TestCode(VerificationCodeFormat.AlphaLower, 5, MessagingUtilities.LowercaseLetters);
@@ -28,7 +28,7 @@ namespace DotNetOpenAuth.Test.OAuth {
private void TestCode(VerificationCodeFormat format, int length, string allowableCharacters) {
string code = ServiceProvider.CreateVerificationCode(format, length);
- TestContext.WriteLine("{0} of length {2}: {1}", format, code, length);
+ TestUtilities.TestLogger.InfoFormat("{0} of length {2}: {1}", format, code, length);
Assert.AreEqual(length, code.Length);
foreach (char ch in code) {
Assert.IsTrue(allowableCharacters.Contains(ch));
diff --git a/src/DotNetOpenAuth.Test/OpenId/AssociationHandshakeTests.cs b/src/DotNetOpenAuth.Test/OpenId/AssociationHandshakeTests.cs
index a9d2f56..5753e39 100644
--- a/src/DotNetOpenAuth.Test/OpenId/AssociationHandshakeTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/AssociationHandshakeTests.cs
@@ -12,21 +12,21 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AssociationHandshakeTests : OpenIdTestBase {
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
- [TestMethod]
+ [TestCase]
public void AssociateUnencrypted() {
this.ParameterizedAssociationTest(new Uri("https://host"));
}
- [TestMethod]
+ [TestCase]
public void AssociateDiffieHellmanOverHttp() {
this.ParameterizedAssociationTest(new Uri("http://host"));
}
@@ -38,7 +38,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// Some OPs out there flatly refuse to do this, and the spec doesn't forbid
/// putting the two together, so we verify that DNOI can handle it.
/// </remarks>
- [TestMethod]
+ [TestCase]
public void AssociateDiffieHellmanOverHttps() {
Protocol protocol = Protocol.V20;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -62,7 +62,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// Verifies that the RP and OP can renegotiate an association type if the RP's
/// initial request for an association is for a type the OP doesn't support.
/// </summary>
- [TestMethod]
+ [TestCase]
public void AssociateRenegotiateBitLength() {
Protocol protocol = Protocol.V20;
@@ -110,7 +110,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <remarks>
/// Verifies OP's compliance with OpenID 2.0 section 8.4.1.
/// </remarks>
- [TestMethod]
+ [TestCase]
public void OPRejectsHttpNoEncryptionAssociateRequests() {
Protocol protocol = Protocol.V20;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -131,7 +131,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// Verifies that the OP rejects an associate request
/// when the HMAC and DH bit lengths do not match.
/// </summary>
- [TestMethod]
+ [TestCase]
public void OPRejectsMismatchingAssociationAndSessionTypes() {
Protocol protocol = Protocol.V20;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -154,7 +154,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that the RP quietly rejects an OP that suggests an unknown association type.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RPRejectsUnrecognizedAssociationType() {
Protocol protocol = Protocol.V20;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -181,7 +181,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <remarks>
/// Verifies RP's compliance with OpenID 2.0 section 8.4.1.
/// </remarks>
- [TestMethod]
+ [TestCase]
public void RPRejectsUnencryptedSuggestion() {
Protocol protocol = Protocol.V20;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -206,7 +206,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// Verifies that the RP rejects an associate renegotiate request
/// when the HMAC and DH bit lengths do not match.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RPRejectsMismatchingAssociationAndSessionBitLengths() {
Protocol protocol = Protocol.V20;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -231,7 +231,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// Verifies that the RP cannot get caught in an infinite loop if a bad OP
/// keeps sending it association retry messages.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RPOnlyRenegotiatesOnce() {
Protocol protocol = Protocol.V20;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -264,7 +264,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies security settings limit RP's acceptance of OP's counter-suggestion
/// </summary>
- [TestMethod]
+ [TestCase]
public void AssociateRenegotiateLimitedByRPSecuritySettings() {
Protocol protocol = Protocol.V20;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -284,7 +284,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// Verifies that the RP can recover from an invalid or non-existent
/// response from the OP, for example in the HTTP timeout case.
/// </summary>
- [TestMethod]
+ [TestCase]
public void AssociateQuietlyFailsAfterHttpError() {
this.MockResponder.RegisterMockNotFound(OPUri);
var rp = this.CreateRelyingParty();
@@ -367,11 +367,11 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.IsTrue(MessagingUtilities.AreEquivalent(opAssociation.SecretKey, rpAssociation.SecretKey));
if (expectDiffieHellman) {
- Assert.IsInstanceOfType(associateSuccessfulResponse, typeof(AssociateDiffieHellmanResponse));
+ Assert.IsInstanceOfType(typeof(AssociateDiffieHellmanResponse), associateSuccessfulResponse);
var diffieHellmanResponse = (AssociateDiffieHellmanResponse)associateSuccessfulResponse;
Assert.IsFalse(MessagingUtilities.AreEquivalent(diffieHellmanResponse.EncodedMacKey, rpAssociation.SecretKey), "Key should have been encrypted.");
} else {
- Assert.IsInstanceOfType(associateSuccessfulResponse, typeof(AssociateUnencryptedResponse));
+ Assert.IsInstanceOfType(typeof(AssociateUnencryptedResponse), associateSuccessfulResponse);
var unencryptedResponse = (AssociateUnencryptedResponse)associateSuccessfulResponse;
}
} else {
diff --git a/src/DotNetOpenAuth.Test/OpenId/AssociationTests.cs b/src/DotNetOpenAuth.Test/OpenId/AssociationTests.cs
index 6881255..a70189f 100644
--- a/src/DotNetOpenAuth.Test/OpenId/AssociationTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/AssociationTests.cs
@@ -12,16 +12,16 @@ namespace DotNetOpenAuth.Test.OpenId {
using System.Text;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AssociationTests : OpenIdTestBase {
private static readonly TimeSpan deltaDateTime = TimeSpan.FromSeconds(2);
private static readonly HashAlgorithm sha1 = DiffieHellmanUtilities.Lookup(Protocol.Default, Protocol.Default.Args.SessionType.DH_SHA1);
private byte[] sha1Secret;
private byte[] sha1Secret2;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -35,7 +35,7 @@ namespace DotNetOpenAuth.Test.OpenId {
this.sha1Secret2[1] = 0xcc;
}
- [TestMethod]
+ [TestCase]
public void Properties() {
string handle = "somehandle";
TimeSpan lifetime = TimeSpan.FromMinutes(2);
@@ -49,7 +49,7 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.AreEqual(0, assoc.Issued.Millisecond, "No milliseconds because this can be cut off in conversions.");
}
- [TestMethod]
+ [TestCase]
public void Sign() {
Association assoc1 = HmacShaAssociation.Create(Protocol.Default, Protocol.Default.Args.SignatureAlgorithm.HMAC_SHA1, "h1", this.sha1Secret, TimeSpan.FromMinutes(2));
Association assoc2 = HmacShaAssociation.Create(Protocol.Default, Protocol.Default.Args.SignatureAlgorithm.HMAC_SHA1, "h2", this.sha1Secret2, TimeSpan.FromMinutes(2));
diff --git a/src/DotNetOpenAuth.Test/OpenId/AssociationsTests.cs b/src/DotNetOpenAuth.Test/OpenId/AssociationsTests.cs
index a0c4770..b3d7e4d 100644
--- a/src/DotNetOpenAuth.Test/OpenId/AssociationsTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/AssociationsTests.cs
@@ -11,31 +11,31 @@ namespace DotNetOpenAuth.Test.OpenId {
using System.Security.Cryptography;
using System.Text;
using DotNetOpenAuth.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AssociationsTests : OpenIdTestBase {
private static readonly HashAlgorithm sha1 = DiffieHellmanUtilities.Lookup(Protocol.Default, Protocol.Default.Args.SessionType.DH_SHA1);
private byte[] sha1Secret;
private Associations assocs;
- [TestInitialize]
+ [TestFixtureSetUp]
public override void SetUp() {
this.sha1Secret = new byte[sha1.HashSize / 8];
this.assocs = new Associations();
}
- [TestMethod]
+ [TestCase]
public void GetNonexistentHandle() {
Assert.IsNull(this.assocs.Get("someinvalidhandle"));
}
- [TestMethod]
+ [TestCase]
public void RemoveNonexistentHandle() {
Assert.IsFalse(this.assocs.Remove("someinvalidhandle"));
}
- [TestMethod]
+ [TestCase]
public void HandleLifecycle() {
Association a = HmacShaAssociation.Create(
Protocol.Default,
@@ -50,7 +50,7 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.IsFalse(this.assocs.Remove(a.Handle));
}
- [TestMethod]
+ [TestCase]
public void Best() {
Association a = HmacShaAssociation.Create(
Protocol.Default,
diff --git a/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs b/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs
index 7de2a8b..27db93e 100644
--- a/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs
@@ -14,16 +14,16 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AuthenticationTests : OpenIdTestBase {
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
- [TestMethod]
+ [TestCase]
public void SharedAssociationPositive() {
this.ParameterizedAuthenticationTest(true, true, false);
}
@@ -31,17 +31,17 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that a shared association protects against tampering.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SharedAssociationTampered() {
this.ParameterizedAuthenticationTest(true, true, true);
}
- [TestMethod]
+ [TestCase]
public void SharedAssociationNegative() {
this.ParameterizedAuthenticationTest(true, false, false);
}
- [TestMethod]
+ [TestCase]
public void PrivateAssociationPositive() {
this.ParameterizedAuthenticationTest(false, true, false);
}
@@ -49,17 +49,17 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that a private association protects against tampering.
/// </summary>
- [TestMethod]
+ [TestCase]
public void PrivateAssociationTampered() {
this.ParameterizedAuthenticationTest(false, true, true);
}
- [TestMethod]
+ [TestCase]
public void NoAssociationNegative() {
this.ParameterizedAuthenticationTest(false, false, false);
}
- [TestMethod]
+ [TestCase]
public void UnsolicitedAssertion() {
this.MockResponder.RegisterMockRPDiscovery();
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -77,7 +77,7 @@ namespace DotNetOpenAuth.Test.OpenId {
coordinator.Run();
}
- [TestMethod]
+ [TestCase]
public void UnsolicitedAssertionRejected() {
this.MockResponder.RegisterMockRPDiscovery();
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -100,7 +100,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// Verifies that delegating identifiers are rejected in unsolicited assertions
/// when the appropriate security setting is set.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnsolicitedDelegatingIdentifierRejection() {
this.MockResponder.RegisterMockRPDiscovery();
OpenIdCoordinator coordinator = new OpenIdCoordinator(
diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
index 29797dc..7de32df 100644
--- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
@@ -18,15 +18,15 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Mocks;
using DotNetOpenAuth.Test.OpenId.Extensions;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ExtensionsBindingElementTests : OpenIdTestBase {
private StandardOpenIdExtensionFactory factory;
private ExtensionsBindingElement rpElement;
private IProtocolMessageWithExtensions request;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -37,7 +37,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
this.request = new SignedResponseRequest(Protocol.Default.Version, OpenIdTestBase.OPUri, AuthenticationRequestMode.Immediate);
}
- [TestMethod]
+ [TestCase]
public void RoundTripFullStackTest() {
IOpenIdMessageExtension request = new MockOpenIdExtension("requestPart", "requestData");
IOpenIdMessageExtension response = new MockOpenIdExtension("responsePart", "responseData");
@@ -47,12 +47,12 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
new IOpenIdMessageExtension[] { response });
}
- [TestMethod]
+ [TestCase]
public void ExtensionFactory() {
Assert.AreSame(this.factory, this.rpElement.ExtensionFactory);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void PrepareMessageForSendingNull() {
this.rpElement.ProcessOutgoingMessage(null);
}
@@ -60,13 +60,13 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// <summary>
/// Verifies that false is returned when a non-extendable message is sent.
/// </summary>
- [TestMethod]
+ [TestCase]
public void PrepareMessageForSendingNonExtendableMessage() {
IProtocolMessage request = new AssociateDiffieHellmanRequest(Protocol.Default.Version, OpenIdTestBase.OPUri);
Assert.IsNull(this.rpElement.ProcessOutgoingMessage(request));
}
- [TestMethod]
+ [TestCase]
public void PrepareMessageForSending() {
this.request.Extensions.Add(new MockOpenIdExtension("part", "extra"));
Assert.IsNotNull(this.rpElement.ProcessOutgoingMessage(this.request));
@@ -77,7 +77,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
Assert.AreEqual("extra", this.request.ExtraData["openid." + alias + ".data"]);
}
- [TestMethod]
+ [TestCase]
public void PrepareMessageForReceiving() {
this.request.ExtraData["openid.ns.mock"] = MockOpenIdExtension.MockTypeUri;
this.request.ExtraData["openid.mock.Part"] = "part";
@@ -91,7 +91,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// <summary>
/// Verifies that extension responses are included in the OP's signature.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ExtensionResponsesAreSigned() {
Protocol protocol = Protocol.Default;
var op = this.CreateProvider();
@@ -113,7 +113,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// <summary>
/// Verifies that unsigned extension responses (where any or all fields are unsigned) are ignored.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ExtensionsAreIdentifiedAsSignedOrUnsigned() {
Protocol protocol = Protocol.Default;
OpenIdCoordinator coordinator = new OpenIdCoordinator(
@@ -144,7 +144,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// OpenID Authentication 2.0 section 12 states that
/// "A namespace MUST NOT be assigned more than one alias in the same message".
/// </remarks>
- [TestMethod]
+ [TestCase]
public void TwoExtensionsSameTypeUri() {
IOpenIdMessageExtension request1 = new MockOpenIdExtension("requestPart1", "requestData1");
IOpenIdMessageExtension request2 = new MockOpenIdExtension("requestPart2", "requestData2");
@@ -154,8 +154,8 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
new IOpenIdMessageExtension[] { request1, request2 },
new IOpenIdMessageExtension[0]);
Assert.Fail("Expected ProtocolException not thrown.");
- } catch (AssertFailedException ex) {
- Assert.IsInstanceOfType(ex.InnerException, typeof(ProtocolException));
+ } catch (AssertionException ex) {
+ Assert.IsInstanceOfType(typeof(ProtocolException), ex.InnerException);
}
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/KeyValueFormEncodingTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/KeyValueFormEncodingTests.cs
index 92170c4..75ac503 100644
--- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/KeyValueFormEncodingTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/KeyValueFormEncodingTests.cs
@@ -14,9 +14,9 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OpenId.ChannelElements;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class KeyValueFormEncodingTests : TestBase {
private Dictionary<string, string> sampleData = new Dictionary<string, string> {
{ "key1", "value1" },
@@ -33,7 +33,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
Both = 0x3,
}
- [TestMethod]
+ [TestCase]
public void BasicEncodingTest() {
byte[] kvfBytes = KeyValueFormEncoding.GetBytes(this.sampleData);
string responseString = Encoding.UTF8.GetString(kvfBytes);
@@ -69,7 +69,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
}
}
- [TestMethod]
+ [TestCase]
public void EncodeDecode() {
this.KVDictTest(UTF8Encoding.UTF8.GetBytes(string.Empty), new Dictionary<string, string>(), TestMode.Both);
@@ -117,35 +117,35 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
this.KVDictTest(UTF8Encoding.UTF8.GetBytes("east:west\nnorth:south"), d10, TestMode.Decoder);
}
- [TestMethod, ExpectedException(typeof(FormatException))]
+ [TestCase, ExpectedException(typeof(FormatException))]
public void NoValue() {
this.Illegal("x\n", KeyValueFormConformanceLevel.OpenId11);
}
- [TestMethod, ExpectedException(typeof(FormatException))]
+ [TestCase, ExpectedException(typeof(FormatException))]
public void NoValueLoose() {
Dictionary<string, string> d = new Dictionary<string, string>();
this.KVDictTest(Encoding.UTF8.GetBytes("x\n"), d, TestMode.Decoder);
}
- [TestMethod, ExpectedException(typeof(FormatException))]
+ [TestCase, ExpectedException(typeof(FormatException))]
public void EmptyLine() {
this.Illegal("x:b\n\n", KeyValueFormConformanceLevel.OpenId20);
}
- [TestMethod]
+ [TestCase]
public void EmptyLineLoose() {
Dictionary<string, string> d = new Dictionary<string, string>();
d.Add("x", "b");
this.KVDictTest(Encoding.UTF8.GetBytes("x:b\n\n"), d, TestMode.Decoder);
}
- [TestMethod, ExpectedException(typeof(FormatException))]
+ [TestCase, ExpectedException(typeof(FormatException))]
public void LastLineNotTerminated() {
this.Illegal("x:y\na:b", KeyValueFormConformanceLevel.OpenId11);
}
- [TestMethod]
+ [TestCase]
public void LastLineNotTerminatedLoose() {
Dictionary<string, string> d = new Dictionary<string, string>();
d.Add("x", "y");
diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs
index 385cd19..97a40e8 100644
--- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs
@@ -18,16 +18,16 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
using DotNetOpenAuth.OpenId.ChannelElements;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class OpenIdChannelTests : TestBase {
private static readonly TimeSpan maximumMessageAge = TimeSpan.FromHours(3); // good for tests, too long for production
private OpenIdChannel channel;
private OpenIdChannel_Accessor accessor;
private Mocks.TestWebRequestHandler webHandler;
- [TestInitialize]
+ [SetUp]
public void Setup() {
this.webHandler = new Mocks.TestWebRequestHandler();
this.channel = new OpenIdChannel(new AssociationMemoryStore<Uri>(), new NonceMemoryStore(maximumMessageAge), new RelyingPartySecuritySettings());
@@ -35,7 +35,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
this.channel.WebRequestHandler = this.webHandler;
}
- [TestMethod]
+ [TestCase]
public void Ctor() {
// Verify that the channel stack includes the expected types.
// While other binding elements may be substituted for these, we'd then have
@@ -53,7 +53,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// <summary>
/// Verifies that the channel sends direct message requests as HTTP POST requests.
/// </summary>
- [TestMethod]
+ [TestCase]
public void DirectRequestsUsePost() {
IDirectedProtocolMessage requestMessage = new Mocks.TestDirectedMessage(MessageTransport.Direct) {
Recipient = new Uri("http://host"),
@@ -61,7 +61,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
};
HttpWebRequest httpRequest = this.accessor.CreateHttpRequest(requestMessage);
Assert.AreEqual("POST", httpRequest.Method);
- StringAssert.Contains(this.webHandler.RequestEntityAsString, "Name=Andrew");
+ StringAssert.Contains("Name=Andrew", this.webHandler.RequestEntityAsString);
}
/// <summary>
@@ -73,7 +73,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// class is verified elsewhere. We're only checking that the KVF class is being used by the
/// <see cref="OpenIdChannel.SendDirectMessageResponse"/> method.
/// </remarks>
- [TestMethod]
+ [TestCase]
public void DirectResponsesSentUsingKeyValueForm() {
IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired);
MessageDictionary messageFields = this.MessageDescriptions.GetAccessor(message);
@@ -90,7 +90,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// <summary>
/// Verifies that direct message responses are read in using the Key Value Form decoder.
/// </summary>
- [TestMethod]
+ [TestCase]
public void DirectResponsesReceivedAsKeyValueForm() {
var fields = new Dictionary<string, string> {
{ "var1", "value1" },
@@ -105,7 +105,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// <summary>
/// Verifies that messages asking for special HTTP status codes get them.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SendDirectMessageResponseHonorsHttpStatusCodes() {
IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired);
OutgoingWebResponse directResponse = this.accessor.PrepareDirectResponse(message);
diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/SigningBindingElementTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/SigningBindingElementTests.cs
index 3ab6559..8d5ef2a 100644
--- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/SigningBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/SigningBindingElementTests.cs
@@ -12,14 +12,14 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class SigningBindingElementTests : OpenIdTestBase {
/// <summary>
/// Verifies that the signatures generated match Known Good signatures.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SignaturesMatchKnownGood() {
Protocol protocol = Protocol.Default;
var settings = new ProviderSecuritySettings();
@@ -42,7 +42,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
/// <summary>
/// Verifies that all parameters in ExtraData in signed responses are signed.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SignedResponsesIncludeExtraDataInSignature() {
Protocol protocol = Protocol.Default;
SigningBindingElement sbe = new SigningBindingElement(new AssociationMemoryStore<AssociationRelyingPartyType>(), new ProviderSecuritySettings());
diff --git a/src/DotNetOpenAuth.Test/OpenId/DiffieHellmanTests.cs b/src/DotNetOpenAuth.Test/OpenId/DiffieHellmanTests.cs
index 426e19a..9e89b03 100644
--- a/src/DotNetOpenAuth.Test/OpenId/DiffieHellmanTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/DiffieHellmanTests.cs
@@ -9,12 +9,12 @@ namespace DotNetOpenAuth.Test.OpenId {
using System.IO;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
using Org.Mentalis.Security.Cryptography;
- [TestClass]
+ [TestFixture]
public class DiffieHellmanTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void Test() {
string s1 = Test1();
string s2 = Test1();
@@ -22,7 +22,7 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.AreNotEqual(s1, s2, "Secret keys should NOT be the same.");
}
- [TestMethod, Timeout(15000)]
+ [TestCase, Timeout(15000), Category("Slow"), Category("Performance")]
public void TestPublic() {
TextReader reader = new StringReader(OpenIdTestBase.LoadEmbeddedFile("dhpriv.txt"));
@@ -30,7 +30,7 @@ namespace DotNetOpenAuth.Test.OpenId {
string line;
int lineNumber = 0;
while ((line = reader.ReadLine()) != null) {
- TestContext.WriteLine("\tLine {0}", ++lineNumber);
+ TestUtilities.TestLogger.InfoFormat("\tLine {0}", ++lineNumber);
string[] parts = line.Trim().Split(' ');
byte[] x = Convert.FromBase64String(parts[0]);
DiffieHellmanManaged dh = new DiffieHellmanManaged(AssociateDiffieHellmanRequest.DefaultMod, AssociateDiffieHellmanRequest.DefaultGen, x);
diff --git a/src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/UriDiscoveryServiceTests.cs b/src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/UriDiscoveryServiceTests.cs
index f71d82f..7b12a1d 100644
--- a/src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/UriDiscoveryServiceTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/UriDiscoveryServiceTests.cs
@@ -15,11 +15,11 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class UriDiscoveryServiceTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void DiscoveryWithRedirects() {
Identifier claimedId = this.GetMockIdentifier(ProtocolVersion.V20, false);
@@ -34,7 +34,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
Assert.AreEqual(1, this.Discover(userSuppliedIdentifier).Count());
}
- [TestMethod]
+ [TestCase]
public void DiscoverRequireSslWithSecureRedirects() {
Identifier claimedId = this.GetMockIdentifier(ProtocolVersion.V20, true);
@@ -49,7 +49,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
Assert.AreEqual(1, this.Discover(userSuppliedIdentifier).Count());
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void DiscoverRequireSslWithInsecureRedirect() {
Identifier claimedId = this.GetMockIdentifier(ProtocolVersion.V20, true);
@@ -65,7 +65,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
this.Discover(userSuppliedIdentifier);
}
- [TestMethod]
+ [TestCase]
public void DiscoveryRequireSslWithInsecureXrdsInSecureHtmlHead() {
var insecureXrdsSource = this.GetMockIdentifier(ProtocolVersion.V20, false);
Uri secureClaimedUri = new Uri("https://localhost/secureId");
@@ -77,7 +77,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
Assert.AreEqual(0, this.Discover(userSuppliedIdentifier).Count());
}
- [TestMethod]
+ [TestCase]
public void DiscoveryRequireSslWithInsecureXrdsInSecureHttpHeader() {
var insecureXrdsSource = this.GetMockIdentifier(ProtocolVersion.V20, false);
@@ -91,7 +91,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
Assert.AreEqual(0, this.Discover(userSuppliedIdentifier).Count());
}
- [TestMethod]
+ [TestCase]
public void DiscoveryRequireSslWithInsecureXrdsButSecureLinkTags() {
var insecureXrdsSource = this.GetMockIdentifier(ProtocolVersion.V20, false);
string html = string.Format(
@@ -110,10 +110,10 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
// We verify that the XRDS was ignored and the LINK tags were used
// because the XRDS OP-LocalIdentifier uses different local identifiers.
- Assert.AreEqual(OPLocalIdentifiersSsl[1], this.Discover(userSuppliedIdentifier).Single().ProviderLocalIdentifier);
+ Assert.AreEqual(OPLocalIdentifiersSsl[1].AbsoluteUri, this.Discover(userSuppliedIdentifier).Single().ProviderLocalIdentifier.ToString());
}
- [TestMethod]
+ [TestCase]
public void DiscoveryRequiresSslIgnoresInsecureEndpointsInXrds() {
var insecureEndpoint = GetServiceEndpoint(0, ProtocolVersion.V20, 10, false);
var secureEndpoint = GetServiceEndpoint(1, ProtocolVersion.V20, 20, true);
@@ -122,7 +122,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
Assert.AreEqual(secureEndpoint.ProviderLocalIdentifier, this.Discover(secureClaimedId).Single().ProviderLocalIdentifier);
}
- [TestMethod]
+ [TestCase]
public void XrdsDirectDiscovery_10() {
this.FailDiscoverXrds("xrds-irrelevant");
this.DiscoverXrds("xrds10", ProtocolVersion.V10, null, "http://a/b");
@@ -130,14 +130,14 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
this.DiscoverXrds("xrds1020", ProtocolVersion.V10, null, "http://a/b");
}
- [TestMethod]
+ [TestCase]
public void XrdsDirectDiscovery_20() {
this.DiscoverXrds("xrds20", ProtocolVersion.V20, null, "http://a/b");
this.DiscoverXrds("xrds2010a", ProtocolVersion.V20, null, "http://a/b");
this.DiscoverXrds("xrds2010b", ProtocolVersion.V20, null, "http://a/b");
}
- [TestMethod]
+ [TestCase]
public void HtmlDiscover_11() {
this.DiscoverHtml("html10prov", ProtocolVersion.V11, null, "http://a/b");
this.DiscoverHtml("html10both", ProtocolVersion.V11, "http://c/d", "http://a/b");
@@ -151,7 +151,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
this.DiscoverHtml("html2010combinedC", ProtocolVersion.V11, "http://c/d", "http://a/b");
}
- [TestMethod]
+ [TestCase]
public void HtmlDiscover_20() {
this.DiscoverHtml("html20prov", ProtocolVersion.V20, null, "http://a/b");
this.DiscoverHtml("html20both", ProtocolVersion.V20, "http://c/d", "http://a/b");
@@ -164,13 +164,13 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
this.FailDiscoverHtml("html20relative");
}
- [TestMethod]
+ [TestCase]
public void XrdsDiscoveryFromHead() {
this.MockResponder.RegisterMockResponse(new Uri("http://localhost/xrds1020.xml"), "application/xrds+xml", LoadEmbeddedFile("/Discovery/xrdsdiscovery/xrds1020.xml"));
this.DiscoverXrds("XrdsReferencedInHead.html", ProtocolVersion.V10, null, "http://a/b");
}
- [TestMethod]
+ [TestCase]
public void XrdsDiscoveryFromHttpHeader() {
WebHeaderCollection headers = new WebHeaderCollection();
headers.Add("X-XRDS-Location", new Uri("http://localhost/xrds1020.xml").AbsoluteUri);
@@ -181,7 +181,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
/// <summary>
/// Verifies that a dual identifier yields only one service endpoint by default.
/// </summary>
- [TestMethod]
+ [TestCase]
public void DualIdentifierOffByDefault() {
this.MockResponder.RegisterMockResponse(VanityUri, "application/xrds+xml", LoadEmbeddedFile("/Discovery/xrdsdiscovery/xrds20dual.xml"));
var results = this.Discover(VanityUri).ToList();
@@ -192,7 +192,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
/// <summary>
/// Verifies that a dual identifier yields two service endpoints when that feature is turned on.
/// </summary>
- [TestMethod]
+ [TestCase]
public void DualIdentifier() {
this.MockResponder.RegisterMockResponse(VanityUri, "application/xrds+xml", LoadEmbeddedFile("/Discovery/xrdsdiscovery/xrds20dual.xml"));
var rp = this.CreateRelyingParty(true);
diff --git a/src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/XriDiscoveryProxyServiceTests.cs b/src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/XriDiscoveryProxyServiceTests.cs
index 9247bb6..5d914f5 100644
--- a/src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/XriDiscoveryProxyServiceTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/DiscoveryServices/XriDiscoveryProxyServiceTests.cs
@@ -11,11 +11,11 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
using System.Text;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class XriDiscoveryProxyServiceTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void Discover() {
string xrds = @"<?xml version='1.0' encoding='UTF-8'?>
<XRD version='2.0' xmlns='xri://$xrd*($v*2.0)'>
@@ -62,7 +62,7 @@ namespace DotNetOpenAuth.Test.OpenId.DiscoveryServices {
Assert.AreEqual("=Arnott", se.FriendlyIdentifierForDisplay);
}
- [TestMethod]
+ [TestCase]
public void DiscoverCommunityInameCanonicalIDs() {
string llliResponse = @"<?xml version='1.0' encoding='UTF-8'?>
<XRD version='2.0' xmlns='xri://$xrd*($v*2.0)'>
@@ -292,7 +292,7 @@ uEyb50RJ7DWmXctSC0b3eymZ2lSXxAWNOsNy
this.VerifyCanonicalId("=Web", "=!91F2.8153.F600.AE24");
}
- [TestMethod]
+ [TestCase]
public void DiscoveryCommunityInameDelegateWithoutCanonicalID() {
this.MockResponder.RegisterMockXrdsResponses(new Dictionary<string, string> {
{ "https://xri.net/=Web*andrew.arnott?_xrd_r=application/xrd%2Bxml;sep=false", @"<?xml version='1.0' encoding='UTF-8'?>
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeExchangeRoundtripTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeExchangeRoundtripTests.cs
index 1051092..c21c6a3 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeExchangeRoundtripTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeExchangeRoundtripTests.cs
@@ -7,16 +7,16 @@
namespace DotNetOpenAuth.Test.OpenId.Extensions {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AttributeExchangeRoundtripTests : OpenIdTestBase {
private const string NicknameTypeUri = WellKnownAttributes.Name.Alias;
private const string EmailTypeUri = WellKnownAttributes.Contact.Email;
private const string IncrementingAttribute = "http://incatt";
private int incrementingAttributeValue = 1;
- [TestMethod]
+ [TestCase]
public void Fetch() {
var request = new FetchRequest();
request.Attributes.Add(new AttributeRequest(NicknameTypeUri));
@@ -29,7 +29,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
ExtensionTestUtilities.Roundtrip(Protocol.Default, new[] { request }, new[] { response });
}
- [TestMethod]
+ [TestCase]
public void Store() {
var request = new StoreRequest();
var newAttribute = new AttributeValues(
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeRequestTests.cs
index 48b5727..5cc8ec1 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeRequestTests.cs
@@ -8,11 +8,11 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
using System;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
using DotNetOpenAuth.Test.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AttributeRequestTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void CtorDefault() {
AttributeRequest req = new AttributeRequest();
Assert.AreEqual(1, req.Count);
@@ -20,27 +20,27 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.IsFalse(req.IsRequired);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorEmptyTypeUri() {
new AttributeRequest(string.Empty);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorNullTypeUri() {
new AttributeRequest(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
+ [TestCase, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void CtorCountZero() {
new AttributeRequest(WellKnownAttributes.Contact.Email, false, 0);
}
- [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
+ [TestCase, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void CtorCountNegative() {
new AttributeRequest(WellKnownAttributes.Contact.Email, false, -1);
}
- [TestMethod]
+ [TestCase]
public void CtorFull() {
var req = new AttributeRequest(WellKnownAttributes.Contact.Email, true, 5);
Assert.AreEqual(WellKnownAttributes.Contact.Email, req.TypeUri);
@@ -48,19 +48,19 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.AreEqual(5, req.Count);
}
- [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
+ [TestCase, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void SetCountZero() {
var req = new AttributeRequest();
req.Count = 0;
}
- [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
+ [TestCase, ExpectedException(typeof(ArgumentOutOfRangeException))]
public void SetCountNegative() {
var req = new AttributeRequest();
req.Count = -1;
}
- [TestMethod]
+ [TestCase]
public void EqualityTests() {
var req1 = new AttributeRequest();
var req2 = new AttributeRequest();
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeValuesTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeValuesTests.cs
index 1f7e17c..6c28461 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeValuesTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/AttributeValuesTests.cs
@@ -10,11 +10,11 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
using System.Linq;
using System.Text;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AttributeValuesTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void Ctor() {
var att = new AttributeValues();
Assert.IsNull(att.TypeUri);
@@ -37,7 +37,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
/// <summary>
/// Verifies the Equals method.
/// </summary>
- [TestMethod]
+ [TestCase]
public void EqualityTests() {
var att1 = new AttributeValues();
var att2 = new AttributeValues();
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchRequestTests.cs
index 43eba3f..2388798 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchRequestTests.cs
@@ -9,35 +9,35 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
using System.IO;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
using DotNetOpenAuth.Test.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class FetchRequestTests : OpenIdTestBase {
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void AddAttributeRequestNull() {
new FetchRequest().Attributes.Add(null);
}
- [TestMethod]
+ [TestCase]
public void AddAttributeRequest() {
var req = new FetchRequest();
req.Attributes.Add(new AttributeRequest() { TypeUri = "http://someUri" });
}
- [TestMethod]
+ [TestCase]
public void AddAttributeRequestStrangeUri() {
var req = new FetchRequest();
req.Attributes.Add(new AttributeRequest() { TypeUri = "=someUri*who*knows*but*this*is*legal" });
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void AddAttributeRequestAgain() {
var req = new FetchRequest();
req.Attributes.Add(new AttributeRequest() { TypeUri = "http://UriTwice" });
req.Attributes.Add(new AttributeRequest() { TypeUri = "http://UriTwice" });
}
- [TestMethod]
+ [TestCase]
public void RespondSimpleValue() {
var req = new AttributeRequest();
req.TypeUri = "http://someType";
@@ -47,7 +47,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.AreEqual("value", resp.Values[0]);
}
- [TestMethod]
+ [TestCase]
public void RespondTwoValues() {
var req = new AttributeRequest();
req.TypeUri = "http://someType";
@@ -59,7 +59,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.AreEqual("value2", resp.Values[1]);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void RespondTooManyValues() {
var req = new AttributeRequest();
req.TypeUri = "http://someType";
@@ -67,7 +67,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
req.Respond("value1", "value2");
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void RespondNull() {
var req = new AttributeRequest();
req.TypeUri = "http://someType";
@@ -75,7 +75,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
req.Respond(null);
}
- [TestMethod]
+ [TestCase]
public void EqualityTests() {
var req1 = new FetchRequest();
var req2 = new FetchRequest();
@@ -100,7 +100,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
/// <summary>
/// Verifies that the class is serializable.
/// </summary>
- [TestMethod]
+ [TestCase]
public void Serializable() {
var fetch = new FetchRequest();
fetch.Attributes.AddRequired("http://someAttribute");
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchResponseTests.cs
index d7082c3..c545a46 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/FetchResponseTests.cs
@@ -9,37 +9,37 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
using System.IO;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
using DotNetOpenAuth.Test.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class FetchResponseTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void AddAttribute() {
var response = new FetchResponse();
response.Attributes.Add(new AttributeValues("http://someattribute", "Value1"));
}
- [TestMethod]
+ [TestCase]
public void AddTwoAttributes() {
var response = new FetchResponse();
response.Attributes.Add(new AttributeValues("http://someattribute", "Value1"));
response.Attributes.Add(new AttributeValues("http://someOtherAttribute", "Value2"));
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void AddAttributeTwice() {
var response = new FetchResponse();
response.Attributes.Add(new AttributeValues("http://someattribute", "Value1"));
response.Attributes.Add(new AttributeValues("http://someattribute", "Value1"));
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void AddAttributeNull() {
var response = new FetchResponse();
response.Attributes.Add(null);
}
- [TestMethod]
+ [TestCase]
public void GetAttributeValue() {
var response = new FetchResponse();
@@ -55,7 +55,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.AreEqual("a", response.GetAttributeValue("http://someattribute3"));
}
- [TestMethod]
+ [TestCase]
public void EqualityTests() {
var response1 = new FetchResponse();
var response2 = new FetchResponse();
@@ -80,7 +80,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
/// <summary>
/// Verifies that the class is serializable.
/// </summary>
- [TestMethod]
+ [TestCase]
public void Serializable() {
var fetch = new FetchResponse();
fetch.Attributes.Add("http://someAttribute", "val1", "val2");
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreRequestTests.cs
index b11c469..fc486aa 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreRequestTests.cs
@@ -12,14 +12,14 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
using System.Text;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class StoreRequestTests {
/// <summary>
/// Verifies the constructor behavior.
/// </summary>
- [TestMethod]
+ [TestCase]
public void Ctor() {
var req = new StoreRequest();
Assert.IsFalse(req.Attributes.Any());
@@ -28,7 +28,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
/// <summary>
/// Verifies the AddAttribute method.
/// </summary>
- [TestMethod]
+ [TestCase]
public void AddAttributeByValue() {
var req = new StoreRequest();
AttributeValues value = new AttributeValues();
@@ -39,7 +39,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
/// <summary>
/// Verifies the AddAttribute method.
/// </summary>
- [TestMethod]
+ [TestCase]
public void AddAttributeByPrimitives() {
var req = new StoreRequest();
req.Attributes.Add("http://att1", "value1", "value2");
@@ -51,7 +51,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
/// <summary>
/// Verifies the Equals method.
/// </summary>
- [TestMethod]
+ [TestCase]
public void EqualityTests() {
var req1 = new StoreRequest();
var req2 = new StoreRequest();
@@ -71,7 +71,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
/// <summary>
/// Verifies that the class is serializable.
/// </summary>
- [TestMethod]
+ [TestCase]
public void Serializable() {
var store = new StoreRequest();
store.Attributes.Add("http://someAttribute", "val1", "val2");
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreResponseTests.cs
index 4e432e1..564ef7f 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/AttributeExchange/StoreResponseTests.cs
@@ -7,14 +7,14 @@
namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
using System.IO;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class StoreResponseTests {
/// <summary>
/// Verifies the constructor's behavior.
/// </summary>
- [TestMethod]
+ [TestCase]
public void Ctor() {
var response = new StoreResponse();
Assert.IsTrue(response.Succeeded, "The default status should be Succeeded.");
@@ -28,7 +28,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
/// <summary>
/// Verifies the Equals method.
/// </summary>
- [TestMethod]
+ [TestCase]
public void EqualityTests() {
var response1 = new StoreResponse();
var response2 = new StoreResponse();
@@ -51,7 +51,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.AttributeExchange {
/// <summary>
/// Verifies that the class is serializable.
/// </summary>
- [TestMethod]
+ [TestCase]
public void Serializable() {
var store = new StoreResponse();
store.Succeeded = false;
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperOPTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperOPTests.cs
index 9f849ea..ffbadc8 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperOPTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperOPTests.cs
@@ -14,14 +14,14 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ExtensionsInteropHelperOPTests : OpenIdTestBase {
private AuthenticationRequest request;
private IList<IExtensionMessage> extensions;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -36,7 +36,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
/// <summary>
/// Verifies no extensions appear as no extensions
/// </summary>
- [TestMethod]
+ [TestCase]
public void NoRequestedExtensions() {
var sreg = ExtensionsInteropHelper.UnifyExtensionsAsSreg(this.request);
Assert.IsNull(sreg);
@@ -52,7 +52,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
/// <summary>
/// Verifies sreg coming in is seen as sreg.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnifyExtensionsAsSregWithSreg() {
var sregInjected = new ClaimsRequest {
Nickname = DemandLevel.Request,
@@ -73,7 +73,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
/// <summary>
/// Verifies AX coming in looks like sreg.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnifyExtensionsAsSregWithAX() {
this.ParameterizedAXTest(AXAttributeFormats.AXSchemaOrg);
}
@@ -81,7 +81,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
/// <summary>
/// Verifies AX coming in looks like sreg.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnifyExtensionsAsSregWithAXSchemaOpenIdNet() {
this.ParameterizedAXTest(AXAttributeFormats.SchemaOpenIdNet);
}
@@ -89,7 +89,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
/// <summary>
/// Verifies sreg and AX in one request has a preserved sreg request.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnifyExtensionsAsSregWithBothSregAndAX() {
var sregInjected = new ClaimsRequest {
Nickname = DemandLevel.Request,
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs
index b913f96..181c023 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPRequestTests.cs
@@ -12,14 +12,14 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ExtensionsInteropHelperRPRequestTests : OpenIdTestBase {
private AuthenticationRequest authReq;
private ClaimsRequest sreg;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -42,7 +42,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that without an Sreg extension to copy from, no AX extension request is added.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SpreadSregToAXNoExtensions() {
ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg);
Assert.AreEqual(0, this.authReq.AppliedExtensions.Count());
@@ -51,7 +51,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that Sreg requests are correctly copied to axschema.org AX requests.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SpreadSregToAXBasic() {
this.authReq.AddExtension(this.sreg);
ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg);
@@ -70,7 +70,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that sreg can spread to multiple AX schemas.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SpreadSregToAxMultipleSchemas() {
this.authReq.AddExtension(this.sreg);
ExtensionsInteropHelper.SpreadSregToAX(this.authReq, AXAttributeFormats.AXSchemaOrg | AXAttributeFormats.SchemaOpenIdNet);
@@ -83,7 +83,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies no spread if the OP advertises sreg support.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SpreadSregToAxNoOpIfOPSupportsSreg() {
this.authReq.AddExtension(this.sreg);
this.InjectAdvertisedTypeUri(DotNetOpenAuth.OpenId.Extensions.SimpleRegistration.Constants.sreg_ns);
@@ -94,7 +94,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies a targeted AX request if the OP advertises a recognized type URI format.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SpreadSregToAxTargetedAtOPFormat() {
this.authReq.AddExtension(this.sreg);
this.InjectAdvertisedTypeUri(WellKnownAttributes.Name.FullName);
@@ -107,7 +107,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that TransformAXFormat correctly translates AX schema Type URIs.
/// </summary>
- [TestMethod]
+ [TestCase]
public void TransformAXFormatTest() {
Assert.AreEqual(WellKnownAttributes.Name.Alias, ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.AXSchemaOrg));
Assert.AreEqual("http://schema.openid.net/namePerson/friendly", ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.SchemaOpenIdNet));
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs
index 5fe05c1..9074f75 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionsInteropHelperRPResponseTests.cs
@@ -13,14 +13,14 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ExtensionsInteropHelperRPResponseTests : OpenIdTestBase {
private IAuthenticationResponse response;
private IList<IExtensionMessage> extensions;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -32,7 +32,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that with no extensions present, UnifyExtensionsAsSreg returns an empty ClaimsResponse.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnifyExtensionsAsSregNoExtensions() {
var sreg = ExtensionsInteropHelper.UnifyExtensionsAsSreg(this.response, true);
Assert.IsNotNull(sreg);
@@ -42,7 +42,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies that with sreg and AX extensions present, the sreg extension is returned.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnifyExtensionsAsSregWithSreg() {
var sregInjected = new ClaimsResponse {
Nickname = "andy",
@@ -59,7 +59,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies UnifyExtensionsAsSreg correctly converts AX to sreg.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnifyExtensionsAsSregFromAXSchemaOrg() {
var axInjected = new FetchResponse();
axInjected.Attributes.Add(WellKnownAttributes.Name.Alias, "nate");
@@ -71,7 +71,7 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies UnifyExtensionsAsSreg correctly converts AX in a non-standard format to sreg.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UnifyExtensionsasSregFromSchemaOpenIdNet() {
var axInjected = new FetchResponse();
axInjected.Attributes.Add(ExtensionsInteropHelper_Accessor.TransformAXFormat(WellKnownAttributes.Name.Alias, AXAttributeFormats.SchemaOpenIdNet), "nate");
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PapeRoundTripTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PapeRoundTripTests.cs
index 75737ab..6f35f85 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PapeRoundTripTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PapeRoundTripTests.cs
@@ -9,18 +9,18 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy;
using DotNetOpenAuth.Test.OpenId.Extensions;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class PapeRoundTripTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void Trivial() {
var request = new PolicyRequest();
var response = new PolicyResponse();
ExtensionTestUtilities.Roundtrip(Protocol.Default, new[] { request }, new[] { response });
}
- [TestMethod]
+ [TestCase]
public void Full() {
var request = new PolicyRequest();
request.MaximumAuthenticationAge = TimeSpan.FromMinutes(10);
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyRequestTests.cs
index 303c747..d75eccc 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyRequestTests.cs
@@ -13,11 +13,11 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class PolicyRequestTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void Ctor() {
PolicyRequest req = new PolicyRequest();
Assert.IsNull(req.MaximumAuthenticationAge);
@@ -25,7 +25,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(0, req.PreferredPolicies.Count);
}
- [TestMethod]
+ [TestCase]
public void MaximumAuthenticationAgeTest() {
PolicyRequest req = new PolicyRequest();
req.MaximumAuthenticationAge = TimeSpan.FromHours(1);
@@ -35,7 +35,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.IsNull(req.MaximumAuthenticationAge);
}
- [TestMethod]
+ [TestCase]
public void AddPolicies() {
PolicyRequest resp = new PolicyRequest();
resp.PreferredPolicies.Add(AuthenticationPolicies.MultiFactor);
@@ -45,7 +45,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(AuthenticationPolicies.PhishingResistant, resp.PreferredPolicies[1]);
}
- [TestMethod]
+ [TestCase]
public void AddPolicyMultipleTimes() {
// Although this isn't really the desired behavior (we'd prefer to see an
// exception thrown), since we're using a List<string> internally we can't
@@ -57,7 +57,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(2, resp.PreferredPolicies.Count);
}
- [TestMethod]
+ [TestCase]
public void AddAuthLevelTypes() {
PolicyRequest req = new PolicyRequest();
req.PreferredAuthLevelTypes.Add(Constants.AssuranceLevels.NistTypeUri);
@@ -65,7 +65,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.IsTrue(req.PreferredAuthLevelTypes.Contains(Constants.AssuranceLevels.NistTypeUri));
}
- [TestMethod]
+ [TestCase]
public void EqualsTest() {
PolicyRequest req = new PolicyRequest();
PolicyRequest req2 = new PolicyRequest();
@@ -104,7 +104,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(req, req2);
}
- [TestMethod]
+ [TestCase]
public void Serialize() {
PolicyRequest req = new PolicyRequest();
IMessageWithEvents reqEvents = req;
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponseTests.cs
index e0faaac..7491e21 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponseTests.cs
@@ -12,15 +12,15 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class PolicyResponseTests : OpenIdTestBase {
private static readonly DateTime someLocalTime = new DateTime(2008, 1, 1, 1, 1, 1, 0, DateTimeKind.Local);
private static readonly DateTime someUtcTime = new DateTime(2008, 1, 1, 1, 1, 1, 0, DateTimeKind.Utc);
private static readonly DateTime someUnspecifiedTime = new DateTime(2008, 1, 1, 1, 1, 1, 0, DateTimeKind.Unspecified);
- [TestMethod]
+ [TestCase]
public void Ctor() {
PolicyResponse resp = new PolicyResponse();
Assert.IsNotNull(resp.ActualPolicies);
@@ -29,7 +29,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.IsNull(resp.NistAssuranceLevel);
}
- [TestMethod]
+ [TestCase]
public void AddPolicies() {
PolicyResponse resp = new PolicyResponse();
resp.ActualPolicies.Add(AuthenticationPolicies.MultiFactor);
@@ -39,7 +39,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(AuthenticationPolicies.PhishingResistant, resp.ActualPolicies[1]);
}
- [TestMethod]
+ [TestCase]
public void AddPolicyMultipleTimes() {
// Although this isn't really the desired behavior (we'd prefer to see an
// exception thrown), since we're using a List<string> internally we can't
@@ -51,7 +51,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(2, resp.ActualPolicies.Count);
}
- [TestMethod]
+ [TestCase]
public void AuthenticationTimeUtcConvertsToUtc() {
PolicyResponse resp = new PolicyResponse();
resp.AuthenticationTimeUtc = someLocalTime;
@@ -60,20 +60,20 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(someLocalTime.ToUniversalTime(), resp.AuthenticationTimeUtc.Value);
}
- [TestMethod]
+ [TestCase]
public void AuthenticationTimeUtcSetUtc() {
PolicyResponse resp = new PolicyResponse();
resp.AuthenticationTimeUtc = someUtcTime;
Assert.AreEqual(someUtcTime, resp.AuthenticationTimeUtc);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void AuthenticationTimeUtcSetUnspecified() {
PolicyResponse resp = new PolicyResponse();
resp.AuthenticationTimeUtc = someUnspecifiedTime;
}
- [TestMethod]
+ [TestCase]
public void AuthenticationTimeUtcSetNull() {
PolicyResponse resp = new PolicyResponse();
resp.AuthenticationTimeUtc = null;
@@ -84,7 +84,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.IsNull(resp.AuthenticationTimeUtc);
}
- [TestMethod]
+ [TestCase]
public void NistAssuranceLevelSetVarious() {
PolicyResponse resp = new PolicyResponse();
resp.NistAssuranceLevel = NistAssuranceLevel.Level1;
@@ -95,7 +95,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(NistAssuranceLevel.InsufficientForLevel1, resp.NistAssuranceLevel);
}
- [TestMethod]
+ [TestCase]
public void AssuranceLevels() {
PolicyResponse resp = new PolicyResponse();
Assert.AreEqual(0, resp.AssuranceLevels.Count);
@@ -108,7 +108,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.IsNull(resp.NistAssuranceLevel);
}
- [TestMethod]
+ [TestCase]
public void EqualsTest() {
PolicyResponse resp = new PolicyResponse();
PolicyResponse resp2 = new PolicyResponse();
@@ -164,7 +164,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.ProviderAuthenticationPolicy {
Assert.AreEqual(resp, resp2);
}
- [TestMethod]
+ [TestCase]
public void Serialize() {
PolicyResponse resp = new PolicyResponse();
IMessageWithEvents respEvents = resp;
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsRequestTests.cs
index 3af54d3..f7a948e 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsRequestTests.cs
@@ -8,11 +8,11 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ClaimsRequestTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void CreateResponse() {
// some unofficial type URIs...
this.ParameterizedTypeUriPreservedTest("http://openid.net/sreg/1.0");
@@ -21,7 +21,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
this.ParameterizedTypeUriPreservedTest("http://openid.net/extensions/sreg/1.1");
}
- [TestMethod]
+ [TestCase]
public void RequiredOptionalLists() {
ClaimsRequest req = new ClaimsRequest();
MessageDictionary dictionary = this.MessageDescriptions.GetAccessor(req);
@@ -39,7 +39,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.AreEqual("nickname,postcode", dictionary["required"]);
}
- [TestMethod]
+ [TestCase]
public void EqualityTests() {
ClaimsRequest req1 = new ClaimsRequest();
ClaimsRequest req2 = new ClaimsRequest();
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsResponseTests.cs
index 6dbfa4f..0bdc36e 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/SimpleRegistration/ClaimsResponseTests.cs
@@ -12,18 +12,18 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
using System.Runtime.Serialization.Formatters.Binary;
using System.Xml.Serialization;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ClaimsResponseTests {
- [TestMethod]
+ [TestCase]
public void EmptyMailAddress() {
ClaimsResponse response = new ClaimsResponse(Constants.sreg_ns);
response.Email = string.Empty;
Assert.IsNull(response.MailAddress);
}
- [TestMethod, Ignore] // serialization no longer supported
+ [TestCase, Ignore("serialization no longer supported")]
public void BinarySerialization() {
ClaimsResponse fields = this.GetFilledData();
MemoryStream ms = new MemoryStream();
@@ -35,7 +35,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.AreEqual(fields, fields2);
}
- [TestMethod, Ignore] // serialization no longer supported
+ [TestCase, Ignore("serialization no longer supported")]
public void XmlSerialization() {
ClaimsResponse fields = this.GetFilledData();
MemoryStream ms = new MemoryStream();
@@ -47,7 +47,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.AreEqual(fields, fields2);
}
- [TestMethod]
+ [TestCase]
public void EqualityTest() {
ClaimsResponse fields1 = this.GetFilledData();
@@ -95,7 +95,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.AreNotEqual(fields1, fields2);
}
- [TestMethod]
+ [TestCase]
public void Birthdates() {
var response = new ClaimsResponse();
// Verify that they both start out as null
@@ -124,7 +124,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
Assert.IsFalse(response.BirthDate.HasValue);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void InvalidRawBirthdate() {
var response = new ClaimsResponse();
response.BirthDateRaw = "2008";
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs
index 7a60a32..c216a4d 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/UI/UIRequestTests.cs
@@ -8,11 +8,11 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.UI {
using System.Globalization;
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OpenId.Extensions.UI;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class UIRequestTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void Defaults() {
UIRequest request = new UIRequest();
Assert.AreEqual("popup", request.Mode);
@@ -20,7 +20,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.UI {
Assert.AreEqual(CultureInfo.CurrentUICulture, request.LanguagePreference[0]);
}
- [TestMethod]
+ [TestCase]
public void LanguagePreferenceEncodingDecoding() {
var request = new UIRequest();
MessageDictionary dictionary = this.MessageDescriptions.GetAccessor(request);
@@ -42,7 +42,7 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions.UI {
Assert.AreEqual(new CultureInfo("es-ES"), request.LanguagePreference[1]);
}
- [TestMethod]
+ [TestCase]
public void ModeEncoding() {
var request = new UIRequest();
MessageDictionary dictionary = this.MessageDescriptions.GetAccessor(request);
diff --git a/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs b/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
index cc02265..b7b0893 100644
--- a/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
@@ -9,23 +9,23 @@ namespace DotNetOpenAuth.Test.OpenId {
using System.Collections.Generic;
using System.Linq;
using DotNetOpenAuth.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class IdentifierTests {
private string uri = "http://www.yahoo.com/";
private string uriNoScheme = "www.yahoo.com";
private string uriHttps = "https://www.yahoo.com/";
private string xri = "=arnott*andrew";
- [TestMethod]
+ [TestCase]
public void TryParseNoThrow() {
Identifier id;
Assert.IsFalse(Identifier.TryParse(null, out id));
Assert.IsFalse(Identifier.TryParse(string.Empty, out id));
}
- [TestMethod]
+ [TestCase]
public void TryParse() {
Identifier id;
Assert.IsTrue(Identifier.TryParse("http://host/path", out id));
@@ -34,16 +34,16 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.AreEqual("=arnott", id.ToString());
}
- [TestMethod]
+ [TestCase]
public void Parse() {
- Assert.IsInstanceOfType(Identifier.Parse(this.uri), typeof(UriIdentifier));
- Assert.IsInstanceOfType(Identifier.Parse(this.xri), typeof(XriIdentifier));
+ Assert.IsInstanceOfType(typeof(UriIdentifier), Identifier.Parse(this.uri));
+ Assert.IsInstanceOfType(typeof(XriIdentifier), Identifier.Parse(this.xri));
}
/// <summary>
/// Tests conformance with 2.0 spec section 7.2#2
/// </summary>
- [TestMethod]
+ [TestCase]
public void ParseEndUserSuppliedXriIdentifer() {
List<char> symbols = new List<char>(XriIdentifier.GlobalContextSymbols);
symbols.Add('(');
@@ -52,35 +52,35 @@ namespace DotNetOpenAuth.Test.OpenId {
prefixes.AddRange(symbols.Select(s => "xri://" + s.ToString()));
foreach (string prefix in prefixes) {
var id = Identifier.Parse(prefix + "andrew");
- Assert.IsInstanceOfType(id, typeof(XriIdentifier));
+ Assert.IsInstanceOfType(typeof(XriIdentifier), id);
}
}
/// <summary>
/// Verifies conformance with 2.0 spec section 7.2#3
/// </summary>
- [TestMethod]
+ [TestCase]
public void ParseEndUserSuppliedUriIdentifier() {
// verify a fully-qualified Uri
var id = Identifier.Parse(this.uri);
- Assert.IsInstanceOfType(id, typeof(UriIdentifier));
+ Assert.IsInstanceOfType(typeof(UriIdentifier), id);
Assert.AreEqual(this.uri, ((UriIdentifier)id).Uri.AbsoluteUri);
// verify an HTTPS Uri
id = Identifier.Parse(this.uriHttps);
- Assert.IsInstanceOfType(id, typeof(UriIdentifier));
+ Assert.IsInstanceOfType(typeof(UriIdentifier), id);
Assert.AreEqual(this.uriHttps, ((UriIdentifier)id).Uri.AbsoluteUri);
// verify that if the scheme is missing it is added automatically
id = Identifier.Parse(this.uriNoScheme);
- Assert.IsInstanceOfType(id, typeof(UriIdentifier));
+ Assert.IsInstanceOfType(typeof(UriIdentifier), id);
Assert.AreEqual(this.uri, ((UriIdentifier)id).Uri.AbsoluteUri);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void ParseNull() {
Identifier.Parse(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void ParseEmpty() {
Identifier.Parse(string.Empty);
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateDiffieHellmanRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateDiffieHellmanRequestTests.cs
index a8648ac..b091062 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateDiffieHellmanRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateDiffieHellmanRequestTests.cs
@@ -8,24 +8,24 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using System;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AssociateDiffieHellmanRequestTests {
private static readonly Uri Recipient = new Uri("http://host");
private AssociateDiffieHellmanRequest request;
- [TestInitialize]
+ [SetUp]
public void Setup() {
this.request = new AssociateDiffieHellmanRequest(Protocol.V20.Version, Recipient);
}
- [TestMethod]
+ [TestCase]
public void Ctor() {
Assert.AreEqual(Recipient, this.request.Recipient);
}
- [TestMethod]
+ [TestCase]
public void Mode() {
Assert.AreEqual("associate", this.request.Mode);
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateRequestTests.cs
index 0957118..f3c18d9 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateRequestTests.cs
@@ -11,31 +11,31 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AssociateRequestTests : OpenIdTestBase {
private readonly Protocol protocol = Protocol.V20;
private Uri secureRecipient = new Uri("https://hi");
private Uri insecureRecipient = new Uri("http://hi");
private AssociateRequest request;
- [TestInitialize]
+ [SetUp]
public void Setup() {
this.request = new AssociateUnencryptedRequest(this.protocol.Version, this.secureRecipient);
}
- [TestMethod]
+ [TestCase]
public void ConstructorTest() {
Assert.AreEqual(this.secureRecipient, this.request.Recipient);
}
- [TestMethod]
+ [TestCase]
public void Mode() {
Assert.AreEqual(this.protocol.Args.Mode.associate, this.request.Mode);
}
- [TestMethod]
+ [TestCase]
public void MessagePartsTest() {
this.request.AssociationType = this.protocol.Args.SignatureAlgorithm.HMAC_SHA1;
this.request.SessionType = this.protocol.Args.SessionType.NoEncryption;
@@ -51,26 +51,26 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.AreEqual(this.protocol.Args.SessionType.NoEncryption, dict[this.protocol.openid.session_type]);
}
- [TestMethod]
+ [TestCase]
public void ValidMessageTest() {
this.request = new AssociateUnencryptedRequest(Protocol.V20.Version, this.secureRecipient);
this.request.AssociationType = this.protocol.Args.SignatureAlgorithm.HMAC_SHA1;
this.request.EnsureValidMessage();
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void InvalidMessageTest() {
this.request = new AssociateUnencryptedRequest(Protocol.V20.Version, this.insecureRecipient);
this.request.AssociationType = this.protocol.Args.SignatureAlgorithm.HMAC_SHA1;
this.request.EnsureValidMessage(); // no-encryption only allowed for secure channels.
}
- [TestMethod]
+ [TestCase]
public void RequiredProtection() {
Assert.AreEqual(MessageProtections.None, this.request.RequiredProtection);
}
- [TestMethod]
+ [TestCase]
public void Transport() {
Assert.AreEqual(MessageTransport.Direct, this.request.Transport);
}
@@ -78,7 +78,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
/// <summary>
/// Verifies security settings limit RP's initial associate request
/// </summary>
- [TestMethod]
+ [TestCase]
public void AssociateRequestDeterminedBySecuritySettings() {
Protocol protocol = Protocol.V20;
SecuritySettings securitySettings = new RelyingPartySecuritySettings();
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnencryptedResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnencryptedResponseTests.cs
index 1f5e87c..37be1cb 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnencryptedResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnencryptedResponseTests.cs
@@ -9,20 +9,20 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AssociateUnencryptedResponseTests : OpenIdTestBase {
private AssociateUnencryptedResponse response;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
var request = new AssociateUnencryptedRequest(Protocol.V20.Version, new Uri("http://host"));
this.response = new AssociateUnencryptedResponse(request.Version, request);
}
- [TestMethod]
+ [TestCase]
public void ParameterNames() {
this.response.AssociationHandle = "HANDLE";
this.response.AssociationType = "HMAC-SHA1";
@@ -38,12 +38,12 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.AreEqual("50", fields["expires_in"]);
}
- [TestMethod]
+ [TestCase]
public void RequiredProtection() {
Assert.AreEqual(MessageProtections.None, this.response.RequiredProtection);
}
- [TestMethod]
+ [TestCase]
public void Transport() {
Assert.AreEqual(MessageTransport.Direct, this.response.Transport);
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnsuccessfulResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnsuccessfulResponseTests.cs
index a6a691d..9b76473 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnsuccessfulResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/AssociateUnsuccessfulResponseTests.cs
@@ -9,20 +9,20 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AssociateUnsuccessfulResponseTests : OpenIdTestBase {
private AssociateUnsuccessfulResponse response;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
var request = new AssociateUnencryptedRequest(Protocol.V20.Version, new Uri("http://host"));
this.response = new AssociateUnsuccessfulResponse(request.Version, request);
}
- [TestMethod]
+ [TestCase]
public void ParameterNames() {
this.response.ErrorMessage = "Some Error";
this.response.AssociationType = "HMAC-SHA1";
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationRequestTests.cs
index 96a2e23..cf6b814 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationRequestTests.cs
@@ -9,13 +9,9 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using System.Collections.Generic;
using System.Linq;
using System.Text;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class CheckAuthenticationRequestTests : OpenIdTestBase {
- [TestInitialize]
- public override void SetUp() {
- base.SetUp();
- }
}
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationResponseTests.cs
index 1e773bd..cbe6638 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/CheckAuthenticationResponseTests.cs
@@ -12,16 +12,16 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class CheckAuthenticationResponseTests : OpenIdTestBase {
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
- [TestMethod]
+ [TestCase]
public void IsValid() {
Protocol protocol = Protocol.Default;
var request = new CheckAuthenticationRequest(protocol.Version, OPUri);
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/CheckIdRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/CheckIdRequestTests.cs
index 2c9ea12..e33a191 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/CheckIdRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/CheckIdRequestTests.cs
@@ -12,11 +12,11 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class CheckIdRequestTests : OpenIdTestBase {
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs
index 02fa7df..039748f 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs
@@ -10,13 +10,13 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class DirectErrorResponseTests : OpenIdTestBase {
private DirectErrorResponse response;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -24,7 +24,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
this.response = new DirectErrorResponse(request.Version, request);
}
- [TestMethod]
+ [TestCase]
public void ParameterNames() {
this.response.ErrorMessage = "Some Error";
this.response.Contact = "Andrew Arnott";
@@ -42,7 +42,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
/// Verifies that error messages are created as HTTP 400 errors,
/// per OpenID 2.0 section 5.1.2.2.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ErrorMessagesAsHttp400() {
var httpStatusMessage = (IHttpDirectResponse)this.response;
Assert.AreEqual(HttpStatusCode.BadRequest, httpStatusMessage.HttpStatusCode);
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/IndirectErrorResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/IndirectErrorResponseTests.cs
index fdb08eb..c9fb535 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/IndirectErrorResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/IndirectErrorResponseTests.cs
@@ -10,25 +10,25 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class IndirectErrorResponseTests : OpenIdTestBase {
private IndirectErrorResponse response;
- [TestInitialize]
+ [SetUp]
public void Setup() {
CheckIdRequest request = new CheckIdRequest(Protocol.V20.Version, OPUri, AuthenticationRequestMode.Immediate);
request.ReturnTo = RPUri;
this.response = new IndirectErrorResponse(request);
}
- [TestMethod]
+ [TestCase]
public void Ctor() {
Assert.AreEqual(RPUri, this.response.Recipient);
}
- [TestMethod]
+ [TestCase]
public void ParameterNames() {
this.response.ErrorMessage = "Some Error";
this.response.Contact = "Andrew Arnott";
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/IndirectSignedResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/IndirectSignedResponseTests.cs
index 8b0937a..ad6b15d 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/IndirectSignedResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/IndirectSignedResponseTests.cs
@@ -16,9 +16,9 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.OpenId.ChannelElements;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class IndirectSignedResponseTests : OpenIdTestBase {
private const string CreationDateString = "2005-05-15T17:11:51Z";
private readonly DateTime creationDate = DateTime.Parse(CreationDateString, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
@@ -27,7 +27,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
private IndirectSignedResponse unsolicited;
private Protocol protocol;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -39,7 +39,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
this.unsolicited = new IndirectSignedResponse(this.protocol.Version, RPUri);
}
- [TestMethod]
+ [TestCase]
public void CtorFromRequest() {
Assert.AreEqual(this.protocol.Args.Mode.id_res, this.response.Mode);
Assert.AreEqual(this.request.Version, this.response.Version);
@@ -48,7 +48,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.IsTrue(DateTime.UtcNow - ((ITamperResistantOpenIdMessage)this.response).UtcCreationDate < TimeSpan.FromSeconds(5));
}
- [TestMethod]
+ [TestCase]
public void CtorUnsolicited() {
Assert.AreEqual(this.protocol.Args.Mode.id_res, this.unsolicited.Mode);
Assert.AreEqual(this.protocol.Version, this.unsolicited.Version);
@@ -60,7 +60,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.AreEqual(OPUri, this.unsolicited.ProviderEndpoint);
}
- [TestMethod]
+ [TestCase]
public void ResponseNonceSetter() {
const string HybridValue = CreationDateString + "UNIQUE";
var responseAccessor = IndirectSignedResponse_Accessor.AttachShadow(this.response);
@@ -74,7 +74,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.IsNull(responseReplay.Nonce);
}
- [TestMethod]
+ [TestCase]
public void ResponseNonceGetter() {
var responseAccessor = IndirectSignedResponse_Accessor.AttachShadow(this.response);
IReplayProtectedProtocolMessage responseReplay = this.response;
@@ -86,7 +86,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.AreEqual(this.creationDate, responseReplay.UtcCreationDate);
}
- [TestMethod]
+ [TestCase]
public void UtcCreationDateConvertsToUniversal() {
IReplayProtectedProtocolMessage responseReplay = this.response;
DateTime local = DateTime.Parse("1982-01-01", CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal);
@@ -109,7 +109,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.AreEqual(this.creationDate.Hour, utcCreationDate.Hour, "The hour should match since both times are UTC time.");
}
- [TestMethod]
+ [TestCase]
public void ReturnToDoesNotMatchRecipient() {
// Make sure its valid first, so we know that when it's invalid
// it is due to our tampering.
@@ -127,24 +127,24 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
}
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void GetReturnToArgumentNullKey() {
this.response.GetReturnToArgument(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void GetReturnToArgumentEmptyKey() {
this.response.GetReturnToArgument(string.Empty);
}
- [TestMethod]
+ [TestCase]
public void GetReturnToArgumentDoesNotReturnExtraArgs() {
this.response.ExtraData["a"] = "b";
Assert.IsNull(this.response.GetReturnToArgument("a"));
Assert.AreEqual(0, this.response.GetReturnToParameterNames().Count());
}
- [TestMethod]
+ [TestCase]
public void GetReturnToArgumentAndNames() {
UriBuilder returnToBuilder = new UriBuilder(this.response.ReturnTo);
returnToBuilder.AppendQueryArgs(new Dictionary<string, string> { { "a", "b" } });
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/NegativeAssertionResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/NegativeAssertionResponseTests.cs
index 7876732..c35780d 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/NegativeAssertionResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/NegativeAssertionResponseTests.cs
@@ -13,16 +13,16 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class NegativeAssertionResponseTests : OpenIdTestBase {
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
- [TestMethod]
+ [TestCase]
public void Mode() {
var setupRequestV1 = new CheckIdRequest(Protocol.V10.Version, OPUri, AuthenticationRequestMode.Setup);
setupRequestV1.ReturnTo = RPUri;
@@ -45,14 +45,14 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.IsFalse(new NegativeAssertionResponse(setupRequestV2).Immediate);
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void UserSetupUrlRequiredInV1Immediate() {
var immediateRequestV1 = new CheckIdRequest(Protocol.V10.Version, OPUri, AuthenticationRequestMode.Immediate);
immediateRequestV1.ReturnTo = RPUri;
new NegativeAssertionResponse(immediateRequestV1).EnsureValidMessage();
}
- [TestMethod]
+ [TestCase]
public void UserSetupUrlSetForV1Immediate() {
var immediateRequestV1 = new CheckIdRequest(Protocol.V10.Version, OPUri, AuthenticationRequestMode.Immediate);
immediateRequestV1.ReturnTo = RPUri;
@@ -61,7 +61,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
response.EnsureValidMessage();
}
- [TestMethod]
+ [TestCase]
public void UserSetupUrlNotRequiredInV1SetupOrV2() {
var setupRequestV1 = new CheckIdRequest(Protocol.V10.Version, OPUri, AuthenticationRequestMode.Setup);
setupRequestV1.ReturnTo = RPUri;
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/PositiveAssertionResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/PositiveAssertionResponseTests.cs
index faa6a91..90d24b1 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/PositiveAssertionResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/PositiveAssertionResponseTests.cs
@@ -15,9 +15,9 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class PositiveAssertionResponseTests : OpenIdTestBase {
private const string CreationDateString = "2005-05-15T17:11:51Z";
private readonly DateTime creationDate = DateTime.Parse(CreationDateString, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
@@ -26,7 +26,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
private PositiveAssertionResponse unsolicited;
private Protocol protocol;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -38,7 +38,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
this.unsolicited = new PositiveAssertionResponse(this.protocol.Version, RPUri);
}
- [TestMethod]
+ [TestCase]
public void CtorFromRequest() {
Assert.AreEqual(this.protocol.Args.Mode.id_res, this.response.Mode);
Assert.AreEqual(this.request.Version, this.response.Version);
@@ -46,7 +46,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
Assert.AreEqual(OPUri, this.response.ProviderEndpoint);
}
- [TestMethod]
+ [TestCase]
public void CtorUnsolicited() {
Assert.AreEqual(this.protocol.Args.Mode.id_res, this.unsolicited.Mode);
Assert.AreEqual(this.protocol.Version, this.unsolicited.Version);
@@ -60,7 +60,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
/// <summary>
/// Verifies that local_id and claimed_id can either be null or specified.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ClaimedIdAndLocalIdSpecifiedIsValid() {
this.response.LocalIdentifier = "http://local";
this.response.ClaimedIdentifier = "http://claimedid";
diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/SignedResponseRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/SignedResponseRequestTests.cs
index 0177685..bc95f8b 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Messages/SignedResponseRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Messages/SignedResponseRequestTests.cs
@@ -10,9 +10,9 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class SignedResponseRequestTests : OpenIdTestBase {
private Uri providerEndpoint;
private SignedResponseRequest immediatev1;
@@ -20,7 +20,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
private SignedResponseRequest immediatev2;
private SignedResponseRequest setupv2;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -55,7 +55,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
/// This test does not test all the realm-return_to matching rules as that is done in the Realm tests.
/// This test merely checks that the compatibility match occurs at all.
/// </remarks>
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void RealmReturnToMismatchV2() {
this.setupv2.Realm = "http://somehost/";
this.setupv2.ReturnTo = new Uri("http://someotherhost/");
@@ -66,7 +66,7 @@ namespace DotNetOpenAuth.Test.OpenId.Messages {
/// Verifies that the validation check throws if the return_to and the realm
/// values are not compatible.
/// </summary>
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void RealmReturnToMismatchV1() {
this.setupv1.Realm = "http://somehost/";
this.setupv1.ReturnTo = new Uri("http://someotherhost/");
diff --git a/src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs b/src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs
index 49bb32c..b72c154 100644
--- a/src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/NonIdentityTests.cs
@@ -9,11 +9,11 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class NonIdentityTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void ExtensionOnlyChannelLevel() {
Protocol protocol = Protocol.V20;
AuthenticationRequestMode mode = AuthenticationRequestMode.Setup;
@@ -25,12 +25,12 @@ namespace DotNetOpenAuth.Test.OpenId {
},
op => {
var request = op.Channel.ReadFromRequest<SignedResponseRequest>();
- Assert.IsNotInstanceOfType(request, typeof(CheckIdRequest));
+ Assert.IsNotInstanceOfType(typeof(CheckIdRequest), request);
});
coordinator.Run();
}
- [TestMethod]
+ [TestCase]
public void ExtensionOnlyFacadeLevel() {
Protocol protocol = Protocol.V20;
var coordinator = new OpenIdCoordinator(
@@ -48,7 +48,7 @@ namespace DotNetOpenAuth.Test.OpenId {
var request = (IAnonymousRequest)op.GetRequest();
request.IsApproved = true;
- Assert.IsNotInstanceOfType(request, typeof(CheckIdRequest));
+ Assert.IsNotInstanceOfType(typeof(CheckIdRequest), request);
op.SendResponse(request);
});
coordinator.Run();
diff --git a/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs b/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs
index d8f5674..1adbfaa 100644
--- a/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs
@@ -16,7 +16,8 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
+ using NUnit.Framework;
public class OpenIdTestBase : TestBase {
internal IDirectWebRequestHandler RequestHandler;
@@ -62,7 +63,7 @@ namespace DotNetOpenAuth.Test.OpenId {
protected ProviderSecuritySettings ProviderSecuritySettings { get; private set; }
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -75,7 +76,7 @@ namespace DotNetOpenAuth.Test.OpenId {
Identifier.EqualityOnStrings = true;
}
- [TestCleanup]
+ [TearDown]
public override void Cleanup() {
base.Cleanup();
diff --git a/src/DotNetOpenAuth.Test/OpenId/OpenIdUtilitiesTests.cs b/src/DotNetOpenAuth.Test/OpenId/OpenIdUtilitiesTests.cs
index 389ef81..fefb852 100644
--- a/src/DotNetOpenAuth.Test/OpenId/OpenIdUtilitiesTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/OpenIdUtilitiesTests.cs
@@ -12,9 +12,9 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class OpenIdUtilitiesTests : OpenIdTestBase {
}
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/Provider/AnonymousRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Provider/AnonymousRequestTests.cs
index 14fef91..aaef213 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Provider/AnonymousRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Provider/AnonymousRequestTests.cs
@@ -9,14 +9,14 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AnonymousRequestTests : OpenIdTestBase {
/// <summary>
/// Verifies that IsApproved controls which response message is returned.
/// </summary>
- [TestMethod]
+ [TestCase]
public void IsApprovedDeterminesReturnedMessage() {
var op = CreateProvider();
Protocol protocol = Protocol.V20;
@@ -27,11 +27,11 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
Assert.IsFalse(anonReq.IsApproved.HasValue);
anonReq.IsApproved = false;
- Assert.IsInstanceOfType(anonReq.Response, typeof(NegativeAssertionResponse));
+ Assert.IsInstanceOfType(typeof(NegativeAssertionResponse), anonReq.Response);
anonReq.IsApproved = true;
- Assert.IsInstanceOfType(anonReq.Response, typeof(IndirectSignedResponse));
- Assert.IsNotInstanceOfType(anonReq.Response, typeof(PositiveAssertionResponse));
+ Assert.IsInstanceOfType(typeof(IndirectSignedResponse), anonReq.Response);
+ Assert.IsNotInstanceOfType(typeof(PositiveAssertionResponse), anonReq.Response);
}
}
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/Provider/AuthenticationRequestTest.cs b/src/DotNetOpenAuth.Test/OpenId/Provider/AuthenticationRequestTest.cs
index accbd97..dc5b3e3 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Provider/AuthenticationRequestTest.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Provider/AuthenticationRequestTest.cs
@@ -10,14 +10,14 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AuthenticationRequestTest : OpenIdTestBase {
/// <summary>
/// Verifies the user_setup_url is set properly for immediate negative responses.
/// </summary>
- [TestMethod]
+ [TestCase]
public void UserSetupUrl() {
// Construct a V1 immediate request
Protocol protocol = Protocol.V11;
diff --git a/src/DotNetOpenAuth.Test/OpenId/Provider/HostProcessedRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Provider/HostProcessedRequestTests.cs
index d308271..9bb8095 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Provider/HostProcessedRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Provider/HostProcessedRequestTests.cs
@@ -9,16 +9,16 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class HostProcessedRequestTests : OpenIdTestBase {
private Protocol protocol;
private OpenIdProvider provider;
private CheckIdRequest checkIdRequest;
private AuthenticationRequest request;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -30,12 +30,12 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
this.request = new AuthenticationRequest(this.provider, this.checkIdRequest);
}
- [TestMethod]
+ [TestCase]
public void IsReturnUrlDiscoverableNoResponse() {
Assert.AreEqual(RelyingPartyDiscoveryResult.NoServiceDocument, this.request.IsReturnUrlDiscoverable(this.provider));
}
- [TestMethod]
+ [TestCase]
public void IsReturnUrlDiscoverableValidResponse() {
this.MockResponder.RegisterMockRPDiscovery();
this.request = new AuthenticationRequest(this.provider, this.checkIdRequest);
@@ -46,7 +46,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
/// Verifies that when discovery would be performed over standard HTTP and RequireSsl
/// is set, that discovery fails.
/// </summary>
- [TestMethod]
+ [TestCase]
public void IsReturnUrlDiscoverableNotSsl() {
this.provider.SecuritySettings.RequireSsl = true;
this.MockResponder.RegisterMockRPDiscovery();
@@ -56,7 +56,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
/// <summary>
/// Verifies that when discovery would be performed over HTTPS that discovery succeeds.
/// </summary>
- [TestMethod]
+ [TestCase]
public void IsReturnUrlDiscoverableRequireSsl() {
this.MockResponder.RegisterMockRPDiscovery();
this.checkIdRequest.Realm = RPRealmUriSsl;
@@ -73,7 +73,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
Assert.AreEqual(RelyingPartyDiscoveryResult.Success, this.request.IsReturnUrlDiscoverable(this.provider));
}
- [TestMethod]
+ [TestCase]
public void IsReturnUrlDiscoverableValidButNoMatch() {
this.MockResponder.RegisterMockRPDiscovery();
this.provider.SecuritySettings.RequireSsl = false; // reset for another failure test case
diff --git a/src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs b/src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs
index 8528aa7..10d4115 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs
@@ -15,13 +15,13 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Hosting;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class OpenIdProviderTests : OpenIdTestBase {
private OpenIdProvider provider;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -31,7 +31,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
/// <summary>
/// Verifies that the constructor throws an exception if the app store is null.
/// </summary>
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNull() {
new OpenIdProvider(null);
}
@@ -39,7 +39,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
/// <summary>
/// Verifies that the SecuritySettings property throws when set to null.
/// </summary>
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SecuritySettingsSetNull() {
this.provider.SecuritySettings = null;
}
@@ -47,25 +47,25 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
/// <summary>
/// Verifies the SecuritySettings property can be set to a new instance.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SecuritySettings() {
var newSettings = new ProviderSecuritySettings();
this.provider.SecuritySettings = newSettings;
Assert.AreSame(newSettings, this.provider.SecuritySettings);
}
- [TestMethod]
+ [TestCase]
public void ExtensionFactories() {
var factories = this.provider.ExtensionFactories;
Assert.IsNotNull(factories);
Assert.AreEqual(1, factories.Count);
- Assert.IsInstanceOfType(factories[0], typeof(StandardOpenIdExtensionFactory));
+ Assert.IsInstanceOfType(typeof(StandardOpenIdExtensionFactory), factories[0]);
}
/// <summary>
/// Verifies the Channel property.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ChannelGetter() {
Assert.IsNotNull(this.provider.Channel);
}
@@ -73,7 +73,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
/// <summary>
/// Verifies the GetRequest method throws outside an HttpContext.
/// </summary>
- [TestMethod, ExpectedException(typeof(InvalidOperationException))]
+ [TestCase, ExpectedException(typeof(InvalidOperationException))]
public void GetRequestNoContext() {
HttpContext.Current = null;
this.provider.GetRequest();
@@ -82,7 +82,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
/// <summary>
/// Verifies GetRequest throws on null input.
/// </summary>
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void GetRequestNull() {
this.provider.GetRequest(null);
}
@@ -90,7 +90,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
/// <summary>
/// Verifies that GetRequest correctly returns the right messages.
/// </summary>
- [TestMethod]
+ [TestCase]
public void GetRequest() {
HttpRequestInfo httpInfo = new HttpRequestInfo();
httpInfo.UrlBeforeRewriting = new Uri("http://someUri");
@@ -104,13 +104,13 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
},
op => {
IRequest request = op.GetRequest();
- Assert.IsInstanceOfType(request, typeof(AutoResponsiveRequest));
+ Assert.IsInstanceOfType(typeof(AutoResponsiveRequest), request);
op.SendResponse(request);
});
coordinator.Run();
}
- [TestMethod]
+ [TestCase]
public void BadRequestsGenerateValidErrorResponses() {
var coordinator = new OpenIdCoordinator(
rp => {
@@ -127,7 +127,7 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
coordinator.Run();
}
- [TestMethod]
+ [TestCase]
public void BadRequestsGenerateValidErrorResponsesHosted() {
try {
using (AspNetHost host = AspNetHost.CreateHost(TestWebDirectory)) {
diff --git a/src/DotNetOpenAuth.Test/OpenId/Provider/PerformanceTests.cs b/src/DotNetOpenAuth.Test/OpenId/Provider/PerformanceTests.cs
index 9f4727d..925c993 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Provider/PerformanceTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Provider/PerformanceTests.cs
@@ -18,28 +18,28 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
using DotNetOpenAuth.OpenId.ChannelElements;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture, Category("Performance")]
public class PerformanceTests : OpenIdTestBase {
private const string SharedAssociationHandle = "handle";
private static readonly TimeSpan TestRunTime = TimeSpan.FromSeconds(3);
private OpenIdProvider provider;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
SuspendLogging();
this.provider = CreateProvider();
}
- [TestCleanup]
+ [TearDown]
public override void Cleanup() {
ResumeLogging();
base.Cleanup();
}
- [TestMethod]
+ [TestCase]
public void AssociateDH() {
var associateRequest = this.CreateAssociateRequest(OPUri);
Stopwatch timer = new Stopwatch();
@@ -48,15 +48,15 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
for (iterations = 0; timer.ElapsedMilliseconds < TestRunTime.TotalMilliseconds; iterations++) {
IRequest request = this.provider.GetRequest(associateRequest);
var response = this.provider.PrepareResponse(request);
- Assert.IsInstanceOfType(response.OriginalMessage, typeof(AssociateSuccessfulResponse));
+ Assert.IsInstanceOfType(typeof(AssociateSuccessfulResponse), response.OriginalMessage);
}
timer.Stop();
double executionsPerSecond = GetExecutionsPerSecond(iterations, timer);
- TestContext.WriteLine("Created {0} associations in {1}, or {2} per second.", iterations, timer.Elapsed, executionsPerSecond);
+ TestUtilities.TestLogger.InfoFormat("Created {0} associations in {1}, or {2} per second.", iterations, timer.Elapsed, executionsPerSecond);
Assert.IsTrue(executionsPerSecond >= 2, "Too slow ({0} >= 2 executions per second required.)", executionsPerSecond);
}
- [TestMethod]
+ [TestCase]
public void AssociateClearText() {
var associateRequest = this.CreateAssociateRequest(OPUriSsl); // SSL will cause a plaintext association
Stopwatch timer = new Stopwatch();
@@ -65,29 +65,29 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
for (iterations = 0; timer.ElapsedMilliseconds < TestRunTime.TotalMilliseconds; iterations++) {
IRequest request = this.provider.GetRequest(associateRequest);
var response = this.provider.PrepareResponse(request);
- Assert.IsInstanceOfType(response.OriginalMessage, typeof(AssociateSuccessfulResponse));
+ Assert.IsInstanceOfType(typeof(AssociateSuccessfulResponse), response.OriginalMessage);
}
timer.Stop();
double executionsPerSecond = GetExecutionsPerSecond(iterations, timer);
- TestContext.WriteLine("Created {0} associations in {1}, or {2} per second.", iterations, timer.Elapsed, executionsPerSecond);
+ TestUtilities.TestLogger.InfoFormat("Created {0} associations in {1}, or {2} per second.", iterations, timer.Elapsed, executionsPerSecond);
Assert.IsTrue(executionsPerSecond > 1000, "Too slow ({0} > 1000 executions per second required.)", executionsPerSecond);
}
- [TestMethod]
+ [TestCase]
public void CheckIdSharedHmacSha1Association() {
Protocol protocol = Protocol.Default;
string assocType = protocol.Args.SignatureAlgorithm.HMAC_SHA1;
double executionsPerSecond = this.ParameterizedCheckIdTest(protocol, assocType);
- TestContext.WriteLine("{0} executions per second.", executionsPerSecond);
+ TestUtilities.TestLogger.InfoFormat("{0} executions per second.", executionsPerSecond);
Assert.IsTrue(executionsPerSecond > 500, "Too slow ({0} > 500 executions per second required.)", executionsPerSecond);
}
- [TestMethod]
+ [TestCase]
public void CheckIdSharedHmacSha256Association() {
Protocol protocol = Protocol.Default;
string assocType = protocol.Args.SignatureAlgorithm.HMAC_SHA256;
double executionsPerSecond = this.ParameterizedCheckIdTest(protocol, assocType);
- TestContext.WriteLine("{0} executions per second.", executionsPerSecond);
+ TestUtilities.TestLogger.InfoFormat("{0} executions per second.", executionsPerSecond);
Assert.IsTrue(executionsPerSecond > 400, "Too slow ({0} > 400 executions per second required.)", executionsPerSecond);
}
@@ -110,11 +110,11 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
var request = (IAuthenticationRequest)this.provider.GetRequest(checkidRequest);
request.IsAuthenticated = true;
var response = this.provider.PrepareResponse(request);
- Assert.IsInstanceOfType(response.OriginalMessage, typeof(PositiveAssertionResponse));
+ Assert.IsInstanceOfType(typeof(PositiveAssertionResponse), response.OriginalMessage);
}
timer.Stop();
double executionsPerSecond = GetExecutionsPerSecond(iterations, timer);
- TestContext.WriteLine("Responded to {0} checkid messages in {1}; or {2} authentications per second.", iterations, timer.Elapsed, executionsPerSecond);
+ TestUtilities.TestLogger.InfoFormat("Responded to {0} checkid messages in {1}; or {2} authentications per second.", iterations, timer.Elapsed, executionsPerSecond);
return executionsPerSecond;
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/ProviderEndpointDescriptionTests.cs b/src/DotNetOpenAuth.Test/OpenId/ProviderEndpointDescriptionTests.cs
index 60cd25f..65185fc 100644
--- a/src/DotNetOpenAuth.Test/OpenId/ProviderEndpointDescriptionTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/ProviderEndpointDescriptionTests.cs
@@ -10,17 +10,17 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class ProviderEndpointDescriptionTests : OpenIdTestBase {
- [TestMethod]
+ [TestCase]
public void NonNullCapabilities() {
var epd = new ProviderEndpointDescription(OPUri, Protocol.Default.Version);
Assert.IsNotNull(epd.Capabilities);
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void ProtocolDetectionWithoutClues() {
new ProviderEndpointDescription(OPUri, new[] { Protocol.V20.HtmlDiscoveryLocalIdKey }); // random type URI irrelevant to detection
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/RealmTests.cs b/src/DotNetOpenAuth.Test/OpenId/RealmTests.cs
index e062e12..fceb15a 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RealmTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RealmTests.cs
@@ -7,11 +7,11 @@
namespace DotNetOpenAuth.Test {
using System;
using DotNetOpenAuth.OpenId;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class RealmTests {
- [TestMethod]
+ [TestCase]
public void ValidRealmsTest() {
// Just create these. If any are determined to be invalid,
// an exception should be thrown that would fail this test.
@@ -26,67 +26,67 @@ namespace DotNetOpenAuth.Test {
new Realm("http://*.guest.myopenid.com/");
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(ArgumentNullException))]
public void InvalidRealmNullString() {
new Realm((string)null);
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(ArgumentNullException))]
public void InvalidRealmNullUri() {
new Realm((Uri)null);
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(UriFormatException))]
public void InvalidRealmEmpty() {
new Realm(string.Empty);
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(UriFormatException))]
public void InvalidRealmBadProtocol() {
new Realm("asdf://www.microsoft.com/");
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(UriFormatException))]
public void InvalidRealmNoScheme() {
new Realm("www.guy.com");
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(UriFormatException))]
public void InvalidRealmBadWildcard1() {
new Realm("http://*www.my.com");
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(UriFormatException))]
public void InvalidRealmBadWildcard2() {
new Realm("http://www.*.com");
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(UriFormatException))]
public void InvalidRealmBadWildcard3() {
new Realm("http://www.my.*/");
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(UriFormatException))]
public void InvalidRealmTwoWildcards1() {
new Realm("http://**.my.com");
}
- [TestMethod]
+ [TestCase]
[ExpectedException(typeof(UriFormatException))]
public void InvalidRealmTwoWildcards2() {
new Realm("http://*.*.my.com");
}
- [TestMethod]
+ [TestCase]
public void IsSaneTest() {
Assert.IsTrue(new Realm("http://www.myopenid.com").IsSane);
Assert.IsTrue(new Realm("http://myopenid.com").IsSane);
@@ -98,7 +98,7 @@ namespace DotNetOpenAuth.Test {
Assert.IsFalse(new Realm("http://*.co.uk").IsSane);
}
- [TestMethod]
+ [TestCase]
public void IsUrlWithinRealmTests() {
/*
* The openid.return_to URL MUST descend from the openid.trust_root, or the
@@ -166,7 +166,7 @@ namespace DotNetOpenAuth.Test {
Assert.IsFalse(new Realm("http://www.my.com/abc").Contains("http://www.my.com/ABC"));
}
- [TestMethod]
+ [TestCase]
public void ImplicitConversionFromStringTests() {
Realm realm = "http://host";
Assert.AreEqual("host", realm.Host);
@@ -174,7 +174,7 @@ namespace DotNetOpenAuth.Test {
Assert.IsNull(realm);
}
- [TestMethod]
+ [TestCase]
public void ImplicitConversionToStringTests() {
Realm realm = new Realm("http://host/");
string realmString = realm;
@@ -184,7 +184,7 @@ namespace DotNetOpenAuth.Test {
Assert.IsNull(realmString);
}
- [TestMethod]
+ [TestCase]
public void ImplicitConverstionFromUriTests() {
Uri uri = new Uri("http://host");
Realm realm = uri;
@@ -194,7 +194,7 @@ namespace DotNetOpenAuth.Test {
Assert.IsNull(realm);
}
- [TestMethod]
+ [TestCase]
public void EqualsTest() {
Realm testRealm1a = new Realm("http://www.yahoo.com");
Realm testRealm1b = new Realm("http://www.yahoo.com");
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/AuthenticationRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/AuthenticationRequestTests.cs
index 8f53cdd..0eaae05 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/AuthenticationRequestTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/AuthenticationRequestTests.cs
@@ -17,9 +17,9 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class AuthenticationRequestTests : OpenIdTestBase {
private readonly Realm realm = new Realm("http://localhost/rp.aspx");
private readonly Identifier claimedId = "http://claimedId";
@@ -27,7 +27,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
private readonly Protocol protocol = Protocol.Default;
private Uri returnTo;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
this.returnTo = new Uri("http://localhost/rp.aspx");
@@ -36,7 +36,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies IsDirectedIdentity returns true when appropriate.
/// </summary>
- [TestMethod]
+ [TestCase]
public void IsDirectedIdentity() {
var iauthRequest = this.CreateAuthenticationRequest(this.claimedId, this.claimedId);
Assert.IsFalse(iauthRequest.IsDirectedIdentity);
@@ -48,7 +48,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies ClaimedIdentifier behavior.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ClaimedIdentifier() {
var iauthRequest = this.CreateAuthenticationRequest(this.claimedId, this.delegatedLocalId);
Assert.AreEqual(this.claimedId, iauthRequest.ClaimedIdentifier);
@@ -60,7 +60,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies ProviderVersion behavior.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ProviderVersion() {
var authRequest = this.CreateAuthenticationRequest(this.claimedId, this.claimedId);
Assert.AreEqual(this.protocol.Version, authRequest.DiscoveryResult.Version);
@@ -69,7 +69,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies RedirectingResponse.
/// </summary>
- [TestMethod]
+ [TestCase]
public void CreateRequestMessage() {
OpenIdCoordinator coordinator = new OpenIdCoordinator(
rp => {
@@ -107,7 +107,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies that delegating authentication requests are filtered out when configured to do so.
/// </summary>
- [TestMethod]
+ [TestCase]
public void CreateFiltersDelegatingIdentifiers() {
Identifier id = GetMockIdentifier(ProtocolVersion.V20, false, true);
var rp = CreateRelyingParty();
@@ -123,7 +123,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies the Provider property returns non-null.
/// </summary>
- [TestMethod]
+ [TestCase]
public void Provider() {
var authRequest = this.CreateAuthenticationRequest(this.claimedId, this.claimedId);
Assert.IsNotNull(authRequest.Provider);
@@ -134,7 +134,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies that AddCallbackArguments adds query arguments to the return_to URL of the message.
/// </summary>
- [TestMethod]
+ [TestCase]
public void AddCallbackArgument() {
var authRequest = this.CreateAuthenticationRequest(this.claimedId, this.claimedId);
Assert.AreEqual(this.returnTo, authRequest.ReturnToUrl);
@@ -148,7 +148,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// Verifies that AddCallbackArguments replaces pre-existing parameter values
/// rather than appending them.
/// </summary>
- [TestMethod]
+ [TestCase]
public void AddCallbackArgumentClearsPreviousArgument() {
UriBuilder returnToWithArgs = new UriBuilder(this.returnTo);
returnToWithArgs.AppendQueryArgs(new Dictionary<string, string> { { "p1", "v1" } });
@@ -163,20 +163,20 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies identity-less checkid_* request behavior.
/// </summary>
- [TestMethod]
+ [TestCase]
public void NonIdentityRequest() {
var authRequest = this.CreateAuthenticationRequest(this.claimedId, this.claimedId);
authRequest.IsExtensionOnly = true;
Assert.IsTrue(authRequest.IsExtensionOnly);
var req = (SignedResponseRequest)authRequest.RedirectingResponse.OriginalMessage;
- Assert.IsNotInstanceOfType(req, typeof(CheckIdRequest), "An unexpected SignedResponseRequest derived type was generated.");
+ Assert.IsNotInstanceOfType(typeof(CheckIdRequest), req, "An unexpected SignedResponseRequest derived type was generated.");
}
/// <summary>
/// Verifies that discovery on identifiers that serve as OP identifiers and claimed identifiers
/// only generate OP Identifier auth requests.
/// </summary>
- [TestMethod]
+ [TestCase]
public void DualIdentifierUsedOnlyAsOPIdentifierForAuthRequest() {
var rp = this.CreateRelyingParty(true);
var results = AuthenticationRequest.Create(GetMockDualIdentifier(), rp, this.realm, this.returnTo, false).ToList();
@@ -194,7 +194,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// Verifies that authentication requests are generated first for OPs that respond
/// to authentication requests.
/// </summary>
- [TestMethod, Ignore]
+ [TestCase, Ignore("Not yet implemented")]
public void UnresponsiveProvidersComeLast() {
// TODO: code here
Assert.Inconclusive("Not yet implemented.");
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/FailedAuthenticationResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/FailedAuthenticationResponseTests.cs
index a82634a..43d056f 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/FailedAuthenticationResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/FailedAuthenticationResponseTests.cs
@@ -12,14 +12,14 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class FailedAuthenticationResponseTests : OpenIdTestBase {
private FailedAuthenticationResponse response;
private ProtocolException exception;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -27,12 +27,12 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
this.response = new FailedAuthenticationResponse(this.exception);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNull() {
new FailedAuthenticationResponse(null);
}
- [TestMethod]
+ [TestCase]
public void CommonProperties() {
Assert.AreEqual(AuthenticationStatus.Failed, this.response.Status);
Assert.AreSame(this.exception, this.response.Exception);
@@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.IsNull(this.response.FriendlyIdentifierForDisplay);
}
- [TestMethod]
+ [TestCase]
public void CommonMethods() {
Assert.IsNull(this.response.GetExtension<ClaimsRequest>());
Assert.IsNull(this.response.GetExtension(typeof(ClaimsRequest)));
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/IdentifierDiscoveryResultTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/IdentifierDiscoveryResultTests.cs
index 1ed281c..896cf57 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/IdentifierDiscoveryResultTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/IdentifierDiscoveryResultTests.cs
@@ -16,9 +16,9 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Messaging;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class IdentifierDiscoveryResultTests : OpenIdTestBase {
private UriIdentifier claimedId = new UriIdentifier("http://claimedid.justatest.com");
private XriIdentifier claimedXri = new XriIdentifier("=!9B72.7DD1.50A9.5CCD");
@@ -30,12 +30,12 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
private int servicePriority = 10;
private int uriPriority = 10;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
- [TestMethod]
+ [TestCase]
public void Ctor() {
IdentifierDiscoveryResult se = IdentifierDiscoveryResult.CreateForClaimedIdentifier(this.claimedId, this.localId, new ProviderEndpointDescription(this.providerEndpoint, this.v20TypeUris), this.servicePriority, this.uriPriority);
Assert.AreEqual(this.claimedId, se.ClaimedIdentifier);
@@ -45,7 +45,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.AreEqual(this.servicePriority, se.ServicePriority);
}
- [TestMethod]
+ [TestCase]
public void CtorImpliedLocalIdentifier() {
IdentifierDiscoveryResult se = IdentifierDiscoveryResult.CreateForClaimedIdentifier(this.claimedId, null, new ProviderEndpointDescription(this.providerEndpoint, this.v20TypeUris), this.servicePriority, this.uriPriority);
Assert.AreEqual(this.claimedId, se.ClaimedIdentifier);
@@ -54,7 +54,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
CollectionAssert<string>.AreEquivalent(this.v20TypeUris, se.Capabilities);
}
- [TestMethod]
+ [TestCase]
public void ProtocolDetection() {
IdentifierDiscoveryResult se = IdentifierDiscoveryResult.CreateForClaimedIdentifier(this.claimedId, this.localId, new ProviderEndpointDescription(this.providerEndpoint, this.v20TypeUris), this.servicePriority, this.uriPriority);
Assert.AreSame(Protocol.V20, se.Protocol);
@@ -69,7 +69,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.AreSame(Protocol.V11, se.Protocol);
}
- [TestMethod]
+ [TestCase]
public void EqualsTests() {
IdentifierDiscoveryResult se = IdentifierDiscoveryResult.CreateForClaimedIdentifier(this.claimedId, this.localId, new ProviderEndpointDescription(this.providerEndpoint, this.v20TypeUris), this.servicePriority, this.uriPriority);
IdentifierDiscoveryResult se2 = IdentifierDiscoveryResult.CreateForClaimedIdentifier(this.claimedId, this.localId, new ProviderEndpointDescription(this.providerEndpoint, this.v20TypeUris), (int?)null, (int?)null);
@@ -92,7 +92,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.IsTrue(list.Contains(se2));
}
- [TestMethod]
+ [TestCase]
public void GetFriendlyIdentifierForDisplay() {
Uri providerEndpoint = new Uri("http://someprovider");
Identifier localId = "someuser";
@@ -136,50 +136,50 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.AreEqual("=!9B72.7DD1.50A9.5CCD", se.FriendlyIdentifierForDisplay);
}
- [TestMethod]
+ [TestCase]
public void IsTypeUriPresent() {
IdentifierDiscoveryResult se = IdentifierDiscoveryResult.CreateForClaimedIdentifier(this.claimedXri, this.userSuppliedXri, this.localId, new ProviderEndpointDescription(this.providerEndpoint, this.v20TypeUris), this.servicePriority, this.uriPriority);
Assert.IsTrue(se.IsTypeUriPresent(Protocol.Default.ClaimedIdentifierServiceTypeURI));
Assert.IsFalse(se.IsTypeUriPresent("http://someother"));
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void IsTypeUriPresentNull() {
IdentifierDiscoveryResult se = IdentifierDiscoveryResult.CreateForClaimedIdentifier(this.claimedXri, this.userSuppliedXri, this.localId, new ProviderEndpointDescription(this.providerEndpoint, this.v20TypeUris), this.servicePriority, this.uriPriority);
se.IsTypeUriPresent(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void IsTypeUriPresentEmpty() {
IdentifierDiscoveryResult se = IdentifierDiscoveryResult.CreateForClaimedIdentifier(this.claimedXri, this.userSuppliedXri, this.localId, new ProviderEndpointDescription(this.providerEndpoint, this.v20TypeUris), this.servicePriority, this.uriPriority);
se.IsTypeUriPresent(string.Empty);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void IsExtensionSupportedNullType() {
var se = IdentifierDiscoveryResult.CreateForProviderIdentifier(OPUri, new ProviderEndpointDescription(OPUri, this.v20TypeUris), null, null);
se.IsExtensionSupported((Type)null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void IsTypeUriPresentNullString() {
var se = IdentifierDiscoveryResult.CreateForProviderIdentifier(OPUri, new ProviderEndpointDescription(OPUri, this.v20TypeUris), null, null);
se.IsTypeUriPresent((string)null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void IsTypeUriPresentEmptyString() {
var se = IdentifierDiscoveryResult.CreateForProviderIdentifier(OPUri, new ProviderEndpointDescription(OPUri, this.v20TypeUris), null, null);
se.IsTypeUriPresent(string.Empty);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void IsExtensionSupportedNullExtension() {
var se = IdentifierDiscoveryResult.CreateForProviderIdentifier(OPUri, new ProviderEndpointDescription(OPUri, this.v20TypeUris), null, null);
se.IsExtensionSupported((IOpenIdMessageExtension)null);
}
- [TestMethod]
+ [TestCase]
public void IsExtensionSupported() {
var se = IdentifierDiscoveryResult.CreateForProviderIdentifier(OPUri, new ProviderEndpointDescription(OPUri, this.v20TypeUris), null, null);
Assert.IsFalse(se.IsExtensionSupported<ClaimsRequest>());
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/NegativeAuthenticationResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/NegativeAuthenticationResponseTests.cs
index acf537e..dbb4a42 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/NegativeAuthenticationResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/NegativeAuthenticationResponseTests.cs
@@ -13,16 +13,16 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class NegativeAuthenticationResponseTests : OpenIdTestBase {
private const string UserSuppliedIdentifier = "=arnott";
private Protocol protocol;
private NegativeAssertionResponse responseMessage;
private NegativeAuthenticationResponse response;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -32,7 +32,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
this.response = new NegativeAuthenticationResponse(this.responseMessage);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNull() {
new NegativeAuthenticationResponse(null);
}
@@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies that immediate/setup modes are correctly detected.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ImmediateVsSetupModes() {
this.responseMessage = new NegativeAssertionResponse(this.protocol.Version, RPUri, this.protocol.Args.Mode.cancel);
this.response = new NegativeAuthenticationResponse(this.responseMessage);
@@ -55,17 +55,17 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
this.responseMessage.ExtraData[AuthenticationRequest.UserSuppliedIdentifierParameterName] = UserSuppliedIdentifier;
this.response = new NegativeAuthenticationResponse(this.responseMessage);
Assert.AreEqual(AuthenticationStatus.SetupRequired, this.response.Status);
- Assert.AreEqual<string>(UserSuppliedIdentifier, this.response.UserSuppliedIdentifier);
+ Assert.AreEqual(UserSuppliedIdentifier, (string)this.response.UserSuppliedIdentifier);
}
- [TestMethod]
+ [TestCase]
public void CommonProperties() {
Assert.IsNull(this.response.Exception);
Assert.IsNull(this.response.ClaimedIdentifier);
Assert.IsNull(this.response.FriendlyIdentifierForDisplay);
}
- [TestMethod]
+ [TestCase]
public void CommonMethods() {
Assert.IsNull(this.response.GetExtension<ClaimsRequest>());
Assert.IsNull(this.response.GetExtension(typeof(ClaimsRequest)));
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
index 7f0eb81..1ef7976 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
@@ -12,16 +12,16 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using DotNetOpenAuth.OpenId.Extensions;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class OpenIdRelyingPartyTests : OpenIdTestBase {
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
- [TestMethod]
+ [TestCase]
public void CreateRequestDumbMode() {
var rp = this.CreateRelyingParty(true);
Identifier id = this.GetMockIdentifier(ProtocolVersion.V20);
@@ -30,22 +30,22 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.IsNull(requestMessage.AssociationHandle);
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void SecuritySettingsSetNull() {
var rp = new OpenIdRelyingParty(new StandardRelyingPartyApplicationStore());
rp.SecuritySettings = null;
}
- [TestMethod]
+ [TestCase]
public void ExtensionFactories() {
var rp = new OpenIdRelyingParty(null);
var factories = rp.ExtensionFactories;
Assert.IsNotNull(factories);
Assert.AreEqual(1, factories.Count);
- Assert.IsInstanceOfType(factories[0], typeof(StandardOpenIdExtensionFactory));
+ Assert.IsInstanceOfType(typeof(StandardOpenIdExtensionFactory), factories[0]);
}
- [TestMethod]
+ [TestCase]
public void CreateRequest() {
var rp = this.CreateRelyingParty();
StoreAssociation(rp, OPUri, HmacShaAssociation.Create("somehandle", new byte[20], TimeSpan.FromDays(1)));
@@ -54,7 +54,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.IsNotNull(req);
}
- [TestMethod]
+ [TestCase]
public void CreateRequests() {
var rp = this.CreateRelyingParty();
StoreAssociation(rp, OPUri, HmacShaAssociation.Create("somehandle", new byte[20], TimeSpan.FromDays(1)));
@@ -63,7 +63,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.AreEqual(1, requests.Count());
}
- [TestMethod]
+ [TestCase]
public void CreateRequestsWithEndpointFilter() {
var rp = this.CreateRelyingParty();
StoreAssociation(rp, OPUri, HmacShaAssociation.Create("somehandle", new byte[20], TimeSpan.FromDays(1)));
@@ -78,7 +78,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.AreEqual(0, requests.Count());
}
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void CreateRequestOnNonOpenID() {
Uri nonOpenId = new Uri("http://www.microsoft.com/");
var rp = this.CreateRelyingParty();
@@ -86,7 +86,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
rp.CreateRequest(nonOpenId, RPRealmUri, RPUri);
}
- [TestMethod]
+ [TestCase]
public void CreateRequestsOnNonOpenID() {
Uri nonOpenId = new Uri("http://www.microsoft.com/");
var rp = this.CreateRelyingParty();
@@ -99,7 +99,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// Verifies that incoming positive assertions throw errors if they come from
/// OPs that are not approved by <see cref="OpenIdRelyingParty.EndpointFilter"/>.
/// </summary>
- [TestMethod]
+ [TestCase]
public void AssertionWithEndpointFilter() {
var coordinator = new OpenIdCoordinator(
rp => {
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdTextBoxTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdTextBoxTests.cs
index 67255e3..2c70e0f 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdTextBoxTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdTextBoxTests.cs
@@ -6,14 +6,14 @@
namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class OpenIdTextBoxTests : OpenIdTestBase {
/// <summary>
/// Verifies that the Text and Identifier properties interact correctly.
/// </summary>
- [TestMethod]
+ [TestCase]
public void IdentifierTextInteraction() {
var box = new OpenIdTextBox();
Assert.AreEqual(string.Empty, box.Text);
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs
index 1418513..b0586a6 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs
@@ -10,14 +10,14 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class PositiveAnonymousResponseTests : OpenIdTestBase {
private readonly Realm realm = new Realm("http://localhost/rp.aspx");
private readonly Uri returnTo = new Uri("http://localhost/rp.aspx");
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
@@ -25,7 +25,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies that the Status property returns the correct value.
/// </summary>
- [TestMethod]
+ [TestCase]
public void CtorAndProperties() {
var responseMessage = new IndirectSignedResponse(Protocol.V20.Version, this.returnTo);
var ext = new ClaimsResponse();
@@ -43,7 +43,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies the Provider property.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ProviderTest() {
var responseMessage = new IndirectSignedResponse(Protocol.V20.Version, this.returnTo);
responseMessage.ProviderEndpoint = OPUri;
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs
index 38dd0e6..811b7d1 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs
@@ -12,14 +12,14 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class PositiveAuthenticationResponseTests : OpenIdTestBase {
private readonly Realm realm = new Realm("http://localhost/rp.aspx");
private readonly Uri returnTo = new Uri("http://localhost/rp.aspx");
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
@@ -27,7 +27,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies good, positive assertions are accepted.
/// </summary>
- [TestMethod]
+ [TestCase]
public void Valid() {
PositiveAssertionResponse assertion = this.GetPositiveAssertion();
ClaimsResponse extension = new ClaimsResponse();
@@ -37,8 +37,8 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
var authResponseAccessor = PositiveAuthenticationResponse_Accessor.AttachShadow(authResponse);
Assert.AreEqual(AuthenticationStatus.Authenticated, authResponse.Status);
Assert.IsNull(authResponse.Exception);
- Assert.AreEqual<string>(assertion.ClaimedIdentifier, authResponse.ClaimedIdentifier);
- Assert.AreEqual<string>(authResponse.Endpoint.FriendlyIdentifierForDisplay, authResponse.FriendlyIdentifierForDisplay);
+ Assert.AreEqual((string)assertion.ClaimedIdentifier, (string)authResponse.ClaimedIdentifier);
+ Assert.AreEqual(authResponse.Endpoint.FriendlyIdentifierForDisplay, authResponse.FriendlyIdentifierForDisplay);
Assert.AreSame(extension, authResponse.GetUntrustedExtension(typeof(ClaimsResponse)));
Assert.AreSame(extension, authResponse.GetUntrustedExtension<ClaimsResponse>());
Assert.IsNull(authResponse.GetCallbackArgument("a"));
@@ -48,7 +48,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// <summary>
/// Verifies that discovery verification of a positive assertion can match a dual identifier.
/// </summary>
- [TestMethod]
+ [TestCase]
public void DualIdentifierMatchesInAssertionVerification() {
PositiveAssertionResponse assertion = this.GetPositiveAssertion(true);
ClaimsResponse extension = new ClaimsResponse();
@@ -62,7 +62,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// Verifies that discovery verification of a positive assertion cannot match a dual identifier
/// if the default settings are in place.
/// </summary>
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void DualIdentifierNoMatchInAssertionVerificationByDefault() {
PositiveAssertionResponse assertion = this.GetPositiveAssertion(true);
ClaimsResponse extension = new ClaimsResponse();
@@ -76,7 +76,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// makes up a claimed Id that was not part of the original request, and
/// that the OP has no authority to assert positively regarding.
/// </summary>
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void SpoofedClaimedIdDetectionSolicited() {
PositiveAssertionResponse assertion = this.GetPositiveAssertion();
assertion.ProviderEndpoint = new Uri("http://rogueOP");
@@ -89,7 +89,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// Verifies that the RP rejects positive assertions with HTTP Claimed
/// Cdentifiers when RequireSsl is set to true.
/// </summary>
- [TestMethod, ExpectedException(typeof(ProtocolException))]
+ [TestCase, ExpectedException(typeof(ProtocolException))]
public void InsecureIdentifiersRejectedWithRequireSsl() {
PositiveAssertionResponse assertion = this.GetPositiveAssertion();
var rp = CreateRelyingParty();
@@ -97,7 +97,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
var authResponse = new PositiveAuthenticationResponse(assertion, rp);
}
- [TestMethod]
+ [TestCase]
public void GetCallbackArguments() {
PositiveAssertionResponse assertion = this.GetPositiveAssertion();
var rp = CreateRelyingParty();
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/RelyingPartySecuritySettingsTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/RelyingPartySecuritySettingsTests.cs
index 851939e..2f6d218 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/RelyingPartySecuritySettingsTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/RelyingPartySecuritySettingsTests.cs
@@ -10,20 +10,20 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using System.Linq;
using System.Text;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class RelyingPartySecuritySettingsTests : OpenIdTestBase {
private RelyingPartySecuritySettings settings;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
this.settings = new RelyingPartySecuritySettings();
}
- [TestMethod]
+ [TestCase]
public void Defaults() {
Assert.IsFalse(this.settings.RejectUnsolicitedAssertions);
Assert.IsFalse(this.settings.RequireSsl, "Default should be to not require SSL.");
@@ -33,7 +33,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// Verifies that the <see cref="RelyingPartySecuritySettings.RequireSsl"/> property
/// getter/setter are implemented correctly.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RequireSsl() {
this.settings.RequireSsl = true;
Assert.IsTrue(this.settings.RequireSsl);
@@ -45,7 +45,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// Verifies that the <see cref="RelyingPartySecuritySettings.RequireDirectedIdentity"/>
/// property getter/setter are implemented correctly.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RequireDirectedIdentity() {
this.settings.RequireDirectedIdentity = true;
Assert.IsTrue(this.settings.RequireDirectedIdentity);
@@ -57,7 +57,7 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
/// Verifies that the <see cref="RelyingPartySecuritySettings.RequireAssociation"/>
/// property getter/setter are implemented correctly.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RequireAssociation() {
this.settings.RequireAssociation = true;
Assert.IsTrue(this.settings.RequireAssociation);
diff --git a/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs b/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs
index d504cdf..73c185e 100644
--- a/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs
@@ -13,40 +13,40 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class UriIdentifierTests : OpenIdTestBase {
private string goodUri = "http://blog.nerdbank.net/";
private string relativeUri = "host/path";
private string badUri = "som%-)830w8vf/?.<>,ewackedURI";
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullUri() {
new UriIdentifier((Uri)null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorNullString() {
new UriIdentifier((string)null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorBlank() {
new UriIdentifier(string.Empty);
}
- [TestMethod, ExpectedException(typeof(UriFormatException))]
+ [TestCase, ExpectedException(typeof(UriFormatException))]
public void CtorBadUri() {
new UriIdentifier(this.badUri);
}
- [TestMethod]
+ [TestCase]
public void CtorGoodUri() {
var uri = new UriIdentifier(this.goodUri);
Assert.AreEqual(new Uri(this.goodUri), uri.Uri);
@@ -54,33 +54,33 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.IsFalse(uri.IsDiscoverySecureEndToEnd);
}
- [TestMethod]
+ [TestCase]
public void CtorStringNoSchemeSecure() {
var uri = new UriIdentifier("host/path", true);
Assert.AreEqual("https://host/path", uri.Uri.AbsoluteUri);
Assert.IsTrue(uri.IsDiscoverySecureEndToEnd);
}
- [TestMethod]
+ [TestCase]
public void CtorStringHttpsSchemeSecure() {
var uri = new UriIdentifier("https://host/path", true);
Assert.AreEqual("https://host/path", uri.Uri.AbsoluteUri);
Assert.IsTrue(uri.IsDiscoverySecureEndToEnd);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorStringHttpSchemeSecure() {
new UriIdentifier("http://host/path", true);
}
- [TestMethod]
+ [TestCase]
public void CtorUriHttpsSchemeSecure() {
var uri = new UriIdentifier(new Uri("https://host/path"), true);
Assert.AreEqual("https://host/path", uri.Uri.AbsoluteUri);
Assert.IsTrue(uri.IsDiscoverySecureEndToEnd);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorUriHttpSchemeSecure() {
new UriIdentifier(new Uri("http://host/path"), true);
}
@@ -93,21 +93,21 @@ namespace DotNetOpenAuth.Test.OpenId {
/// they should NOT be stripped from claimed identifiers. So the UriIdentifier
/// class, which serves both identifier types, must not do the stripping.
/// </remarks>
- [TestMethod]
+ [TestCase]
public void DoesNotStripFragment() {
Uri original = new Uri("http://a/b#c");
UriIdentifier identifier = new UriIdentifier(original);
Assert.AreEqual(original.Fragment, identifier.Uri.Fragment);
}
- [TestMethod]
+ [TestCase]
public void IsValid() {
Assert.IsTrue(UriIdentifier.IsValidUri(this.goodUri));
Assert.IsFalse(UriIdentifier.IsValidUri(this.badUri));
Assert.IsTrue(UriIdentifier.IsValidUri(this.relativeUri), "URL lacking http:// prefix should have worked anyway.");
}
- [TestMethod]
+ [TestCase]
public void TrimFragment() {
Identifier noFragment = UriIdentifier.Parse("http://a/b");
Identifier fragment = UriIdentifier.Parse("http://a/b#c");
@@ -115,22 +115,22 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.AreEqual(noFragment, fragment.TrimFragment());
}
- [TestMethod]
+ [TestCase]
public void ToStringTest() {
Assert.AreEqual(this.goodUri, new UriIdentifier(this.goodUri).ToString());
}
- [TestMethod]
+ [TestCase]
public void EqualsTest() {
Assert.AreEqual(new UriIdentifier(this.goodUri), new UriIdentifier(this.goodUri));
// This next test is an interesting side-effect of passing off to Uri.Equals. But it's probably ok.
Assert.AreEqual(new UriIdentifier(this.goodUri), new UriIdentifier(this.goodUri + "#frag"));
Assert.AreNotEqual(new UriIdentifier(this.goodUri), new UriIdentifier(this.goodUri + "a"));
Assert.AreNotEqual(null, new UriIdentifier(this.goodUri));
- Assert.AreEqual(this.goodUri, new UriIdentifier(this.goodUri));
+ Assert.IsTrue(new UriIdentifier(this.goodUri).Equals(this.goodUri));
}
- [TestMethod]
+ [TestCase]
public void UnicodeTest() {
string unicodeUrl = "http://nerdbank.org/opaffirmative/崎村.aspx";
Assert.IsTrue(UriIdentifier.IsValidUri(unicodeUrl));
@@ -140,7 +140,7 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.AreEqual(Uri.EscapeUriString(unicodeUrl), id.ToString());
}
- [TestMethod]
+ [TestCase]
public void NormalizeCase() {
// only the host name can be normalized in casing safely.
Identifier id = "http://HOST:80/PaTH?KeY=VaLUE#fRag";
@@ -150,21 +150,21 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.AreEqual("https://host:80/PaTH?KeY=VaLUE#fRag", id.ToString());
}
- [TestMethod]
+ [TestCase]
public void HttpSchemePrepended() {
UriIdentifier id = new UriIdentifier("www.yahoo.com");
Assert.AreEqual("http://www.yahoo.com/", id.ToString());
Assert.IsTrue(id.SchemeImplicitlyPrepended);
}
- ////[TestMethod, Ignore("The spec says http:// must be prepended in this case, but that just creates an invalid URI. Our UntrustedWebRequest will stop disallowed schemes.")]
+ ////[TestCase, Ignore("The spec says http:// must be prepended in this case, but that just creates an invalid URI. Our UntrustedWebRequest will stop disallowed schemes.")]
public void CtorDisallowedScheme() {
UriIdentifier id = new UriIdentifier(new Uri("ftp://host/path"));
Assert.AreEqual("http://ftp://host/path", id.ToString());
Assert.IsTrue(id.SchemeImplicitlyPrepended);
}
- [TestMethod]
+ [TestCase]
public void TryRequireSslAdjustsIdentifier() {
Identifier secureId;
// Try Parse and ctor without explicit scheme
diff --git a/src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs b/src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs
index d5a51cf..0c80821 100644
--- a/src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs
@@ -10,34 +10,34 @@ namespace DotNetOpenAuth.Test.OpenId {
using System.Linq;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class XriIdentifierTests : OpenIdTestBase {
private string goodXri = "=Andrew*Arnott";
private string badXri = "some\\wacky%^&*()non-XRI";
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorNull() {
new XriIdentifier(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void CtorBlank() {
new XriIdentifier(string.Empty);
}
- [TestMethod, ExpectedException(typeof(FormatException))]
+ [TestCase, ExpectedException(typeof(FormatException))]
public void CtorBadXri() {
new XriIdentifier(this.badXri);
}
- [TestMethod]
+ [TestCase]
public void CtorGoodXri() {
var xri = new XriIdentifier(this.goodXri);
Assert.AreEqual(this.goodXri, xri.OriginalXri);
@@ -45,7 +45,7 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.IsFalse(xri.IsDiscoverySecureEndToEnd);
}
- [TestMethod]
+ [TestCase]
public void CtorGoodXriSecure() {
var xri = new XriIdentifier(this.goodXri, true);
Assert.AreEqual(this.goodXri, xri.OriginalXri);
@@ -53,7 +53,7 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.IsTrue(xri.IsDiscoverySecureEndToEnd);
}
- [TestMethod]
+ [TestCase]
public void IsValid() {
Assert.IsTrue(XriIdentifier.IsValidXri(this.goodXri));
Assert.IsFalse(XriIdentifier.IsValidXri(this.badXri));
@@ -62,33 +62,33 @@ namespace DotNetOpenAuth.Test.OpenId {
/// <summary>
/// Verifies 2.0 spec section 7.2#1
/// </summary>
- [TestMethod]
+ [TestCase]
public void StripXriScheme() {
var xri = new XriIdentifier("xri://" + this.goodXri);
Assert.AreEqual("xri://" + this.goodXri, xri.OriginalXri);
Assert.AreEqual(this.goodXri, xri.CanonicalXri);
}
- [TestMethod]
+ [TestCase]
public void TrimFragment() {
Identifier xri = new XriIdentifier(this.goodXri);
Assert.AreSame(xri, xri.TrimFragment());
}
- [TestMethod]
+ [TestCase]
public void ToStringTest() {
Assert.AreEqual(this.goodXri, new XriIdentifier(this.goodXri).ToString());
}
- [TestMethod]
+ [TestCase]
public void EqualsTest() {
Assert.AreEqual(new XriIdentifier(this.goodXri), new XriIdentifier(this.goodXri));
Assert.AreNotEqual(new XriIdentifier(this.goodXri), new XriIdentifier(this.goodXri + "a"));
Assert.AreNotEqual(null, new XriIdentifier(this.goodXri));
- Assert.AreEqual(this.goodXri, new XriIdentifier(this.goodXri));
+ Assert.IsTrue(new XriIdentifier(this.goodXri).Equals(this.goodXri));
}
- [TestMethod, Ignore] // XRI parsing and normalization is not implemented (yet).
+ [TestCase, Ignore("XRI parsing and normalization is not implemented (yet).")]
public void NormalizeCase() {
Identifier id = "=!9B72.7dd1.50a9.5ccd";
Assert.AreEqual("=!9B72.7DD1.50A9.5CCD", id.ToString());
diff --git a/src/DotNetOpenAuth.Test/TestBase.cs b/src/DotNetOpenAuth.Test/TestBase.cs
index c6508f6..df52d0a 100644
--- a/src/DotNetOpenAuth.Test/TestBase.cs
+++ b/src/DotNetOpenAuth.Test/TestBase.cs
@@ -11,7 +11,8 @@ namespace DotNetOpenAuth.Test {
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OAuth.Messages;
using log4net;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
+ using NUnit.Framework;
/// <summary>
/// The base class that all test classes inherit from.
@@ -25,12 +26,6 @@ namespace DotNetOpenAuth.Test {
private MessageDescriptionCollection messageDescriptions = new MessageDescriptionCollection();
/// <summary>
- /// Gets or sets the test context which provides
- /// information about and functionality for the current test run.
- /// </summary>
- public TestContext TestContext { get; set; }
-
- /// <summary>
/// Gets the logger that tests should use.
/// </summary>
internal static ILog TestLogger {
@@ -44,7 +39,7 @@ namespace DotNetOpenAuth.Test {
/// <summary>
/// The TestInitialize method for the test cases.
/// </summary>
- [TestInitialize]
+ [SetUp]
public virtual void SetUp() {
log4net.Config.XmlConfigurator.Configure(Assembly.GetExecutingAssembly().GetManifestResourceStream("DotNetOpenAuth.Test.Logging.config"));
MessageBase.LowSecurityMode = true;
@@ -55,7 +50,7 @@ namespace DotNetOpenAuth.Test {
/// <summary>
/// The TestCleanup method for the test cases.
/// </summary>
- [TestCleanup]
+ [TearDown]
public virtual void Cleanup() {
log4net.LogManager.Shutdown();
}
diff --git a/src/DotNetOpenAuth.Test/UriUtilTests.cs b/src/DotNetOpenAuth.Test/UriUtilTests.cs
index 29e740d..a2cf1a2 100644
--- a/src/DotNetOpenAuth.Test/UriUtilTests.cs
+++ b/src/DotNetOpenAuth.Test/UriUtilTests.cs
@@ -9,11 +9,11 @@ namespace DotNetOpenAuth.Test {
using System.Collections.Generic;
using System.Linq;
using System.Text;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class UriUtilTests {
- [TestMethod]
+ [TestCase]
public void QueryStringContainPrefixedParametersNull() {
Assert.IsFalse(UriUtil.QueryStringContainPrefixedParameters(null, "prefix."));
}
diff --git a/src/DotNetOpenAuth.Test/UtilTests.cs b/src/DotNetOpenAuth.Test/UtilTests.cs
index 5ea4d0c..0930e8d 100644
--- a/src/DotNetOpenAuth.Test/UtilTests.cs
+++ b/src/DotNetOpenAuth.Test/UtilTests.cs
@@ -9,14 +9,14 @@ namespace DotNetOpenAuth.Test {
using System.Collections.Generic;
using System.Linq;
using System.Text;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class UtilTests {
/// <summary>
/// Verifies ToStringDeferred generates a reasonable string for an empty, multi-line list.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ToStringDeferredEmptyMultiLine() {
Assert.AreEqual("[]", Util.ToStringDeferred(Enumerable.Empty<string>(), true).ToString());
}