summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OpenId/ChannelElements
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/OpenId/ChannelElements')
-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.cs10
4 files changed, 38 insertions, 38 deletions
diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
index 29797dc..5edd51f 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.IsInstanceOf<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..6160680 100644
--- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/SigningBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/SigningBindingElementTests.cs
@@ -12,16 +12,16 @@ 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;
+ Protocol protocol = Protocol.V20;
var settings = new ProviderSecuritySettings();
var store = new AssociationMemoryStore<AssociationRelyingPartyType>();
byte[] associationSecret = Convert.FromBase64String("rsSwv1zPWfjPRQU80hciu8FPDC+GONAMJQ/AvSo1a2M=");
@@ -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());