Minor 3.x Updates (#339)
* remove unnecessary call * Refactoring test fixture
This commit is contained in:
@@ -21,6 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTests", "tests\Fu
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0BD72BEA-EF42-4B72-8B69-12A39EC76FBA}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0BD72BEA-EF42-4B72-8B69-12A39EC76FBA}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
docker-compose.override.yml = docker-compose.override.yml
|
||||||
docker-compose.yml = docker-compose.yml
|
docker-compose.yml = docker-compose.yml
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ namespace Microsoft.eShopWeb.Web
|
|||||||
options.Conventions.AuthorizePage("/Basket/Checkout");
|
options.Conventions.AuthorizePage("/Basket/Checkout");
|
||||||
});
|
});
|
||||||
services.AddControllersWithViews();
|
services.AddControllersWithViews();
|
||||||
services.AddControllers();
|
|
||||||
|
|
||||||
services.AddHttpContextAccessor();
|
services.AddHttpContextAccessor();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.eShopWeb.Web;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -12,9 +11,9 @@ using Xunit;
|
|||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||||
{
|
{
|
||||||
[Collection("Sequential")]
|
[Collection("Sequential")]
|
||||||
public class AccountControllerSignIn : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class AccountControllerSignIn : IClassFixture<WebTestFixture>
|
||||||
{
|
{
|
||||||
public AccountControllerSignIn(CustomWebApplicationFactory<Startup> factory)
|
public AccountControllerSignIn(WebTestFixture factory)
|
||||||
{
|
{
|
||||||
Client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
Client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Microsoft.eShopWeb.Web;
|
using Microsoft.eShopWeb.Web.ViewModels;
|
||||||
using Microsoft.eShopWeb.Web.ViewModels;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -9,9 +8,9 @@ using Xunit;
|
|||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||||
{
|
{
|
||||||
[Collection("Sequential")]
|
[Collection("Sequential")]
|
||||||
public class ApiCatalogControllerList : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class ApiCatalogControllerList : IClassFixture<WebTestFixture>
|
||||||
{
|
{
|
||||||
public ApiCatalogControllerList(CustomWebApplicationFactory<Startup> factory)
|
public ApiCatalogControllerList(WebTestFixture factory)
|
||||||
{
|
{
|
||||||
Client = factory.CreateClient();
|
Client = factory.CreateClient();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
using Microsoft.eShopWeb.Web;
|
using System.Net.Http;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||||
{
|
{
|
||||||
[Collection("Sequential")]
|
[Collection("Sequential")]
|
||||||
public class CatalogControllerIndex : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class CatalogControllerIndex : IClassFixture<WebTestFixture>
|
||||||
{
|
{
|
||||||
public CatalogControllerIndex(CustomWebApplicationFactory<Startup> factory)
|
public CatalogControllerIndex(WebTestFixture factory)
|
||||||
{
|
{
|
||||||
Client = factory.CreateClient();
|
Client = factory.CreateClient();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.eShopWeb.Web;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -8,9 +7,9 @@ using Xunit;
|
|||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||||
{
|
{
|
||||||
[Collection("Sequential")]
|
[Collection("Sequential")]
|
||||||
public class OrderIndexOnGet : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class OrderIndexOnGet : IClassFixture<WebTestFixture>
|
||||||
{
|
{
|
||||||
public OrderIndexOnGet(CustomWebApplicationFactory<Startup> factory)
|
public OrderIndexOnGet(WebTestFixture factory)
|
||||||
{
|
{
|
||||||
Client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
Client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.eShopWeb.FunctionalTests.Web.Controllers;
|
using Microsoft.eShopWeb.FunctionalTests.Web;
|
||||||
using Microsoft.eShopWeb.Web;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -12,9 +10,9 @@ using Xunit;
|
|||||||
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
||||||
{
|
{
|
||||||
[Collection("Sequential")]
|
[Collection("Sequential")]
|
||||||
public class BasketPageCheckout : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class BasketPageCheckout : IClassFixture<WebTestFixture>
|
||||||
{
|
{
|
||||||
public BasketPageCheckout(CustomWebApplicationFactory<Startup> factory)
|
public BasketPageCheckout(WebTestFixture factory)
|
||||||
{
|
{
|
||||||
Client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
Client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Microsoft.eShopWeb.FunctionalTests.Web.Controllers;
|
using Microsoft.eShopWeb.FunctionalTests.Web;
|
||||||
using Microsoft.eShopWeb.Web;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@@ -7,9 +6,9 @@ using Xunit;
|
|||||||
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
||||||
{
|
{
|
||||||
[Collection("Sequential")]
|
[Collection("Sequential")]
|
||||||
public class HomePageOnGet : IClassFixture<CustomWebApplicationFactory<Startup>>
|
public class HomePageOnGet : IClassFixture<WebTestFixture>
|
||||||
{
|
{
|
||||||
public HomePageOnGet(CustomWebApplicationFactory<Startup> factory)
|
public HomePageOnGet(WebTestFixture factory)
|
||||||
{
|
{
|
||||||
Client = factory.CreateClient();
|
Client = factory.CreateClient();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
namespace Microsoft.eShopWeb.FunctionalTests.Web
|
||||||
{
|
{
|
||||||
public class CustomWebApplicationFactory<TStartup>
|
public class WebTestFixture : WebApplicationFactory<Startup>
|
||||||
: WebApplicationFactory<Startup>
|
|
||||||
{
|
{
|
||||||
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
||||||
{
|
{
|
||||||
@@ -53,7 +52,7 @@ namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
|||||||
var loggerFactory = scopedServices.GetRequiredService<ILoggerFactory>();
|
var loggerFactory = scopedServices.GetRequiredService<ILoggerFactory>();
|
||||||
|
|
||||||
var logger = scopedServices
|
var logger = scopedServices
|
||||||
.GetRequiredService<ILogger<CustomWebApplicationFactory<TStartup>>>();
|
.GetRequiredService<ILogger<WebTestFixture>>();
|
||||||
|
|
||||||
// Ensure the database is created.
|
// Ensure the database is created.
|
||||||
db.Database.EnsureCreated();
|
db.Database.EnsureCreated();
|
||||||
Reference in New Issue
Block a user