Browse Source

Adding a ConfigureTestingServices (#335)

main
Eric Fleming 6 years ago
committed by Steve Smith
parent
commit
9695e9e3ba
  1. 4
      src/Web/Startup.cs
  2. 3
      tests/FunctionalTests/Web/CustomWebApplicationFactory.cs

4
src/Web/Startup.cs

@ -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.

3
tests/FunctionalTests/Web/CustomWebApplicationFactory.cs

@ -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();

Loading…
Cancel
Save