Created
August 3, 2013 16:39
-
-
Save pmhsfelix/6147071 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public async Task Fact() | |
{ | |
await OwinTester.Run( | |
useConfiguration: app => | |
{ | |
app.UseBasicAuthentication(Options); | |
}, | |
useRequest: () => | |
{ | |
var req = new HttpRequestMessage(HttpMethod.Get, "http://example.net"); | |
req.Headers.Authorization = new AuthenticationHeaderValue("basic", | |
Convert.ToBase64String( | |
Encoding.ASCII.GetBytes("Alice:Alice"))); | |
return req; | |
}, | |
assertRequest: ctx => | |
{ | |
Assert.Equal("Alice", ctx.Request.User.Identity.Name); | |
}, | |
assertResponse: response => | |
{ | |
Assert.Equal(HttpStatusCode.OK, response.StatusCode); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment