Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Commit

Permalink
Fixes two more tests. 2 left
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Mar 26, 2013
1 parent 61b4d2b commit df6e154
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


namespace DotNetOpenAuth.AspNet.Test { namespace DotNetOpenAuth.AspNet.Test {
using System; using System;
using System.Collections.Specialized;
using System.Web; using System.Web;
using DotNetOpenAuth.AspNet; using DotNetOpenAuth.AspNet;
using DotNetOpenAuth.AspNet.Clients; using DotNetOpenAuth.AspNet.Clients;
Expand Down Expand Up @@ -34,13 +35,14 @@ public void TestProviderNamePropertyIsCorrect() {
[TestCase] [TestCase]
public async Task RequestAuthenticationInvokeMethodOnWebWorker() { public async Task RequestAuthenticationInvokeMethodOnWebWorker() {
// Arrange // Arrange
var returnUri = new Uri("http://live.com/my/path.cshtml?q=one");
var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict); var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict);
webWorker webWorker
.Setup(w => w.RequestAuthenticationAsync(It.Is<Uri>(u => u.ToString().Equals("http://live.com/my/path.cshtml?q=one")), It.IsAny<CancellationToken>())) .Setup(w => w.RequestAuthenticationAsync(returnUri, It.IsAny<CancellationToken>()))
.Returns(Task.FromResult(new Uri("http://someauth/uri")))
.Verifiable(); .Verifiable();


var client = new MockOAuthClient(webWorker.Object); var client = new MockOAuthClient(webWorker.Object);
var returnUri = new Uri("http://live.com/my/path.cshtml?q=one");
var context = new Mock<HttpContextBase>(); var context = new Mock<HttpContextBase>();


// Act // Act
Expand Down Expand Up @@ -94,7 +96,9 @@ public async Task VerifyAuthenticationSucceeds() {
var request = new AuthorizedTokenRequest(endpoint, new Version("1.0")); var request = new AuthorizedTokenRequest(endpoint, new Version("1.0"));


var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict); var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict);
webWorker.Setup(w => w.ProcessUserAuthorizationAsync(It.IsAny<HttpContextBase>(), CancellationToken.None)).Returns(Task.FromResult<AccessTokenResponse>(null)).Verifiable(); webWorker
.Setup(w => w.ProcessUserAuthorizationAsync(It.IsAny<HttpContextBase>(), CancellationToken.None))
.Returns(Task.FromResult(new AccessTokenResponse("ok", "secret", new NameValueCollection()))).Verifiable();


var client = new MockOAuthClient(webWorker.Object); var client = new MockOAuthClient(webWorker.Object);
var context = new Mock<HttpContextBase>(); var context = new Mock<HttpContextBase>();
Expand Down

0 comments on commit df6e154

Please sign in to comment.