Merge branch 'features/#74785' into features/migration-dotnet3
This commit is contained in:
commit
2e0dadf846
@ -15,6 +15,7 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||
using Microsoft.eShopOnContainers.Services.Basket.API.Controllers;
|
||||
using Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Repositories;
|
||||
using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.EventHandling;
|
||||
using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Events;
|
||||
@ -44,16 +45,18 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
||||
public virtual IServiceProvider ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
RegisterAppInsights(services);
|
||||
|
||||
services.AddControllers(options =>
|
||||
{
|
||||
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
|
||||
options.Filters.Add(typeof(ValidateModelStateFilter));
|
||||
{
|
||||
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
|
||||
options.Filters.Add(typeof(ValidateModelStateFilter));
|
||||
|
||||
}).AddNewtonsoftJson();
|
||||
}) // Added for functional tests
|
||||
.AddApplicationPart(typeof(BasketController).Assembly)
|
||||
.AddNewtonsoftJson();
|
||||
|
||||
services.AddSwaggerGen(options =>
|
||||
{
|
||||
|
@ -1,6 +1,9 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.eShopOnContainers.Services.Basket.API;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Basket.FunctionalTests.Base
|
||||
{
|
||||
@ -10,6 +13,14 @@ namespace Basket.FunctionalTests.Base
|
||||
{
|
||||
}
|
||||
|
||||
public override IServiceProvider ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// Added to avoid the Authorize data annotation in test environment.
|
||||
// Property "SuppressCheckForUnhandledSecurityMetadata" in appsettings.json
|
||||
services.Configure<RouteOptions>(Configuration);
|
||||
return base.ConfigureServices(services);
|
||||
}
|
||||
|
||||
protected override void ConfigureAuth(IApplicationBuilder app)
|
||||
{
|
||||
if (Configuration["isTest"] == bool.TrueString.ToLowerInvariant())
|
||||
|
@ -16,8 +16,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(Microsoft_AspNetCore_Mvc_Testing)" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(Microsoft_NET_Test_Sdk)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(Microsoft_AspNetCore_TestHost)" />
|
||||
<PackageReference Include="xunit" Version="$(xunit)" />
|
||||
|
@ -11,5 +11,6 @@
|
||||
"ConnectionString": "127.0.0.1",
|
||||
"isTest": "true",
|
||||
"EventBusConnection": "localhost",
|
||||
"SubscriptionClientName": "Basket"
|
||||
"SubscriptionClientName": "Basket",
|
||||
"SuppressCheckForUnhandledSecurityMetadata":true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user