summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OAuth/ChannelElements
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-01-06 19:30:01 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2010-01-06 19:30:01 -0800
commitb4f047fc7af40f40149a84b58d8f3ad1632a48d5 (patch)
tree78ff419559a0496dbce02dc0140bd230218b79f8 /src/DotNetOpenAuth.Test/OAuth/ChannelElements
parent408d636335d73d5520bc1f9fbfdab224d492b7cf (diff)
downloadDotNetOpenAuth-b4f047fc7af40f40149a84b58d8f3ad1632a48d5.zip
DotNetOpenAuth-b4f047fc7af40f40149a84b58d8f3ad1632a48d5.tar.gz
DotNetOpenAuth-b4f047fc7af40f40149a84b58d8f3ad1632a48d5.tar.bz2
Converted all the rest of the tests over to NUnit.
Diffstat (limited to 'src/DotNetOpenAuth.Test/OAuth/ChannelElements')
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs50
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs14
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs16
5 files changed, 46 insertions, 46 deletions
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs
index fcdb5e8..a11c67d 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/HmacSha1SigningBindingElementTests.cs
@@ -8,11 +8,11 @@ namespace DotNetOpenAuth.Test.ChannelElements {
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class HmacSha1SigningBindingElementTests : MessagingTestBase {
- [TestMethod]
+ [TestCase]
public void SignatureTest() {
UnauthorizedTokenRequest message = SigningBindingElementBaseTests.CreateTestRequestTokenMessage(this.MessageDescriptions, null);
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
index e0cc92a..d854ee3 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
@@ -19,9 +19,9 @@ namespace DotNetOpenAuth.Test.ChannelElements {
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class OAuthChannelTests : TestBase {
private OAuthChannel channel;
private OAuthChannel_Accessor accessor;
@@ -29,7 +29,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
private SigningBindingElementBase signingElement;
private INonceStore nonceStore;
- [TestInitialize]
+ [SetUp]
public override void SetUp() {
base.SetUp();
@@ -41,32 +41,32 @@ namespace DotNetOpenAuth.Test.ChannelElements {
this.channel.WebRequestHandler = this.webRequestHandler;
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullSigner() {
new OAuthChannel(null, this.nonceStore, new InMemoryTokenManager(), new TestMessageFactory());
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullStore() {
new OAuthChannel(new RsaSha1SigningBindingElement(new InMemoryTokenManager()), null, new InMemoryTokenManager(), new TestMessageFactory());
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void CtorNullTokenManager() {
new OAuthChannel(new RsaSha1SigningBindingElement(new InMemoryTokenManager()), this.nonceStore, null, new TestMessageFactory());
}
- [TestMethod]
+ [TestCase]
public void CtorSimpleConsumer() {
new OAuthChannel(new RsaSha1SigningBindingElement(new InMemoryTokenManager()), this.nonceStore, (IConsumerTokenManager)new InMemoryTokenManager());
}
- [TestMethod]
+ [TestCase]
public void CtorSimpleServiceProvider() {
new OAuthChannel(new RsaSha1SigningBindingElement(new InMemoryTokenManager()), this.nonceStore, (IServiceProviderTokenManager)new InMemoryTokenManager());
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestAuthorization() {
this.ParameterizedReceiveTest(HttpDeliveryMethods.AuthorizationHeaderRequest);
}
@@ -75,7 +75,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
/// Verifies that the OAuth ReadFromRequest method gathers parameters
/// from the Authorization header, the query string and the entity form data.
/// </summary>
- [TestMethod]
+ [TestCase]
public void ReadFromRequestAuthorizationScattered() {
// Start by creating a standard POST HTTP request.
var fields = new Dictionary<string, string> {
@@ -99,24 +99,24 @@ namespace DotNetOpenAuth.Test.ChannelElements {
IDirectedProtocolMessage requestMessage = this.channel.ReadFromRequest(requestInfo);
Assert.IsNotNull(requestMessage);
- Assert.IsInstanceOfType(requestMessage, typeof(TestMessage));
+ Assert.IsInstanceOfType(typeof(TestMessage), requestMessage);
TestMessage testMessage = (TestMessage)requestMessage;
Assert.AreEqual(15, testMessage.Age);
Assert.AreEqual("Andrew", testMessage.Name);
Assert.AreEqual("http://hostb/pathB", testMessage.Location.AbsoluteUri);
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestForm() {
this.ParameterizedReceiveTest(HttpDeliveryMethods.PostRequest);
}
- [TestMethod]
+ [TestCase]
public void ReadFromRequestQueryString() {
this.ParameterizedReceiveTest(HttpDeliveryMethods.GetRequest);
}
- [TestMethod]
+ [TestCase]
public void SendDirectMessageResponse() {
IProtocolMessage message = new TestDirectedMessage {
Age = 15,
@@ -135,7 +135,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.AreEqual("http://hostb/pathB", body["Location"]);
}
- [TestMethod]
+ [TestCase]
public void ReadFromResponse() {
var fields = new Dictionary<string, string> {
{ "age", "15" },
@@ -157,18 +157,18 @@ namespace DotNetOpenAuth.Test.ChannelElements {
}
}
- [TestMethod, ExpectedException(typeof(ArgumentNullException))]
+ [TestCase, ExpectedException(typeof(ArgumentNullException))]
public void RequestNull() {
this.channel.Request(null);
}
- [TestMethod, ExpectedException(typeof(ArgumentException))]
+ [TestCase, ExpectedException(typeof(ArgumentException))]
public void RequestNullRecipient() {
IDirectedProtocolMessage message = new TestDirectedMessage(MessageTransport.Direct);
this.channel.Request(message);
}
- [TestMethod, ExpectedException(typeof(NotSupportedException))]
+ [TestCase, ExpectedException(typeof(NotSupportedException))]
public void RequestBadPreferredScheme() {
TestDirectedMessage message = new TestDirectedMessage(MessageTransport.Direct);
message.Recipient = new Uri("http://localtest");
@@ -176,7 +176,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
this.channel.Request(message);
}
- [TestMethod]
+ [TestCase]
public void RequestUsingAuthorizationHeader() {
this.ParameterizedRequestTest(HttpDeliveryMethods.AuthorizationHeaderRequest);
}
@@ -184,7 +184,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
/// <summary>
/// Verifies that message parts can be distributed to the query, form, and Authorization header.
/// </summary>
- [TestMethod]
+ [TestCase]
public void RequestUsingAuthorizationHeaderScattered() {
TestDirectedMessage request = new TestDirectedMessage(MessageTransport.Direct) {
Age = 15,
@@ -217,12 +217,12 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.AreEqual("appearinform=formish", this.webRequestHandler.RequestEntityAsString);
}
- [TestMethod]
+ [TestCase]
public void RequestUsingGet() {
this.ParameterizedRequestTest(HttpDeliveryMethods.GetRequest);
}
- [TestMethod]
+ [TestCase]
public void RequestUsingPost() {
this.ParameterizedRequestTest(HttpDeliveryMethods.PostRequest);
}
@@ -230,7 +230,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
/// <summary>
/// Verifies that messages asking for special HTTP status codes get them.
/// </summary>
- [TestMethod]
+ [TestCase]
public void SendDirectMessageResponseHonorsHttpStatusCodes() {
IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired);
OutgoingWebResponse directResponse = this.accessor.PrepareDirectResponse(message);
@@ -344,7 +344,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
IProtocolMessage response = this.channel.Request(request);
Assert.IsNotNull(response);
- Assert.IsInstanceOfType(response, typeof(TestMessage));
+ Assert.IsInstanceOfType(typeof(TestMessage), response);
TestMessage responseMessage = (TestMessage)response;
Assert.AreEqual(request.Age, responseMessage.Age);
Assert.AreEqual(request.Name, responseMessage.Name);
@@ -360,7 +360,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
};
IProtocolMessage requestMessage = this.channel.ReadFromRequest(CreateHttpRequestInfo(scheme, fields));
Assert.IsNotNull(requestMessage);
- Assert.IsInstanceOfType(requestMessage, typeof(TestMessage));
+ Assert.IsInstanceOfType(typeof(TestMessage), requestMessage);
TestMessage testMessage = (TestMessage)requestMessage;
Assert.AreEqual(15, testMessage.Age);
Assert.AreEqual("Andrew", testMessage.Name);
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
index 01d51a3..b81eefa 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/PlaintextSigningBindingElementTest.cs
@@ -10,11 +10,11 @@ namespace DotNetOpenAuth.Test.ChannelElements {
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
using DotNetOpenAuth.Test.Mocks;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class PlaintextSigningBindingElementTest {
- [TestMethod]
+ [TestCase]
public void HttpsSignatureGeneration() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
@@ -27,7 +27,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.AreEqual("cs&ts", message.Signature);
}
- [TestMethod]
+ [TestCase]
public void HttpsSignatureVerification() {
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
ITamperProtectionChannelBindingElement target = new PlaintextSigningBindingElement();
@@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.IsNotNull(target.ProcessIncomingMessage(message));
}
- [TestMethod]
+ [TestCase]
public void HttpsSignatureVerificationNotApplicable() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
@@ -53,7 +53,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.AreEqual(MessageProtections.None, target.ProcessIncomingMessage(message), "PLAINTEXT binding element should opt-out where it doesn't understand.");
}
- [TestMethod]
+ [TestCase]
public void HttpSignatureGeneration() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
@@ -68,7 +68,7 @@ namespace DotNetOpenAuth.Test.ChannelElements {
Assert.IsNull(message.Signature);
}
- [TestMethod]
+ [TestCase]
public void HttpSignatureVerification() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
index 6e566c8..c2ae65e 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
@@ -10,11 +10,11 @@ namespace DotNetOpenAuth.Test.ChannelElements {
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class SigningBindingElementBaseTests : MessagingTestBase {
- [TestMethod]
+ [TestCase]
public void BaseSignatureStringTest() {
// Tests a message sent by HTTP GET, with no query string included in the endpoint.
UnauthorizedTokenRequest message = CreateTestRequestTokenMessage(
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs
index 40fc93e..715669a 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/UriOrOobEncodingTests.cs
@@ -10,13 +10,13 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
using System.Linq;
using System.Text;
using DotNetOpenAuth.OAuth.ChannelElements;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using NUnit.Framework;
- [TestClass]
+ [TestFixture]
public class UriOrOobEncodingTests : TestBase {
private UriOrOobEncoding encoding;
- [TestInitialize]
+ [SetUp]
public void Setup() {
this.encoding = new UriOrOobEncoding();
}
@@ -24,7 +24,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies null value encoding
/// </summary>
- [TestMethod]
+ [TestCase]
public void NullValueEncoding() {
Assert.AreEqual("oob", this.encoding.EncodedNullValue);
}
@@ -32,7 +32,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies decoding "oob" results in a null uri.
/// </summary>
- [TestMethod]
+ [TestCase]
public void DecodeOobToNullUri() {
Assert.IsNull(this.encoding.Decode("oob"));
}
@@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies that decoding an empty string generates an exception.
/// </summary>
- [TestMethod, ExpectedException(typeof(UriFormatException))]
+ [TestCase, ExpectedException(typeof(UriFormatException))]
public void DecodeEmptyStringFails() {
this.encoding.Decode(string.Empty);
}
@@ -48,7 +48,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies proper decoding/encoding of a Uri
/// </summary>
- [TestMethod]
+ [TestCase]
public void UriEncodeDecode() {
Uri original = new Uri("http://somehost/p?q=a#frag");
string encodedValue = this.encoding.Encode(original);
@@ -60,7 +60,7 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
/// <summary>
/// Verifies failure to decode a relative Uri
/// </summary>
- [TestMethod, ExpectedException(typeof(UriFormatException))]
+ [TestCase, ExpectedException(typeof(UriFormatException))]
public void RelativeUriDecodeFails() {
this.encoding.Decode("../a/b");
}