Skip to content

Instantly share code, notes, and snippets.

@pmhsfelix
Created August 3, 2013 16:39
Show Gist options
  • Save pmhsfelix/6147071 to your computer and use it in GitHub Desktop.
Save pmhsfelix/6147071 to your computer and use it in GitHub Desktop.
[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