summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OpenId/Provider
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/OpenId/Provider')
-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
5 files changed, 48 insertions, 48 deletions
diff --git a/src/DotNetOpenAuth.Test/OpenId/Provider/AnonymousRequestTests.cs b/src/DotNetOpenAuth.Test/OpenId/Provider/AnonymousRequestTests.cs
index 14fef91..1df4c9e 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.IsInstanceOf<NegativeAssertionResponse>(anonReq.Response);
anonReq.IsApproved = true;
- Assert.IsInstanceOfType(anonReq.Response, typeof(IndirectSignedResponse));
- Assert.IsNotInstanceOfType(anonReq.Response, typeof(PositiveAssertionResponse));
+ Assert.IsInstanceOf<IndirectSignedResponse>(anonReq.Response);
+ Assert.IsNotInstanceOf<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..75d871c 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.IsInstanceOf<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.IsInstanceOf<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, Category("HostASPNET")]
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..7984b58 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.IsInstanceOf<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.IsInstanceOf<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.IsInstanceOf<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;
}