Adding a ConfigureTestingServices (#335)

This commit is contained in:
Eric Fleming
2019-12-11 19:59:45 -07:00
committed by Steve Smith
parent f3f74a342e
commit 9695e9e3ba
2 changed files with 6 additions and 1 deletions

View File

@@ -74,6 +74,10 @@ namespace Microsoft.eShopWeb.Web
ConfigureServices(services); ConfigureServices(services);
} }
public void ConfigureTestingServices(IServiceCollection services)
{
ConfigureInMemoryDatabases(services);
}
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.

View File

@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.Infrastructure.Data; using Microsoft.eShopWeb.Infrastructure.Data;
@@ -17,6 +16,8 @@ namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
{ {
protected override void ConfigureWebHost(IWebHostBuilder builder) protected override void ConfigureWebHost(IWebHostBuilder builder)
{ {
builder.UseEnvironment("Testing");
builder.ConfigureServices(services => builder.ConfigureServices(services =>
{ {
services.AddEntityFrameworkInMemoryDatabase(); services.AddEntityFrameworkInMemoryDatabase();