diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOAuth.Test/DotNetOAuth.Test.csproj | 8 | ||||
-rw-r--r-- | src/DotNetOAuth.Test/Messaging/HttpRequestInfoTests.cs | 10 | ||||
-rw-r--r-- | src/DotNetOAuth.Test/Messaging/ProtocolExceptionTests.cs | 15 | ||||
-rw-r--r-- | src/DotNetOAuth.Test/Messaging/ResponseTests.cs (renamed from src/DotNetOAuth.Test/Messaging/ResponseTest.cs) | 12 | ||||
-rw-r--r-- | src/DotNetOAuth.Test/MessagingUtilitiesTests.cs (renamed from src/DotNetOAuth.Test/MessagingUtilitiesTest.cs) | 4 | ||||
-rw-r--r-- | src/DotNetOAuth.Test/Mocks/TestMessage.cs | 2 | ||||
-rw-r--r-- | src/DotNetOAuth.Test/ProtocolTests.cs | 37 | ||||
-rw-r--r-- | src/DotNetOAuth.Test/ServiceProviderTests.cs (renamed from src/DotNetOAuth.Test/ServiceProviderTest.cs) | 4 | ||||
-rw-r--r-- | src/DotNetOAuth.Test/UriUtilTests.cs | 21 | ||||
-rw-r--r-- | src/DotNetOAuth/Messaging/Channel.cs | 8 | ||||
-rw-r--r-- | src/DotNetOAuth/Messaging/HttpRequestInfo.cs | 2 | ||||
-rw-r--r-- | src/DotNetOAuth/Messaging/MessageSerializer.cs | 2 | ||||
-rw-r--r-- | src/DotNetOAuth/Messaging/Response.cs | 8 |
13 files changed, 99 insertions, 34 deletions
diff --git a/src/DotNetOAuth.Test/DotNetOAuth.Test.csproj b/src/DotNetOAuth.Test/DotNetOAuth.Test.csproj index 9911863..0fa624a 100644 --- a/src/DotNetOAuth.Test/DotNetOAuth.Test.csproj +++ b/src/DotNetOAuth.Test/DotNetOAuth.Test.csproj @@ -58,7 +58,7 @@ </Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="MessagingUtilitiesTest.cs" />
+ <Compile Include="MessagingUtilitiesTests.cs" />
<Compile Include="Messaging\ChannelTests.cs" />
<Compile Include="Messaging\DictionaryXmlReaderTests.cs" />
<Compile Include="Messaging\HttpRequestInfoTests.cs" />
@@ -71,9 +71,11 @@ <Compile Include="Mocks\TestMessage.cs" />
<Compile Include="Mocks\TestMessageTypeProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Messaging\ResponseTest.cs" />
- <Compile Include="ServiceProviderTest.cs" />
+ <Compile Include="Messaging\ResponseTests.cs" />
+ <Compile Include="ProtocolTests.cs" />
+ <Compile Include="ServiceProviderTests.cs" />
<Compile Include="TestBase.cs" />
+ <Compile Include="UriUtilTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DotNetOAuth\DotNetOAuth.csproj">
diff --git a/src/DotNetOAuth.Test/Messaging/HttpRequestInfoTests.cs b/src/DotNetOAuth.Test/Messaging/HttpRequestInfoTests.cs index 108a147..70fa1d0 100644 --- a/src/DotNetOAuth.Test/Messaging/HttpRequestInfoTests.cs +++ b/src/DotNetOAuth.Test/Messaging/HttpRequestInfoTests.cs @@ -4,17 +4,17 @@ // </copyright>
//-----------------------------------------------------------------------
-using System.Web;
-using DotNetOAuth.Messaging;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
namespace DotNetOAuth.Test.Messaging {
+ using System.Web;
+ using DotNetOAuth.Messaging;
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
+
[TestClass]
public class HttpRequestInfoTests : TestBase {
[TestMethod]
public void CtorRequest() {
HttpRequest request = new HttpRequest("file", "http://someserver?a=b", "a=b");
- //request.Headers["headername"] = "headervalue"; // PlatformNotSupportedException prevents us mocking this up
+ ////request.Headers["headername"] = "headervalue"; // PlatformNotSupportedException prevents us mocking this up
HttpRequestInfo info = new HttpRequestInfo(request);
Assert.AreEqual(request.Headers["headername"], info.Headers["headername"]);
Assert.AreEqual(request.Url.Query, info.Query);
diff --git a/src/DotNetOAuth.Test/Messaging/ProtocolExceptionTests.cs b/src/DotNetOAuth.Test/Messaging/ProtocolExceptionTests.cs index 9059e99..072b57c 100644 --- a/src/DotNetOAuth.Test/Messaging/ProtocolExceptionTests.cs +++ b/src/DotNetOAuth.Test/Messaging/ProtocolExceptionTests.cs @@ -1,11 +1,14 @@ -using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using DotNetOAuth.Messaging;
+//-----------------------------------------------------------------------
+// <copyright file="ProtocolExceptionTests.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
namespace DotNetOAuth.Test.Messaging {
+ using System;
+ using DotNetOAuth.Messaging;
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
+
[TestClass]
public class ProtocolExceptionTests : TestBase {
[TestMethod]
diff --git a/src/DotNetOAuth.Test/Messaging/ResponseTest.cs b/src/DotNetOAuth.Test/Messaging/ResponseTests.cs index 6b49e62..5020d7e 100644 --- a/src/DotNetOAuth.Test/Messaging/ResponseTest.cs +++ b/src/DotNetOAuth.Test/Messaging/ResponseTests.cs @@ -1,20 +1,18 @@ //-----------------------------------------------------------------------
-// <copyright file="ResponseTest.cs" company="Andrew Arnott">
+// <copyright file="ResponseTests.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOAuth.Test.Messaging {
using System;
+ using System.IO;
+ using System.Web;
using DotNetOAuth.Messaging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System.Web;
- using System.IO;
- using System.Threading;
- using System.Text;
[TestClass]
- public class ResponseTest : TestBase {
+ public class ResponseTests : TestBase {
[TestMethod, ExpectedException(typeof(InvalidOperationException))]
public void SendWithoutAspNetContext() {
new Response().Send();
@@ -23,7 +21,7 @@ namespace DotNetOAuth.Test.Messaging { [TestMethod]
public void Send() {
StringWriter writer = new StringWriter();
- HttpRequest httpRequest = new HttpRequest("file", "http://server", "");
+ HttpRequest httpRequest = new HttpRequest("file", "http://server", string.Empty);
HttpResponse httpResponse = new HttpResponse(writer);
HttpContext context = new HttpContext(httpRequest, httpResponse);
HttpContext.Current = context;
diff --git a/src/DotNetOAuth.Test/MessagingUtilitiesTest.cs b/src/DotNetOAuth.Test/MessagingUtilitiesTests.cs index cc3e552..56b9318 100644 --- a/src/DotNetOAuth.Test/MessagingUtilitiesTest.cs +++ b/src/DotNetOAuth.Test/MessagingUtilitiesTests.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="MessagingUtilitiesTest.cs" company="Andrew Arnott">
+// <copyright file="MessagingUtilitiesTests.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -16,7 +16,7 @@ namespace DotNetOAuth.Test using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
- public class MessagingUtilitiesTest : TestBase {
+ public class MessagingUtilitiesTests : TestBase {
[TestMethod]
public void CreateQueryString() {
var args = new Dictionary<string, string>();
diff --git a/src/DotNetOAuth.Test/Mocks/TestMessage.cs b/src/DotNetOAuth.Test/Mocks/TestMessage.cs index 6f654ea..6ff7658 100644 --- a/src/DotNetOAuth.Test/Mocks/TestMessage.cs +++ b/src/DotNetOAuth.Test/Mocks/TestMessage.cs @@ -36,7 +36,7 @@ namespace DotNetOAuth.Test.Mocks { }
MessageTransport IProtocolMessage.Transport {
- get { return transport; }
+ get { return this.transport; }
}
void IProtocolMessage.EnsureValidMessage() {
diff --git a/src/DotNetOAuth.Test/ProtocolTests.cs b/src/DotNetOAuth.Test/ProtocolTests.cs new file mode 100644 index 0000000..0a782d1 --- /dev/null +++ b/src/DotNetOAuth.Test/ProtocolTests.cs @@ -0,0 +1,37 @@ +//-----------------------------------------------------------------------
+// <copyright file="ProtocolTests.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOAuth.Test {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+ [TestClass]
+ public class ProtocolTests {
+ [TestMethod]
+ public void Default() {
+ Assert.AreSame(Protocol.V10, Protocol.Default);
+ }
+
+ [TestMethod]
+ public void DataContractNamespace() {
+ Assert.AreEqual("http://oauth.net/core/1.0/", Protocol.V10.DataContractNamespace);
+ Assert.AreEqual("http://oauth.net/core/1.0/", Protocol.DataContractNamespaceV10);
+ }
+
+ [TestMethod]
+ public void AuthorizationHeaderScheme() {
+ Assert.AreEqual("OAuth", Protocol.V10.AuthorizationHeaderScheme);
+ }
+
+ [TestMethod]
+ public void ParameterPrefix() {
+ Assert.AreEqual("oauth_", Protocol.V10.ParameterPrefix);
+ }
+ }
+}
diff --git a/src/DotNetOAuth.Test/ServiceProviderTest.cs b/src/DotNetOAuth.Test/ServiceProviderTests.cs index d4bced7..73663cf 100644 --- a/src/DotNetOAuth.Test/ServiceProviderTest.cs +++ b/src/DotNetOAuth.Test/ServiceProviderTests.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="ServiceProviderTest.cs" company="Andrew Arnott">
+// <copyright file="ServiceProviderTests.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -12,7 +12,7 @@ namespace DotNetOAuth.Test { /// Tests for the <see cref="ServiceProvider"/> class.
/// </summary>
[TestClass]
- public class ServiceProviderTest : TestBase {
+ public class ServiceProviderTests : TestBase {
/// <summary>
/// A test for UserAuthorizationUri
/// </summary>
diff --git a/src/DotNetOAuth.Test/UriUtilTests.cs b/src/DotNetOAuth.Test/UriUtilTests.cs new file mode 100644 index 0000000..0201e8a --- /dev/null +++ b/src/DotNetOAuth.Test/UriUtilTests.cs @@ -0,0 +1,21 @@ +//-----------------------------------------------------------------------
+// <copyright file="UriUtilTests.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOAuth.Test {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+ [TestClass]
+ public class UriUtilTests {
+ [TestMethod]
+ public void QueryStringContainsOAuthParametersNull() {
+ Assert.IsFalse(UriUtil.QueryStringContainsOAuthParameters(null));
+ }
+ }
+}
diff --git a/src/DotNetOAuth/Messaging/Channel.cs b/src/DotNetOAuth/Messaging/Channel.cs index f674f12..dc4209a 100644 --- a/src/DotNetOAuth/Messaging/Channel.cs +++ b/src/DotNetOAuth/Messaging/Channel.cs @@ -120,8 +120,12 @@ namespace DotNetOAuth.Messaging { this.SendIndirectMessage(directedMessage);
break;
default:
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
- MessagingStrings.UnrecognizedEnumValue, "Transport", message.Transport),
+ throw new ArgumentException(
+ string.Format(
+ CultureInfo.CurrentCulture,
+ MessagingStrings.UnrecognizedEnumValue,
+ "Transport",
+ message.Transport),
"message");
}
}
diff --git a/src/DotNetOAuth/Messaging/HttpRequestInfo.cs b/src/DotNetOAuth/Messaging/HttpRequestInfo.cs index e4aabb8..9a583c0 100644 --- a/src/DotNetOAuth/Messaging/HttpRequestInfo.cs +++ b/src/DotNetOAuth/Messaging/HttpRequestInfo.cs @@ -7,10 +7,10 @@ namespace DotNetOAuth.Messaging {
using System;
using System.Collections.Specialized;
+ using System.Diagnostics;
using System.IO;
using System.Net;
using System.Web;
- using System.Diagnostics;
/// <summary>
/// A property store of details of an incoming HTTP request.
diff --git a/src/DotNetOAuth/Messaging/MessageSerializer.cs b/src/DotNetOAuth/Messaging/MessageSerializer.cs index 5a39a61..b09a253 100644 --- a/src/DotNetOAuth/Messaging/MessageSerializer.cs +++ b/src/DotNetOAuth/Messaging/MessageSerializer.cs @@ -7,12 +7,12 @@ namespace DotNetOAuth.Messaging {
using System;
using System.Collections.Generic;
+ using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml;
using System.Xml.Linq;
- using System.Diagnostics;
/// <summary>
/// Serializes/deserializes OAuth messages for/from transit.
diff --git a/src/DotNetOAuth/Messaging/Response.cs b/src/DotNetOAuth/Messaging/Response.cs index 6413e68..81089ed 100644 --- a/src/DotNetOAuth/Messaging/Response.cs +++ b/src/DotNetOAuth/Messaging/Response.cs @@ -25,11 +25,11 @@ namespace DotNetOAuth.Messaging { /// </remarks>
public class Response {
/// <summary>
- /// Initializes an instance of the <see cref="Response"/> class.
+ /// Initializes a new instance of the <see cref="Response"/> class.
/// </summary>
internal Response() {
- Status = HttpStatusCode.OK;
- Headers = new WebHeaderCollection();
+ this.Status = HttpStatusCode.OK;
+ this.Headers = new WebHeaderCollection();
}
/// <summary>
@@ -71,7 +71,7 @@ namespace DotNetOAuth.Messaging { HttpContext.Current.Response.StatusCode = (int)this.Status;
MessagingUtilities.ApplyHeadersToResponse(this.Headers, HttpContext.Current.Response);
if (this.Body != null) {
- HttpContext.Current.Response.Output.Write(Body);
+ HttpContext.Current.Response.Output.Write(this.Body);
}
HttpContext.Current.Response.End();
}
|