Fix some authentication unit tests failing on Linux and OS X.

This commit is contained in:
Cesar Blum Silveira 2015-11-06 04:27:33 -08:00
parent a5a8614595
commit 216d3a0656
2 changed files with 6 additions and 6 deletions

View File

@ -245,7 +245,7 @@ namespace Microsoft.AspNet.Authentication.Google
options.ClientSecret = "Test Secret"; options.ClientSecret = "Test Secret";
}); });
var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-google?code=TestCode")); var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-google?code=TestCode"));
Assert.Equal("The oauth state was missing or invalid.", error.Message); Assert.Equal("The oauth state was missing or invalid.", error.GetBaseException().Message);
} }
[Theory] [Theory]
@ -279,7 +279,7 @@ namespace Microsoft.AspNet.Authentication.Google
else else
{ {
var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-google?error=OMG")); var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-google?error=OMG"));
Assert.Equal("OMG", error.Message); Assert.Equal("OMG", error.GetBaseException().Message);
} }
} }
@ -417,7 +417,7 @@ namespace Microsoft.AspNet.Authentication.Google
else else
{ {
var error = await Assert.ThrowsAnyAsync<Exception>(() => sendTask); var error = await Assert.ThrowsAnyAsync<Exception>(() => sendTask);
Assert.Equal("OAuth token endpoint failure: Status: BadRequest;Headers: ;Body: {\"Error\":\"Error\"};", error.Message); Assert.Equal("OAuth token endpoint failure: Status: BadRequest;Headers: ;Body: {\"Error\":\"Error\"};", error.GetBaseException().Message);
} }
} }
@ -471,7 +471,7 @@ namespace Microsoft.AspNet.Authentication.Google
else else
{ {
var error = await Assert.ThrowsAnyAsync<Exception>(() => sendTask); var error = await Assert.ThrowsAnyAsync<Exception>(() => sendTask);
Assert.Equal("Failed to retrieve access token.", error.Message); Assert.Equal("Failed to retrieve access token.", error.GetBaseException().Message);
} }
} }
@ -723,7 +723,7 @@ namespace Microsoft.AspNet.Authentication.Google
//Post a message to the Google middleware //Post a message to the Google middleware
var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-google?code=TestCode")); var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-google?code=TestCode"));
Assert.Equal("The oauth state was missing or invalid.", error.Message); Assert.Equal("The oauth state was missing or invalid.", error.GetBaseException().Message);
} }
[Fact] [Fact]

View File

@ -74,7 +74,7 @@ namespace Microsoft.AspNet.Authentication.Twitter
// Send a bogus sign in // Send a bogus sign in
var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-twitter")); var error = await Assert.ThrowsAnyAsync<Exception>(() => server.SendAsync("https://example.com/signin-twitter"));
Assert.Equal("Invalid state cookie.", error.Message); Assert.Equal("Invalid state cookie.", error.GetBaseException().Message);
} }
[Fact] [Fact]