diff --git a/FileProcessor.BusinessLogic.Tests/FileProcessor.BusinessLogic.Tests.csproj b/FileProcessor.BusinessLogic.Tests/FileProcessor.BusinessLogic.Tests.csproj index 07f5731..ff23671 100644 --- a/FileProcessor.BusinessLogic.Tests/FileProcessor.BusinessLogic.Tests.csproj +++ b/FileProcessor.BusinessLogic.Tests/FileProcessor.BusinessLogic.Tests.csproj @@ -7,14 +7,14 @@ - - - + + + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj b/FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj index 1d5411b..45b8717 100644 --- a/FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj +++ b/FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj @@ -5,18 +5,18 @@ - + - + - + - - - - - + + + + + diff --git a/FileProcessor.Client/FileProcessor.Client.csproj b/FileProcessor.Client/FileProcessor.Client.csproj index 3fad114..a5bb5f4 100644 --- a/FileProcessor.Client/FileProcessor.Client.csproj +++ b/FileProcessor.Client/FileProcessor.Client.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/FileProcessor.Client/FileProcessorClient.cs b/FileProcessor.Client/FileProcessorClient.cs index 726ab88..5fae38c 100644 --- a/FileProcessor.Client/FileProcessorClient.cs +++ b/FileProcessor.Client/FileProcessorClient.cs @@ -62,24 +62,12 @@ public async Task> GetFile(String accessToken, String requestUri = this.BuildRequestUrl($"/api/files/{fileId}?estateId={estateId}"); try { - // Add the access token header - this.HttpClient.DefaultRequestHeaders.Authorization = - new AuthenticationHeaderValue("Bearer", accessToken); - - // Make the Http Call here - HttpResponseMessage httpResponse = await this.HttpClient.GetAsync(requestUri, cancellationToken); - - // Process the response - Result result = await this.HandleResponseX(httpResponse, cancellationToken); + Result result = await this.SendGetRequest (requestUri, accessToken, cancellationToken); if (result.IsFailed) return ResultHelpers.CreateFailure(result); - ResponseData responseData = - HandleResponseContent(result.Data); - - // call was successful so now deserialise the body to the response object - return Result.Success(responseData.Data); + return result; } catch (Exception ex) { // An exception has occurred, add some additional information to the message @@ -110,24 +98,12 @@ public async Task> GetFileImportLog(String accessToken, } try { - // Add the access token header - this.HttpClient.DefaultRequestHeaders.Authorization = - new AuthenticationHeaderValue("Bearer", accessToken); - - // Make the Http Call here - HttpResponseMessage httpResponse = await this.HttpClient.GetAsync(requestUri, cancellationToken); - - // Process the response - Result result = await this.HandleResponseX(httpResponse, cancellationToken); + Result result = await this.SendGetRequest(requestUri, accessToken, cancellationToken); if (result.IsFailed) return ResultHelpers.CreateFailure(result); - ResponseData responseData = - HandleResponseContent(result.Data); - - // call was successful so now deserialise the body to the response object - return Result.Success(responseData.Data); + return result; } catch (Exception ex) { // An exception has occurred, add some additional information to the message @@ -162,23 +138,12 @@ public async Task> GetFileImportLogs(String accessToke } try { - // Add the access token header - this.HttpClient.DefaultRequestHeaders.Authorization = - new AuthenticationHeaderValue("Bearer", accessToken); + Result result = await this.SendGetRequest(requestUri, accessToken, cancellationToken); - // Make the Http Call here - HttpResponseMessage httpResponse = await this.HttpClient.GetAsync(requestUri, cancellationToken); - - // Process the response - Result result = await this.HandleResponseX(httpResponse, cancellationToken); if (result.IsFailed) return ResultHelpers.CreateFailure(result); - ResponseData responseData = - HandleResponseContent(result.Data); - - // call was successful so now deserialise the body to the response object - return Result.Success(responseData.Data); + return result; } catch (Exception ex) { // An exception has occurred, add some additional information to the message @@ -229,11 +194,11 @@ public async Task> UploadFile(String accessToken, if (result.IsFailed) return ResultHelpers.CreateFailure(result); - ResponseData responseData = - HandleResponseContent(result.Data); - + Guid responseData = JsonConvert.DeserializeObject(result.Data); + // call was successful so now deserialise the body to the response object - return Result.Success(responseData.Data); + return Result.Success(responseData); + } catch (Exception ex) { // An exception has occurred, add some additional information to the message diff --git a/FileProcessor.DataTransferObjects/Responses/FileImportLogList.cs b/FileProcessor.DataTransferObjects/Responses/FileImportLogList.cs index 2929e20..42447de 100644 --- a/FileProcessor.DataTransferObjects/Responses/FileImportLogList.cs +++ b/FileProcessor.DataTransferObjects/Responses/FileImportLogList.cs @@ -1,4 +1,6 @@ -namespace FileProcessor.DataTransferObjects.Responses +using Newtonsoft.Json; + +namespace FileProcessor.DataTransferObjects.Responses { using System.Collections.Generic; @@ -12,7 +14,8 @@ public class FileImportLogList /// /// The file import logs /// - public List FileImportLogs; + [JsonProperty("file_import_logs")] + public List FileImportLogs { get; set; } #endregion } diff --git a/FileProcessor.FileAggregate.Tests/FileProcessor.FileAggregate.Tests.csproj b/FileProcessor.FileAggregate.Tests/FileProcessor.FileAggregate.Tests.csproj index 6a057b7..7d11543 100644 --- a/FileProcessor.FileAggregate.Tests/FileProcessor.FileAggregate.Tests.csproj +++ b/FileProcessor.FileAggregate.Tests/FileProcessor.FileAggregate.Tests.csproj @@ -7,10 +7,10 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/FileProcessor.FileImportLogAggregate.Tests/FileProcessor.FileImportLogAggregate.Tests.csproj b/FileProcessor.FileImportLogAggregate.Tests/FileProcessor.FileImportLogAggregate.Tests.csproj index dc70841..0bbdeee 100644 --- a/FileProcessor.FileImportLogAggregate.Tests/FileProcessor.FileImportLogAggregate.Tests.csproj +++ b/FileProcessor.FileImportLogAggregate.Tests/FileProcessor.FileImportLogAggregate.Tests.csproj @@ -7,10 +7,10 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/FileProcessor.IntegrationTesting.Helpers/FileProcessor.IntegrationTesting.Helpers.csproj b/FileProcessor.IntegrationTesting.Helpers/FileProcessor.IntegrationTesting.Helpers.csproj index cab2d29..b465619 100644 --- a/FileProcessor.IntegrationTesting.Helpers/FileProcessor.IntegrationTesting.Helpers.csproj +++ b/FileProcessor.IntegrationTesting.Helpers/FileProcessor.IntegrationTesting.Helpers.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/FileProcessor.IntegrationTests/Common/DockerHelper.cs b/FileProcessor.IntegrationTests/Common/DockerHelper.cs index 8310cf2..c3da911 100644 --- a/FileProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/FileProcessor.IntegrationTests/Common/DockerHelper.cs @@ -63,14 +63,14 @@ public override async Task CreateSubscriptions(){ } } - protected override EventStoreClientSettings ConfigureEventStoreSettings() - { - string str = $"esdb://127.0.0.1:{this.EventStoreHttpPort}?tls=false&tlsVerifyCert=false&defaultDeadline=30000"; - if (this.IsSecureEventStore) { - str = $"esdb://admin:changeit@127.0.0.1:{this.EventStoreHttpPort}?tls=true&tlsVerifyCert=false&defaultDeadline=30000"; - } - return EventStoreClientSettings.Create(str); - } + //protected override EventStoreClientSettings ConfigureEventStoreSettings() + //{ + // string str = $"esdb://127.0.0.1:{this.EventStoreHttpPort}?tls=false&tlsVerifyCert=false&defaultDeadline=30000"; + // if (this.IsSecureEventStore) { + // str = $"esdb://admin:changeit@127.0.0.1:{this.EventStoreHttpPort}?tls=true&tlsVerifyCert=false&defaultDeadline=30000"; + // } + // return EventStoreClientSettings.Create(str); + //} public override async Task StartContainersForScenarioRun(String scenarioName, DockerServices dockerServices){ diff --git a/FileProcessor.IntegrationTests/Features/GetFileImportDetails.feature.cs b/FileProcessor.IntegrationTests/Features/GetFileImportDetails.feature.cs index 9a37575..8088dcf 100644 --- a/FileProcessor.IntegrationTests/Features/GetFileImportDetails.feature.cs +++ b/FileProcessor.IntegrationTests/Features/GetFileImportDetails.feature.cs @@ -1,8 +1,8 @@ // ------------------------------------------------------------------------------ // -// This code was generated by Reqnroll (https://www.reqnroll.net/). -// Reqnroll Version:2.0.0.0 -// Reqnroll Generator Version:2.0.0.0 +// This code was generated by Reqnroll (https://reqnroll.net/). +// Reqnroll Version:3.0.0.0 +// Reqnroll Generator Version:3.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,14 +15,14 @@ namespace FileProcessor.IntegrationTests.Features { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll", "2.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll", "3.0.0.0")] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [NUnit.Framework.TestFixtureAttribute()] - [NUnit.Framework.DescriptionAttribute("GetFileImportDetails")] - [NUnit.Framework.FixtureLifeCycleAttribute(NUnit.Framework.LifeCycle.InstancePerTestCase)] - [NUnit.Framework.CategoryAttribute("base")] - [NUnit.Framework.CategoryAttribute("shared")] - [NUnit.Framework.CategoryAttribute("getfileimportdetails")] + [global::NUnit.Framework.TestFixtureAttribute()] + [global::NUnit.Framework.DescriptionAttribute("GetFileImportDetails")] + [global::NUnit.Framework.FixtureLifeCycleAttribute(global::NUnit.Framework.LifeCycle.InstancePerTestCase)] + [global::NUnit.Framework.CategoryAttribute("base")] + [global::NUnit.Framework.CategoryAttribute("shared")] + [global::NUnit.Framework.CategoryAttribute("getfileimportdetails")] public partial class GetFileImportDetailsFeature { @@ -33,22 +33,23 @@ public partial class GetFileImportDetailsFeature "shared", "getfileimportdetails"}; - private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new global::System.Globalization.CultureInfo("en-US"), "Features", "GetFileImportDetails", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new global::System.Globalization.CultureInfo("en-US"), "Features", "GetFileImportDetails", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags, InitializeCucumberMessages()); #line 1 "GetFileImportDetails.feature" #line hidden - [NUnit.Framework.OneTimeSetUpAttribute()] + [global::NUnit.Framework.OneTimeSetUpAttribute()] public static async global::System.Threading.Tasks.Task FeatureSetupAsync() { } - [NUnit.Framework.OneTimeTearDownAttribute()] + [global::NUnit.Framework.OneTimeTearDownAttribute()] public static async global::System.Threading.Tasks.Task FeatureTearDownAsync() { + await global::Reqnroll.TestRunnerManager.ReleaseFeatureAsync(featureInfo); } - [NUnit.Framework.SetUpAttribute()] + [global::NUnit.Framework.SetUpAttribute()] public async global::System.Threading.Tasks.Task TestInitializeAsync() { testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); @@ -74,7 +75,7 @@ public partial class GetFileImportDetailsFeature } } - [NUnit.Framework.TearDownAttribute()] + [global::NUnit.Framework.TearDownAttribute()] public async global::System.Threading.Tasks.Task TestTearDownAsync() { if ((testRunner == null)) @@ -92,10 +93,10 @@ public partial class GetFileImportDetailsFeature } } - public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) + public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, global::Reqnroll.RuleInfo ruleInfo) { - testRunner.OnScenarioInitialize(scenarioInfo); - testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(NUnit.Framework.TestContext.CurrentContext); + testRunner.OnScenarioInitialize(scenarioInfo, ruleInfo); + testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(global::NUnit.Framework.TestContext.CurrentContext); } public async global::System.Threading.Tasks.Task ScenarioStartAsync() @@ -413,21 +414,29 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line hidden } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Get File Import Log Details")] - [NUnit.Framework.CategoryAttribute("PRTest")] + private static global::Reqnroll.Formatters.RuntimeSupport.FeatureLevelCucumberMessages InitializeCucumberMessages() + { + return new global::Reqnroll.Formatters.RuntimeSupport.FeatureLevelCucumberMessages("Features/GetFileImportDetails.feature.ndjson", 3); + } + + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Get File Import Log Details")] + [global::NUnit.Framework.CategoryAttribute("PRTest")] public async global::System.Threading.Tasks.Task GetFileImportLogDetails() { string[] tagsOfScenario = new string[] { "PRTest"}; global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Get File Import Log Details", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "0"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Get File Import Log Details", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 85 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { diff --git a/FileProcessor.IntegrationTests/Features/ProcessTopupCSV.feature.cs b/FileProcessor.IntegrationTests/Features/ProcessTopupCSV.feature.cs index 0082c72..3833280 100644 --- a/FileProcessor.IntegrationTests/Features/ProcessTopupCSV.feature.cs +++ b/FileProcessor.IntegrationTests/Features/ProcessTopupCSV.feature.cs @@ -1,8 +1,8 @@ // ------------------------------------------------------------------------------ // -// This code was generated by Reqnroll (https://www.reqnroll.net/). -// Reqnroll Version:2.0.0.0 -// Reqnroll Generator Version:2.0.0.0 +// This code was generated by Reqnroll (https://reqnroll.net/). +// Reqnroll Version:3.0.0.0 +// Reqnroll Generator Version:3.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,13 +15,13 @@ namespace FileProcessor.IntegrationTests.Features { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll", "2.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll", "3.0.0.0")] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [NUnit.Framework.TestFixtureAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Topup CSV Files")] - [NUnit.Framework.FixtureLifeCycleAttribute(NUnit.Framework.LifeCycle.InstancePerTestCase)] - [NUnit.Framework.CategoryAttribute("base")] - [NUnit.Framework.CategoryAttribute("shared")] + [global::NUnit.Framework.TestFixtureAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Topup CSV Files")] + [global::NUnit.Framework.FixtureLifeCycleAttribute(global::NUnit.Framework.LifeCycle.InstancePerTestCase)] + [global::NUnit.Framework.CategoryAttribute("base")] + [global::NUnit.Framework.CategoryAttribute("shared")] public partial class ProcessTopupCSVFilesFeature { @@ -31,22 +31,23 @@ public partial class ProcessTopupCSVFilesFeature "base", "shared"}; - private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new global::System.Globalization.CultureInfo("en-US"), "Features", "Process Topup CSV Files", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new global::System.Globalization.CultureInfo("en-US"), "Features", "Process Topup CSV Files", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags, InitializeCucumberMessages()); #line 1 "ProcessTopupCSV.feature" #line hidden - [NUnit.Framework.OneTimeSetUpAttribute()] + [global::NUnit.Framework.OneTimeSetUpAttribute()] public static async global::System.Threading.Tasks.Task FeatureSetupAsync() { } - [NUnit.Framework.OneTimeTearDownAttribute()] + [global::NUnit.Framework.OneTimeTearDownAttribute()] public static async global::System.Threading.Tasks.Task FeatureTearDownAsync() { + await global::Reqnroll.TestRunnerManager.ReleaseFeatureAsync(featureInfo); } - [NUnit.Framework.SetUpAttribute()] + [global::NUnit.Framework.SetUpAttribute()] public async global::System.Threading.Tasks.Task TestInitializeAsync() { testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); @@ -72,7 +73,7 @@ public partial class ProcessTopupCSVFilesFeature } } - [NUnit.Framework.TearDownAttribute()] + [global::NUnit.Framework.TearDownAttribute()] public async global::System.Threading.Tasks.Task TestTearDownAsync() { if ((testRunner == null)) @@ -90,10 +91,10 @@ public partial class ProcessTopupCSVFilesFeature } } - public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) + public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, global::Reqnroll.RuleInfo ruleInfo) { - testRunner.OnScenarioInitialize(scenarioInfo); - testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(NUnit.Framework.TestContext.CurrentContext); + testRunner.OnScenarioInitialize(scenarioInfo, ruleInfo); + testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(global::NUnit.Framework.TestContext.CurrentContext); } public async global::System.Threading.Tasks.Task ScenarioStartAsync() @@ -372,19 +373,27 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line hidden } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Safaricom Topup File with 1 detail row")] + private static global::Reqnroll.Formatters.RuntimeSupport.FeatureLevelCucumberMessages InitializeCucumberMessages() + { + return new global::Reqnroll.Formatters.RuntimeSupport.FeatureLevelCucumberMessages("Features/ProcessTopupCSV.feature.ndjson", 7); + } + + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Safaricom Topup File with 1 detail row")] public async global::System.Threading.Tasks.Task ProcessSafaricomTopupFileWith1DetailRow() { string[] tagsOfScenario = ((string[])(null)); global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Safaricom Topup File with 1 detail row", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "0"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Safaricom Topup File with 1 detail row", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 77 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { @@ -428,19 +437,22 @@ await testRunner.GivenAsync("I have a token to access the estate management and await this.ScenarioCleanupAsync(); } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Safaricom Topup File with 2 detail rows")] + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Safaricom Topup File with 2 detail rows")] public async global::System.Threading.Tasks.Task ProcessSafaricomTopupFileWith2DetailRows() { string[] tagsOfScenario = ((string[])(null)); global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Safaricom Topup File with 2 detail rows", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "1"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Safaricom Topup File with 2 detail rows", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 89 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { @@ -488,19 +500,22 @@ await testRunner.GivenAsync("I have a token to access the estate management and await this.ScenarioCleanupAsync(); } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process 2 Safaricom Topup Files")] + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process 2 Safaricom Topup Files")] public async global::System.Threading.Tasks.Task Process2SafaricomTopupFiles() { string[] tagsOfScenario = ((string[])(null)); global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process 2 Safaricom Topup Files", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "2"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process 2 Safaricom Topup Files", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 102 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { @@ -580,21 +595,24 @@ await testRunner.GivenAsync("I have a token to access the estate management and await this.ScenarioCleanupAsync(); } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Duplicate Safaricom Topup File with 1 detail row")] - [NUnit.Framework.CategoryAttribute("PRTest")] + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Duplicate Safaricom Topup File with 1 detail row")] + [global::NUnit.Framework.CategoryAttribute("PRTest")] public async global::System.Threading.Tasks.Task ProcessDuplicateSafaricomTopupFileWith1DetailRow() { string[] tagsOfScenario = new string[] { "PRTest"}; global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Duplicate Safaricom Topup File with 1 detail row", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "3"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Duplicate Safaricom Topup File with 1 detail row", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 125 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { @@ -679,19 +697,22 @@ await testRunner.GivenAsync("I have a token to access the estate management and await this.ScenarioCleanupAsync(); } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Safaricom Topup File with Upload Date Time")] + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Safaricom Topup File with Upload Date Time")] public async global::System.Threading.Tasks.Task ProcessSafaricomTopupFileWithUploadDateTime() { string[] tagsOfScenario = ((string[])(null)); global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Safaricom Topup File with Upload Date Time", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "4"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Safaricom Topup File with Upload Date Time", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 150 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { diff --git a/FileProcessor.IntegrationTests/Features/ProcessVoucherCSV.feature.cs b/FileProcessor.IntegrationTests/Features/ProcessVoucherCSV.feature.cs index dbfb1d3..b3487ba 100644 --- a/FileProcessor.IntegrationTests/Features/ProcessVoucherCSV.feature.cs +++ b/FileProcessor.IntegrationTests/Features/ProcessVoucherCSV.feature.cs @@ -1,8 +1,8 @@ // ------------------------------------------------------------------------------ // -// This code was generated by Reqnroll (https://www.reqnroll.net/). -// Reqnroll Version:2.0.0.0 -// Reqnroll Generator Version:2.0.0.0 +// This code was generated by Reqnroll (https://reqnroll.net/). +// Reqnroll Version:3.0.0.0 +// Reqnroll Generator Version:3.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,14 +15,14 @@ namespace FileProcessor.IntegrationTests.Features { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll", "2.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll", "3.0.0.0")] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [NUnit.Framework.TestFixtureAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Voucher CSV Files")] - [NUnit.Framework.FixtureLifeCycleAttribute(NUnit.Framework.LifeCycle.InstancePerTestCase)] - [NUnit.Framework.CategoryAttribute("base")] - [NUnit.Framework.CategoryAttribute("shared")] - [NUnit.Framework.CategoryAttribute("processvouchercsv")] + [global::NUnit.Framework.TestFixtureAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Voucher CSV Files")] + [global::NUnit.Framework.FixtureLifeCycleAttribute(global::NUnit.Framework.LifeCycle.InstancePerTestCase)] + [global::NUnit.Framework.CategoryAttribute("base")] + [global::NUnit.Framework.CategoryAttribute("shared")] + [global::NUnit.Framework.CategoryAttribute("processvouchercsv")] public partial class ProcessVoucherCSVFilesFeature { @@ -33,22 +33,23 @@ public partial class ProcessVoucherCSVFilesFeature "shared", "processvouchercsv"}; - private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new global::System.Globalization.CultureInfo("en-US"), "Features", "Process Voucher CSV Files", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags); + private static global::Reqnroll.FeatureInfo featureInfo = new global::Reqnroll.FeatureInfo(new global::System.Globalization.CultureInfo("en-US"), "Features", "Process Voucher CSV Files", null, global::Reqnroll.ProgrammingLanguage.CSharp, featureTags, InitializeCucumberMessages()); #line 1 "ProcessVoucherCSV.feature" #line hidden - [NUnit.Framework.OneTimeSetUpAttribute()] + [global::NUnit.Framework.OneTimeSetUpAttribute()] public static async global::System.Threading.Tasks.Task FeatureSetupAsync() { } - [NUnit.Framework.OneTimeTearDownAttribute()] + [global::NUnit.Framework.OneTimeTearDownAttribute()] public static async global::System.Threading.Tasks.Task FeatureTearDownAsync() { + await global::Reqnroll.TestRunnerManager.ReleaseFeatureAsync(featureInfo); } - [NUnit.Framework.SetUpAttribute()] + [global::NUnit.Framework.SetUpAttribute()] public async global::System.Threading.Tasks.Task TestInitializeAsync() { testRunner = global::Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(featureHint: featureInfo); @@ -74,7 +75,7 @@ public partial class ProcessVoucherCSVFilesFeature } } - [NUnit.Framework.TearDownAttribute()] + [global::NUnit.Framework.TearDownAttribute()] public async global::System.Threading.Tasks.Task TestTearDownAsync() { if ((testRunner == null)) @@ -92,10 +93,10 @@ public partial class ProcessVoucherCSVFilesFeature } } - public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo) + public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, global::Reqnroll.RuleInfo ruleInfo) { - testRunner.OnScenarioInitialize(scenarioInfo); - testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(NUnit.Framework.TestContext.CurrentContext); + testRunner.OnScenarioInitialize(scenarioInfo, ruleInfo); + testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(global::NUnit.Framework.TestContext.CurrentContext); } public async global::System.Threading.Tasks.Task ScenarioStartAsync() @@ -382,19 +383,27 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line hidden } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Voucher File with 1 detail row for recipient email")] + private static global::Reqnroll.Formatters.RuntimeSupport.FeatureLevelCucumberMessages InitializeCucumberMessages() + { + return new global::Reqnroll.Formatters.RuntimeSupport.FeatureLevelCucumberMessages("Features/ProcessVoucherCSV.feature.ndjson", 7); + } + + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Voucher File with 1 detail row for recipient email")] public async global::System.Threading.Tasks.Task ProcessVoucherFileWith1DetailRowForRecipientEmail() { string[] tagsOfScenario = ((string[])(null)); global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Voucher File with 1 detail row for recipient email", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "0"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Voucher File with 1 detail row for recipient email", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 78 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { @@ -442,19 +451,22 @@ await testRunner.GivenAsync("I have a token to access the estate management and await this.ScenarioCleanupAsync(); } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Voucher File with 1 detail row for recipient mobile")] + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Voucher File with 1 detail row for recipient mobile")] public async global::System.Threading.Tasks.Task ProcessVoucherFileWith1DetailRowForRecipientMobile() { string[] tagsOfScenario = ((string[])(null)); global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Voucher File with 1 detail row for recipient mobile", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "1"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Voucher File with 1 detail row for recipient mobile", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 90 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { @@ -502,19 +514,22 @@ await testRunner.GivenAsync("I have a token to access the estate management and await this.ScenarioCleanupAsync(); } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Voucher File with 2 detail rows")] + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Voucher File with 2 detail rows")] public async global::System.Threading.Tasks.Task ProcessVoucherFileWith2DetailRows() { string[] tagsOfScenario = ((string[])(null)); global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Voucher File with 2 detail rows", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "2"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Voucher File with 2 detail rows", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 102 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { @@ -567,19 +582,22 @@ await testRunner.GivenAsync("I have a token to access the estate management and await this.ScenarioCleanupAsync(); } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process 2 Voucher Files")] + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process 2 Voucher Files")] public async global::System.Threading.Tasks.Task Process2VoucherFiles() { string[] tagsOfScenario = ((string[])(null)); global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process 2 Voucher Files", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "3"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process 2 Voucher Files", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 115 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { @@ -673,21 +691,24 @@ await testRunner.GivenAsync("I have a token to access the estate management and await this.ScenarioCleanupAsync(); } - [NUnit.Framework.TestAttribute()] - [NUnit.Framework.DescriptionAttribute("Process Duplicate Voucher Topup File with 1 detail row")] - [NUnit.Framework.CategoryAttribute("PRTest")] + [global::NUnit.Framework.TestAttribute()] + [global::NUnit.Framework.DescriptionAttribute("Process Duplicate Voucher Topup File with 1 detail row")] + [global::NUnit.Framework.CategoryAttribute("PRTest")] public async global::System.Threading.Tasks.Task ProcessDuplicateVoucherTopupFileWith1DetailRow() { string[] tagsOfScenario = new string[] { "PRTest"}; global::System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new global::System.Collections.Specialized.OrderedDictionary(); - global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Duplicate Voucher Topup File with 1 detail row", null, tagsOfScenario, argumentsOfScenario, featureTags); + string pickleIndex = "4"; + global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Process Duplicate Voucher Topup File with 1 detail row", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); + string[] tagsOfRule = ((string[])(null)); + global::Reqnroll.RuleInfo ruleInfo = null; #line 139 -this.ScenarioInitialize(scenarioInfo); +this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) { - testRunner.SkipScenario(); + await testRunner.SkipScenarioAsync(); } else { diff --git a/FileProcessor.IntegrationTests/FileProcessor.IntegrationTests.csproj b/FileProcessor.IntegrationTests/FileProcessor.IntegrationTests.csproj index 101c99a..109ecf6 100644 --- a/FileProcessor.IntegrationTests/FileProcessor.IntegrationTests.csproj +++ b/FileProcessor.IntegrationTests/FileProcessor.IntegrationTests.csproj @@ -12,23 +12,23 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/FileProcessor.Tests/FileProcessor.Tests.csproj b/FileProcessor.Tests/FileProcessor.Tests.csproj index 45592bc..c367543 100644 --- a/FileProcessor.Tests/FileProcessor.Tests.csproj +++ b/FileProcessor.Tests/FileProcessor.Tests.csproj @@ -7,13 +7,13 @@ - + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/FileProcessor/Bootstrapper/MiddlewareRegistry.cs b/FileProcessor/Bootstrapper/MiddlewareRegistry.cs index 1fc129e..d4553c1 100644 --- a/FileProcessor/Bootstrapper/MiddlewareRegistry.cs +++ b/FileProcessor/Bootstrapper/MiddlewareRegistry.cs @@ -1,11 +1,5 @@ namespace FileProcessor.Bootstrapper { - using System; - using System.Diagnostics.CodeAnalysis; - using System.Globalization; - using System.IO; - using System.Net.Http; - using System.Reflection; using EventStore.Client; using Lamar; using Microsoft.AspNetCore.Authentication.JwtBearer; @@ -15,9 +9,16 @@ using Microsoft.OpenApi.Models; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; + using Shared.Authorisation; using Shared.EventStore.Extensions; using Shared.Extensions; using Shared.General; + using System; + using System.Diagnostics.CodeAnalysis; + using System.Globalization; + using System.IO; + using System.Net.Http; + using System.Reflection; [ExcludeFromCodeCoverage] public class MiddlewareRegistry : ServiceRegistry @@ -108,6 +109,15 @@ public MiddlewareRegistry() Assembly assembly = this.GetType().GetTypeInfo().Assembly; this.AddMvcCore().AddApplicationPart(assembly).AddControllersAsServices(); + + this.AddClientCredentialsOnlyPolicy(); + this.AddClientCredentialsHandler(); + + this.ConfigureHttpJsonOptions(options => + { + options.SerializerOptions.PropertyNamingPolicy = new SnakeCaseNamingPolicy(); + options.SerializerOptions.PropertyNameCaseInsensitive = true; // optional, but safer + }); } #endregion diff --git a/FileProcessor/Controllers/FileController.cs b/FileProcessor/Controllers/FileController.cs index 3cef463..04c47ef 100644 --- a/FileProcessor/Controllers/FileController.cs +++ b/FileProcessor/Controllers/FileController.cs @@ -72,7 +72,7 @@ public FileController(IMediator mediator, IModelFactory modelFactory) [HttpPost] [DisableRequestSizeLimit] [Consumes("multipart/form-data")] - public async Task UploadFile([FromForm] UploadFileRequest request, + public async Task UploadFile([FromForm] UploadFileRequest request, [FromForm] IFormCollection formCollection, CancellationToken cancellationToken) { @@ -103,7 +103,7 @@ public async Task UploadFile([FromForm] UploadFileRequest request Shared.Logger.Logger.LogDebug($"Month is {request.UploadDateTime.Month}"); Shared.Logger.Logger.LogDebug($"Year is {request.UploadDateTime.Year}"); - return result.ToActionResultX(); + return ResponseFactory.FromResult(result, (r) => r); } /// @@ -115,20 +115,15 @@ public async Task UploadFile([FromForm] UploadFileRequest request /// [HttpGet] [Route("{fileId}")] - public async Task GetFile([FromRoute] Guid fileId, + public async Task GetFile([FromRoute] Guid fileId, [FromQuery] Guid estateId, CancellationToken cancellationToken) { //FileDetails fileDetailsModel = await this.Manager.GetFile(fileId, estateId, cancellationToken); FileQueries.GetFileQuery query = new FileQueries.GetFileQuery(fileId, estateId); Result result = await this.Mediator.Send(query, cancellationToken); - - if (result.IsFailed) - return ResultHelpers.CreateFailure(result).ToActionResultX(); - - DataTransferObjects.Responses.FileDetails response = this.ModelFactory.ConvertFrom(result.Data); - - return Result.Success(response).ToActionResultX(); + + return ResponseFactory.FromResult(result, (r) => this.ModelFactory.ConvertFrom(r)); } diff --git a/FileProcessor/Controllers/FileImportLogController.cs b/FileProcessor/Controllers/FileImportLogController.cs index 892e46c..9c6c9f8 100644 --- a/FileProcessor/Controllers/FileImportLogController.cs +++ b/FileProcessor/Controllers/FileImportLogController.cs @@ -1,6 +1,7 @@ using FileProcessor.BusinessLogic.Requests; using FileProcessor.DataTransferObjects.Responses; using MediatR; +using Microsoft.AspNetCore.Http; using Shared.EventStore.Aggregate; using Shared.Results; using Shared.Results.Web; @@ -68,7 +69,7 @@ public FileImportLogController(IMediator mediator, /// The cancellation token. /// [HttpGet] - public async Task GetImportLogs([FromQuery] Guid estateId, + public async Task GetImportLogs([FromQuery] Guid estateId, [FromQuery] DateTime startDateTime, [FromQuery] DateTime endDateTime, [FromQuery] Guid? merchantId, @@ -76,18 +77,13 @@ public async Task GetImportLogs([FromQuery] Guid estateId, FileQueries.GetImportLogsQuery query = new(estateId, startDateTime, endDateTime, merchantId); Result> result = await this.Mediator.Send(query, cancellationToken); - - if (result.IsFailed) - return ResultHelpers.CreateFailure(result).ToActionResultX(); - - FileImportLogList response = this.ModelFactory.ConvertFrom(result.Data); - - return Result.Success(response).ToActionResultX(); + + return ResponseFactory.FromResult(result, (r) => this.ModelFactory.ConvertFrom(r)); } [HttpGet] [Route("{fileImportLogId}")] - public async Task GetImportLog([FromRoute] Guid fileImportLogId, + public async Task GetImportLog([FromRoute] Guid fileImportLogId, [FromQuery] Guid estateId, [FromQuery] Guid? merchantId, CancellationToken cancellationToken) @@ -96,12 +92,7 @@ public async Task GetImportLog([FromRoute] Guid fileImportLogId, Result result = await this.Mediator.Send(query, cancellationToken); - if (result.IsFailed) - return ResultHelpers.CreateFailure(result).ToActionResultX(); - - DataTransferObjects.Responses.FileImportLog response = this.ModelFactory.ConvertFrom(result.Data); - - return Result.Success(response).ToActionResultX(); + return ResponseFactory.FromResult(result, (r) => this.ModelFactory.ConvertFrom(r)); } #endregion diff --git a/FileProcessor/FileProcessor.csproj b/FileProcessor/FileProcessor.csproj index 0870d0e..7239252 100644 --- a/FileProcessor/FileProcessor.csproj +++ b/FileProcessor/FileProcessor.csproj @@ -7,31 +7,31 @@ - - - + + + - - + + - - - - + + + + - - - - - - - + + + + + + +