This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
- Loading branch information
1 parent
bf37d18
commit 7ed3b76
Showing
3 changed files
with
62 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,3 +121,5 @@ | |
} | ||
|
||
app.Run(); | ||
|
||
public partial class Program { } |
This file contains 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
29 changes: 29 additions & 0 deletions
29
tests/Hippo.FunctionalTests/Web/Controllers/AppControllerTests.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Collections.Generic; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using Hippo.FunctionalTests; | ||
using Hippo.Web.Controllers; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Testing; | ||
using Xunit; | ||
|
||
public class AppControllerTests : TestBase | ||
{ | ||
[Fact] | ||
public async Task IndexRequiresSignIn() | ||
{ | ||
var client = _factory.CreateClient( | ||
new WebApplicationFactoryClientOptions | ||
{ | ||
AllowAutoRedirect = false | ||
}); | ||
|
||
var response = await client.GetAsync("/app"); | ||
|
||
|
||
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); | ||
Assert.StartsWith("http://localhost/Account/Login", | ||
response.Headers.Location?.OriginalString); | ||
} | ||
} |