From c6e061fd80210049acb795b7d55e6ae45cfa695f Mon Sep 17 00:00:00 2001 From: Evangelos Aktoudianakis Date: Fri, 12 Mar 2021 12:08:17 +0000 Subject: [PATCH 1/6] Added middleware + unit tests --- BaseApi.Tests/Properties/launchSettings.json | 27 ++++++++++ .../CorrelationMiddlewareTest.cs | 51 +++++++++++++++++++ .../V1/Infrastructure/ExampleContextTests.cs | 1 - .../Infrastructure/CorrelationMiddleware.cs | 29 +++++++++++ .../Properties/launchSettings.json | 27 ++++++++++ 5 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 BaseApi.Tests/Properties/launchSettings.json create mode 100644 BaseApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs create mode 100644 BaseApi/V1/Infrastructure/CorrelationMiddleware.cs create mode 100644 SearchApi.Tests/Properties/launchSettings.json diff --git a/BaseApi.Tests/Properties/launchSettings.json b/BaseApi.Tests/Properties/launchSettings.json new file mode 100644 index 00000000..16e052cd --- /dev/null +++ b/BaseApi.Tests/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52488/", + "sslPort": 44338 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "BaseApi.Tests": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + } + } +} \ No newline at end of file diff --git a/BaseApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs b/BaseApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs new file mode 100644 index 00000000..5455dc84 --- /dev/null +++ b/BaseApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs @@ -0,0 +1,51 @@ +using System.Threading.Tasks; +using BaseApi.V1.Infrastructure; +using FluentAssertions; +using Microsoft.AspNetCore.Http; +using NUnit.Framework; + +namespace BaseApi.Tests.V1.Infrastructure +{ + [TestFixture] + public class CorrelationMiddlewareTest + { + private string _correlationid = "x-correlationId"; + private CorrelationMiddleware _sut; + + [SetUp] + public void Init() + { + _sut = new CorrelationMiddleware(null); + } + + [Test] + public async Task DoesNotReplaceCorrelationIdIfOneExists() + { + // Arrange + var httpContext = new DefaultHttpContext(); + var headerValue = "123"; + + httpContext.HttpContext.Request.Headers.Add(_correlationid, headerValue); + + // Act + await _sut.InvokeAsync(httpContext).ConfigureAwait(false); + + // Assert + httpContext.HttpContext.Request.Headers[_correlationid].Should().BeEquivalentTo(headerValue); + } + + [Test] + public async Task AddsCorrelationIdIfOneDoesNotExist() + { + // Arrange + var httpContext = new DefaultHttpContext(); + + + // Act + await _sut.InvokeAsync(httpContext).ConfigureAwait(false); + + // Assert + httpContext.HttpContext.Request.Headers[_correlationid].Should().HaveCountGreaterThan(0); + } + } +} diff --git a/BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs b/BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs index 2b9fe4b0..9b3f797b 100644 --- a/BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs +++ b/BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs @@ -1,6 +1,5 @@ using System.Linq; using BaseApi.Tests.V1.Helper; -using BaseApi.V1.Infrastructure; using NUnit.Framework; namespace BaseApi.Tests.V1.Infrastructure diff --git a/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs b/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs new file mode 100644 index 00000000..294510ce --- /dev/null +++ b/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs @@ -0,0 +1,29 @@ +using System; +using System.Globalization; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; + +namespace BaseApi.V1.Infrastructure +{ + public class CorrelationMiddleware + { + private readonly RequestDelegate _next; + private string _correlationid = "x-correlationId"; + + public CorrelationMiddleware(RequestDelegate next) + { + _next = next; + } + + public async Task InvokeAsync(HttpContext context) + { + if (context.Request.Headers[_correlationid].Count == 0) + { + context.Request.Headers[_correlationid] = Guid.NewGuid().ToString(); + } + + if(_next != null) + await _next(context).ConfigureAwait(false); + } + } +} diff --git a/SearchApi.Tests/Properties/launchSettings.json b/SearchApi.Tests/Properties/launchSettings.json new file mode 100644 index 00000000..d521fe12 --- /dev/null +++ b/SearchApi.Tests/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:51761/", + "sslPort": 44398 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "LBH_search_api.Tests": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + } + } +} \ No newline at end of file From 0b518edbb295e0db2a0eec9e78ef0fd8d15cea7e Mon Sep 17 00:00:00 2001 From: Evangelos Aktoudianakis Date: Fri, 12 Mar 2021 12:30:11 +0000 Subject: [PATCH 2/6] Added middleware to startup, ignored unecessary DB tests --- BaseApi.Tests/V1/Gateways/ExampleGatewayTests.cs | 1 + BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs | 1 + BaseApi/Startup.cs | 2 ++ BaseApi/V1/Infrastructure/CorrelationMiddleware.cs | 10 ++++++++++ 4 files changed, 14 insertions(+) diff --git a/BaseApi.Tests/V1/Gateways/ExampleGatewayTests.cs b/BaseApi.Tests/V1/Gateways/ExampleGatewayTests.cs index 9dc7a5f0..f70b64e1 100644 --- a/BaseApi.Tests/V1/Gateways/ExampleGatewayTests.cs +++ b/BaseApi.Tests/V1/Gateways/ExampleGatewayTests.cs @@ -10,6 +10,7 @@ namespace BaseApi.Tests.V1.Gateways //TODO: Rename Tests to match gateway name //For instruction on how to run tests please see the wiki: https://github.com/LBHackney-IT/lbh-base-api/wiki/Running-the-test-suite. [TestFixture] + [Ignore("Not needed until we decide on DB")] public class ExampleGatewayTests : DatabaseTests { private readonly Fixture _fixture = new Fixture(); diff --git a/BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs b/BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs index 9b3f797b..0c324514 100644 --- a/BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs +++ b/BaseApi.Tests/V1/Infrastructure/ExampleContextTests.cs @@ -5,6 +5,7 @@ namespace BaseApi.Tests.V1.Infrastructure { [TestFixture] + [Ignore("Not needed until we decide on DB")] public class DatabaseContextTest : DatabaseTests { [Test] diff --git a/BaseApi/Startup.cs b/BaseApi/Startup.cs index fc4df602..15626305 100644 --- a/BaseApi/Startup.cs +++ b/BaseApi/Startup.cs @@ -132,6 +132,8 @@ private static void RegisterUseCases(IServiceCollection services) // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public static void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + app.UseCorrelation(); + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs b/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs index 294510ce..d6b6269b 100644 --- a/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs +++ b/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs @@ -1,6 +1,7 @@ using System; using System.Globalization; using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; namespace BaseApi.V1.Infrastructure @@ -26,4 +27,13 @@ public async Task InvokeAsync(HttpContext context) await _next(context).ConfigureAwait(false); } } + + public static class CorrelationMiddlewareExtensions + { + public static IApplicationBuilder UseCorrelation( + this IApplicationBuilder builder) + { + return builder.UseMiddleware(); + } + } } From 615b2184afe6196585e87e9a2b8a3ae4d5bd906d Mon Sep 17 00:00:00 2001 From: Evangelos Aktoudianakis Date: Fri, 12 Mar 2021 14:14:06 +0000 Subject: [PATCH 3/6] Added basecontroller action to retrieve correlationId + unit tests --- BaseApi.Tests/MockWebApplicationFactory.cs | 1 - .../V1/Controllers/BaseControllerTests.cs | 52 +++++++++++++++++++ BaseApi/Program.cs | 1 - BaseApi/V1/Controllers/BaseController.cs | 11 ++++ .../Infrastructure/CorrelationMiddleware.cs | 3 +- 5 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 BaseApi.Tests/V1/Controllers/BaseControllerTests.cs diff --git a/BaseApi.Tests/MockWebApplicationFactory.cs b/BaseApi.Tests/MockWebApplicationFactory.cs index eb61965e..a7bdf605 100644 --- a/BaseApi.Tests/MockWebApplicationFactory.cs +++ b/BaseApi.Tests/MockWebApplicationFactory.cs @@ -1,5 +1,4 @@ using System.Data.Common; -using BaseApi; using BaseApi.V1.Infrastructure; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; diff --git a/BaseApi.Tests/V1/Controllers/BaseControllerTests.cs b/BaseApi.Tests/V1/Controllers/BaseControllerTests.cs new file mode 100644 index 00000000..5f0e9d41 --- /dev/null +++ b/BaseApi.Tests/V1/Controllers/BaseControllerTests.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using BaseApi.V1.Controllers; +using FluentAssertions; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Routing; +using NUnit.Framework; + +namespace BaseApi.Tests.V1.Controllers +{ + [TestFixture] + public class BaseControllerTests + { + private BaseController _sut; + private ControllerContext _controllerContext; + private HttpContext _stubHttpContext; + private string _correlationid = "x-correlationId"; + + [SetUp] + public void Init() + { + _stubHttpContext = new DefaultHttpContext(); + _controllerContext = new ControllerContext(new ActionContext(_stubHttpContext, new RouteData(), new ControllerActionDescriptor())); + _sut = new BaseController(); + + _sut.ControllerContext = _controllerContext; + } + + [Test] + public void GetCorrelationShouldThrowExceptionIfCorrelationHeaderUnavailable() + { + // Arrange + Act + Assert + _sut.Invoking(x => x.GetCorrelationId()) + .Should().Throw() + .WithMessage("Request is missing a correlationId"); + } + + [Test] + public void GetCorrelationShouldReturnCorrelationIdWhenExists() + { + // Arrange + _stubHttpContext.Request.Headers.Add(_correlationid, "123"); + + // Act + var result = _sut.GetCorrelationId(); + + // Assert + result.Should().BeEquivalentTo("123"); + } + } +} diff --git a/BaseApi/Program.cs b/BaseApi/Program.cs index b9886745..d0252bd5 100644 --- a/BaseApi/Program.cs +++ b/BaseApi/Program.cs @@ -1,4 +1,3 @@ -using System; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; diff --git a/BaseApi/V1/Controllers/BaseController.cs b/BaseApi/V1/Controllers/BaseController.cs index 4749fc5b..8883bf49 100644 --- a/BaseApi/V1/Controllers/BaseController.cs +++ b/BaseApi/V1/Controllers/BaseController.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; @@ -6,11 +7,21 @@ namespace BaseApi.V1.Controllers { public class BaseController : Controller { + private string _correlationid = "x-correlationId"; + public BaseController() { ConfigureJsonSerializer(); } + public string GetCorrelationId() + { + if (HttpContext.Request.Headers[_correlationid].Count == 0) + throw new KeyNotFoundException("Request is missing a correlationId"); + + return HttpContext.Request.Headers[_correlationid]; + } + public static void ConfigureJsonSerializer() { JsonConvert.DefaultSettings = () => diff --git a/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs b/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs index d6b6269b..11fccb98 100644 --- a/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs +++ b/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs @@ -1,5 +1,4 @@ using System; -using System.Globalization; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; @@ -23,7 +22,7 @@ public async Task InvokeAsync(HttpContext context) context.Request.Headers[_correlationid] = Guid.NewGuid().ToString(); } - if(_next != null) + if (_next != null) await _next(context).ConfigureAwait(false); } } From 7a3bc8ddd188725ace040f58523a6a66ad15368b Mon Sep 17 00:00:00 2001 From: Evangelos Aktoudianakis Date: Fri, 12 Mar 2021 14:17:31 +0000 Subject: [PATCH 4/6] Removed dry run for circle-ci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7675c853..56cb306a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,7 +96,7 @@ jobs: command: dotnet tool install dotnet-format --tool-path ./dotnet-format-local/ - run: name: Run formatter check - command: ./dotnet-format-local/dotnet-format --dry-run --check + command: ./dotnet-format-local/dotnet-format --check build-and-test: executor: docker-python steps: From 8630f16f2a123e5add6ac689c53b06a1c99331e8 Mon Sep 17 00:00:00 2001 From: Evangelos Aktoudianakis Date: Mon, 15 Mar 2021 09:17:07 +0000 Subject: [PATCH 5/6] Added constant file for correlationId --- BaseApi.Tests/V1/Controllers/BaseControllerTests.cs | 4 ++-- .../V1/Infrastructure/CorrelationMiddlewareTest.cs | 8 +++----- BaseApi/V1/Controllers/BaseController.cs | 7 +++---- BaseApi/V1/Infrastructure/Constants.cs | 12 ++++++++++++ BaseApi/V1/Infrastructure/CorrelationMiddleware.cs | 5 ++--- 5 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 BaseApi/V1/Infrastructure/Constants.cs diff --git a/BaseApi.Tests/V1/Controllers/BaseControllerTests.cs b/BaseApi.Tests/V1/Controllers/BaseControllerTests.cs index 5f0e9d41..1e46ca8a 100644 --- a/BaseApi.Tests/V1/Controllers/BaseControllerTests.cs +++ b/BaseApi.Tests/V1/Controllers/BaseControllerTests.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using BaseApi.V1.Controllers; +using BaseApi.V1.Infrastructure; using FluentAssertions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -15,7 +16,6 @@ public class BaseControllerTests private BaseController _sut; private ControllerContext _controllerContext; private HttpContext _stubHttpContext; - private string _correlationid = "x-correlationId"; [SetUp] public void Init() @@ -40,7 +40,7 @@ public void GetCorrelationShouldThrowExceptionIfCorrelationHeaderUnavailable() public void GetCorrelationShouldReturnCorrelationIdWhenExists() { // Arrange - _stubHttpContext.Request.Headers.Add(_correlationid, "123"); + _stubHttpContext.Request.Headers.Add(Constants.CorrelationId, "123"); // Act var result = _sut.GetCorrelationId(); diff --git a/BaseApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs b/BaseApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs index 5455dc84..6de5ecd7 100644 --- a/BaseApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs +++ b/BaseApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs @@ -9,7 +9,6 @@ namespace BaseApi.Tests.V1.Infrastructure [TestFixture] public class CorrelationMiddlewareTest { - private string _correlationid = "x-correlationId"; private CorrelationMiddleware _sut; [SetUp] @@ -25,13 +24,13 @@ public async Task DoesNotReplaceCorrelationIdIfOneExists() var httpContext = new DefaultHttpContext(); var headerValue = "123"; - httpContext.HttpContext.Request.Headers.Add(_correlationid, headerValue); + httpContext.HttpContext.Request.Headers.Add(Constants.CorrelationId, headerValue); // Act await _sut.InvokeAsync(httpContext).ConfigureAwait(false); // Assert - httpContext.HttpContext.Request.Headers[_correlationid].Should().BeEquivalentTo(headerValue); + httpContext.HttpContext.Request.Headers[Constants.CorrelationId].Should().BeEquivalentTo(headerValue); } [Test] @@ -40,12 +39,11 @@ public async Task AddsCorrelationIdIfOneDoesNotExist() // Arrange var httpContext = new DefaultHttpContext(); - // Act await _sut.InvokeAsync(httpContext).ConfigureAwait(false); // Assert - httpContext.HttpContext.Request.Headers[_correlationid].Should().HaveCountGreaterThan(0); + httpContext.HttpContext.Request.Headers[Constants.CorrelationId].Should().HaveCountGreaterThan(0); } } } diff --git a/BaseApi/V1/Controllers/BaseController.cs b/BaseApi/V1/Controllers/BaseController.cs index 8883bf49..48b21122 100644 --- a/BaseApi/V1/Controllers/BaseController.cs +++ b/BaseApi/V1/Controllers/BaseController.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using BaseApi.V1.Infrastructure; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; @@ -7,8 +8,6 @@ namespace BaseApi.V1.Controllers { public class BaseController : Controller { - private string _correlationid = "x-correlationId"; - public BaseController() { ConfigureJsonSerializer(); @@ -16,10 +15,10 @@ public BaseController() public string GetCorrelationId() { - if (HttpContext.Request.Headers[_correlationid].Count == 0) + if (HttpContext.Request.Headers[Constants.CorrelationId].Count == 0) throw new KeyNotFoundException("Request is missing a correlationId"); - return HttpContext.Request.Headers[_correlationid]; + return HttpContext.Request.Headers[Constants.CorrelationId]; } public static void ConfigureJsonSerializer() diff --git a/BaseApi/V1/Infrastructure/Constants.cs b/BaseApi/V1/Infrastructure/Constants.cs new file mode 100644 index 00000000..a1143d33 --- /dev/null +++ b/BaseApi/V1/Infrastructure/Constants.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BaseApi.V1.Infrastructure +{ + public static class Constants + { + public const string CorrelationId = "x-correlation-id"; + } +} diff --git a/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs b/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs index 11fccb98..378b6dbe 100644 --- a/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs +++ b/BaseApi/V1/Infrastructure/CorrelationMiddleware.cs @@ -8,7 +8,6 @@ namespace BaseApi.V1.Infrastructure public class CorrelationMiddleware { private readonly RequestDelegate _next; - private string _correlationid = "x-correlationId"; public CorrelationMiddleware(RequestDelegate next) { @@ -17,9 +16,9 @@ public CorrelationMiddleware(RequestDelegate next) public async Task InvokeAsync(HttpContext context) { - if (context.Request.Headers[_correlationid].Count == 0) + if (context.Request.Headers[Constants.CorrelationId].Count == 0) { - context.Request.Headers[_correlationid] = Guid.NewGuid().ToString(); + context.Request.Headers[Constants.CorrelationId] = Guid.NewGuid().ToString(); } if (_next != null) From 052538c811a360bd012ec7093f7ca95909b7ba63 Mon Sep 17 00:00:00 2001 From: Evangelos Aktoudianakis Date: Mon, 15 Mar 2021 15:56:25 +0000 Subject: [PATCH 6/6] Fixed merge issues --- BaseApi.Tests/Properties/launchSettings.json | 27 ------------------- .../V1/Controllers/BaseControllerTests.cs | 6 ++--- .../CorrelationMiddlewareTest.cs | 4 +-- SearchApi/V1/Controllers/BaseController.cs | 2 +- SearchApi/V1/Infrastructure/Constants.cs | 7 +---- .../Infrastructure/CorrelationMiddleware.cs | 2 +- 6 files changed, 8 insertions(+), 40 deletions(-) delete mode 100644 BaseApi.Tests/Properties/launchSettings.json diff --git a/BaseApi.Tests/Properties/launchSettings.json b/BaseApi.Tests/Properties/launchSettings.json deleted file mode 100644 index 16e052cd..00000000 --- a/BaseApi.Tests/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:52488/", - "sslPort": 44338 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "BaseApi.Tests": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "https://localhost:5001;http://localhost:5000" - } - } -} \ No newline at end of file diff --git a/SearchApi.Tests/V1/Controllers/BaseControllerTests.cs b/SearchApi.Tests/V1/Controllers/BaseControllerTests.cs index 1e46ca8a..0333ca47 100644 --- a/SearchApi.Tests/V1/Controllers/BaseControllerTests.cs +++ b/SearchApi.Tests/V1/Controllers/BaseControllerTests.cs @@ -1,14 +1,14 @@ using System.Collections.Generic; -using BaseApi.V1.Controllers; -using BaseApi.V1.Infrastructure; using FluentAssertions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Routing; using NUnit.Framework; +using SearchApi.V1.Controllers; +using SearchApi.V1.Infrastructure; -namespace BaseApi.Tests.V1.Controllers +namespace SearchApi.Tests.V1.Controllers { [TestFixture] public class BaseControllerTests diff --git a/SearchApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs b/SearchApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs index 6de5ecd7..1dc4a5da 100644 --- a/SearchApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs +++ b/SearchApi.Tests/V1/Infrastructure/CorrelationMiddlewareTest.cs @@ -1,10 +1,10 @@ using System.Threading.Tasks; -using BaseApi.V1.Infrastructure; using FluentAssertions; using Microsoft.AspNetCore.Http; using NUnit.Framework; +using SearchApi.V1.Infrastructure; -namespace BaseApi.Tests.V1.Infrastructure +namespace SearchApi.Tests.V1.Infrastructure { [TestFixture] public class CorrelationMiddlewareTest diff --git a/SearchApi/V1/Controllers/BaseController.cs b/SearchApi/V1/Controllers/BaseController.cs index 4b750863..5e0fd00c 100644 --- a/SearchApi/V1/Controllers/BaseController.cs +++ b/SearchApi/V1/Controllers/BaseController.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -using BaseApi.V1.Infrastructure; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; +using SearchApi.V1.Infrastructure; namespace SearchApi.V1.Controllers { diff --git a/SearchApi/V1/Infrastructure/Constants.cs b/SearchApi/V1/Infrastructure/Constants.cs index a1143d33..cdc0e4f1 100644 --- a/SearchApi/V1/Infrastructure/Constants.cs +++ b/SearchApi/V1/Infrastructure/Constants.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace BaseApi.V1.Infrastructure +namespace SearchApi.V1.Infrastructure { public static class Constants { diff --git a/SearchApi/V1/Infrastructure/CorrelationMiddleware.cs b/SearchApi/V1/Infrastructure/CorrelationMiddleware.cs index 378b6dbe..33fe71f8 100644 --- a/SearchApi/V1/Infrastructure/CorrelationMiddleware.cs +++ b/SearchApi/V1/Infrastructure/CorrelationMiddleware.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; -namespace BaseApi.V1.Infrastructure +namespace SearchApi.V1.Infrastructure { public class CorrelationMiddleware {