summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OpenId
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/OpenId')
-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
62 files changed, 523 insertions, 526 deletions
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());