* Initial Web2 project working * Initial WebRazorPages project working * Adding additional sln files * Removing old project * Fixed integration tests * Getting FunctionalTests working. * Got Swagger working in Web * Moved web2 to web
33 lines
993 B
C#
33 lines
993 B
C#
using Microsoft.AspNetCore.Mvc.Testing;
|
|
using Microsoft.eShopWeb.Web;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
using Xunit;
|
|
|
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
|
{
|
|
public class OrderIndexOnGet : IClassFixture<CustomWebApplicationFactory<Startup>>
|
|
{
|
|
public OrderIndexOnGet(CustomWebApplicationFactory<Startup> factory)
|
|
{
|
|
Client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
|
{
|
|
AllowAutoRedirect = false
|
|
});
|
|
}
|
|
|
|
public HttpClient Client { get; }
|
|
|
|
[Fact]
|
|
public async Task ReturnsRedirectGivenAnonymousUser()
|
|
{
|
|
var response = await Client.GetAsync("/Order/Index");
|
|
var redirectLocation = response.Headers.Location.OriginalString;
|
|
|
|
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
|
|
Assert.Contains("Account/Login", redirectLocation);
|
|
}
|
|
}
|
|
}
|