Included file-scoped namespaces Basket.FunctionalTests

This commit is contained in:
Sumit Ghosh 2021-10-14 15:29:39 +05:30
parent 886c6070c6
commit 4e6700d3c6
6 changed files with 128 additions and 168 deletions

View File

@ -1,11 +1,7 @@
using Microsoft.AspNetCore.Http; namespace Basket.FunctionalTests.Base;
using System.Security.Claims;
using System.Threading.Tasks;
namespace Basket.FunctionalTests.Base class AutoAuthorizeMiddleware
{ {
class AutoAuthorizeMiddleware
{
public const string IDENTITY_ID = "9e3163b9-1ae6-4652-9dc6-7898ab7b7a00"; public const string IDENTITY_ID = "9e3163b9-1ae6-4652-9dc6-7898ab7b7a00";
private readonly RequestDelegate _next; private readonly RequestDelegate _next;
@ -27,5 +23,4 @@ namespace Basket.FunctionalTests.Base
await _next.Invoke(httpContext); await _next.Invoke(httpContext);
} }
}
} }

View File

@ -1,13 +1,7 @@
using Microsoft.AspNetCore.Hosting; namespace Basket.FunctionalTests.Base;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using System.IO;
using System.Reflection;
namespace Basket.FunctionalTests.Base public class BasketScenarioBase
{ {
public class BasketScenarioBase
{
private const string ApiUrlBase = "api/v1/basket"; private const string ApiUrlBase = "api/v1/basket";
public TestServer CreateServer() public TestServer CreateServer()
@ -39,5 +33,4 @@ namespace Basket.FunctionalTests.Base
public static string Basket = $"{ApiUrlBase}/"; public static string Basket = $"{ApiUrlBase}/";
public static string CheckoutOrder = $"{ApiUrlBase}/checkout"; public static string CheckoutOrder = $"{ApiUrlBase}/checkout";
} }
}
} }

View File

@ -1,9 +1,4 @@
using Microsoft.AspNetCore.Builder; 
using Microsoft.AspNetCore.Routing;
using Microsoft.eShopOnContainers.Services.Basket.API;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace Basket.FunctionalTests.Base namespace Basket.FunctionalTests.Base
{ {

View File

@ -1,11 +1,7 @@
using Microsoft.AspNetCore.TestHost; namespace Basket.FunctionalTests.Base;
using System;
using System.Net.Http;
namespace Basket.FunctionalTests.Base static class HttpClientExtensions
{ {
static class HttpClientExtensions
{
public static HttpClient CreateIdempotentClient(this TestServer server) public static HttpClient CreateIdempotentClient(this TestServer server)
{ {
var client = server.CreateClient(); var client = server.CreateClient();
@ -14,5 +10,4 @@ namespace Basket.FunctionalTests.Base
return client; return client;
} }
}
} }

View File

@ -1,17 +1,8 @@
using Basket.FunctionalTests.Base; namespace Basket.FunctionalTests;
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Xunit;
namespace Basket.FunctionalTests public class BasketScenarios
{
public class BasketScenarios
: BasketScenarioBase : BasketScenarioBase
{ {
[Fact] [Fact]
public async Task Post_basket_and_response_ok_status_code() public async Task Post_basket_and_response_ok_status_code()
{ {
@ -91,5 +82,4 @@ namespace Basket.FunctionalTests
return JsonSerializer.Serialize(checkoutBasket); return JsonSerializer.Serialize(checkoutBasket);
} }
}
} }

View File

@ -1,12 +1,4 @@
using Basket.FunctionalTests.Base; 
using Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Repositories;
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using StackExchange.Redis;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
namespace Basket.FunctionalTests namespace Basket.FunctionalTests
{ {