Minor 3.x Updates (#339)
* remove unnecessary call * Refactoring test fixture
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.eShopWeb.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -12,9 +11,9 @@ using Xunit;
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||
{
|
||||
[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
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.eShopWeb.Web;
|
||||
using Microsoft.eShopWeb.Web.ViewModels;
|
||||
using Microsoft.eShopWeb.Web.ViewModels;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
@@ -9,9 +8,9 @@ using Xunit;
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||
{
|
||||
[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();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using Microsoft.eShopWeb.Web;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||
{
|
||||
[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();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.eShopWeb.Web;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
@@ -8,9 +7,9 @@ using Xunit;
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||
{
|
||||
[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
|
||||
{
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.eShopWeb.FunctionalTests.Web.Controllers;
|
||||
using Microsoft.eShopWeb.Web;
|
||||
using Microsoft.eShopWeb.FunctionalTests.Web;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,9 +10,9 @@ using Xunit;
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
||||
{
|
||||
[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
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.eShopWeb.FunctionalTests.Web.Controllers;
|
||||
using Microsoft.eShopWeb.Web;
|
||||
using Microsoft.eShopWeb.FunctionalTests.Web;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
@@ -7,9 +6,9 @@ using Xunit;
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.WebRazorPages
|
||||
{
|
||||
[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();
|
||||
}
|
||||
|
||||
@@ -9,10 +9,9 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.Web
|
||||
{
|
||||
public class CustomWebApplicationFactory<TStartup>
|
||||
: WebApplicationFactory<Startup>
|
||||
public class WebTestFixture : WebApplicationFactory<Startup>
|
||||
{
|
||||
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
||||
{
|
||||
@@ -53,7 +52,7 @@ namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||
var loggerFactory = scopedServices.GetRequiredService<ILoggerFactory>();
|
||||
|
||||
var logger = scopedServices
|
||||
.GetRequiredService<ILogger<CustomWebApplicationFactory<TStartup>>>();
|
||||
.GetRequiredService<ILogger<WebTestFixture>>();
|
||||
|
||||
// Ensure the database is created.
|
||||
db.Database.EnsureCreated();
|
||||
Reference in New Issue
Block a user