* Converting to net6 startup and integration test formats * Update to minimal api and using pagetitle * Adjust functional test fixtures Update ApiEndpoints package version * Finish migration to minimal api startup
32 lines
875 B
C#
32 lines
875 B
C#
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc.Testing;
|
|
using Xunit;
|
|
|
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers;
|
|
|
|
[Collection("Sequential")]
|
|
public class OrderIndexOnGet : IClassFixture<TestApplication>
|
|
{
|
|
public OrderIndexOnGet(TestApplication factory)
|
|
{
|
|
Client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
|
{
|
|
AllowAutoRedirect = false
|
|
});
|
|
}
|
|
|
|
public HttpClient Client { get; }
|
|
|
|
[Fact]
|
|
public async Task ReturnsRedirectGivenAnonymousUser()
|
|
{
|
|
var response = await Client.GetAsync("/order/my-orders");
|
|
var redirectLocation = response.Headers.Location.OriginalString;
|
|
|
|
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
|
|
Assert.Contains("/Account/Login", redirectLocation);
|
|
}
|
|
}
|