diff --git a/FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj b/FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj index aa4653b..cc199e6 100644 --- a/FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj +++ b/FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj @@ -5,16 +5,16 @@ - + - - - - + + + + - + - + diff --git a/FileProcessor.BusinessLogic/Services/IFileProcessorDomainService.cs b/FileProcessor.BusinessLogic/Services/IFileProcessorDomainService.cs index e70f87b..3519af4 100644 --- a/FileProcessor.BusinessLogic/Services/IFileProcessorDomainService.cs +++ b/FileProcessor.BusinessLogic/Services/IFileProcessorDomainService.cs @@ -14,12 +14,7 @@ public interface IFileProcessorDomainService Task ProcessUploadedFile(ProcessUploadedFileRequest request, CancellationToken cancellationToken); - - //Task ProcessSafaricomTopup(SafaricomTopupRequest request, - // CancellationToken cancellationToken); - - //Task ProcessVoucher(VoucherRequest request, CancellationToken cancellationToken); - + Task ProcessTransactionForFileLine(ProcessTransactionForFileLineRequest request, CancellationToken cancellationToken); } diff --git a/FileProcessor.Client/FileProcessor.Client.csproj b/FileProcessor.Client/FileProcessor.Client.csproj index e964c15..ac27cd1 100644 --- a/FileProcessor.Client/FileProcessor.Client.csproj +++ b/FileProcessor.Client/FileProcessor.Client.csproj @@ -6,7 +6,7 @@ - + diff --git a/FileProcessor.File.DomainEvents/FileProcessor.File.DomainEvents.csproj b/FileProcessor.File.DomainEvents/FileProcessor.File.DomainEvents.csproj index 5bfe1c3..c3af191 100644 --- a/FileProcessor.File.DomainEvents/FileProcessor.File.DomainEvents.csproj +++ b/FileProcessor.File.DomainEvents/FileProcessor.File.DomainEvents.csproj @@ -5,7 +5,7 @@ - + diff --git a/FileProcessor.FileAggregate/FileProcessor.FileAggregate.csproj b/FileProcessor.FileAggregate/FileProcessor.FileAggregate.csproj index f1e1b09..8e891fb 100644 --- a/FileProcessor.FileAggregate/FileProcessor.FileAggregate.csproj +++ b/FileProcessor.FileAggregate/FileProcessor.FileAggregate.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/FileProcessor.FileImportLog.DomainEvents/FileProcessor.FileImportLog.DomainEvents.csproj b/FileProcessor.FileImportLog.DomainEvents/FileProcessor.FileImportLog.DomainEvents.csproj index a81e0fb..2efc2ef 100644 --- a/FileProcessor.FileImportLog.DomainEvents/FileProcessor.FileImportLog.DomainEvents.csproj +++ b/FileProcessor.FileImportLog.DomainEvents/FileProcessor.FileImportLog.DomainEvents.csproj @@ -5,7 +5,7 @@ - + diff --git a/FileProcessor.FileImportLogAggregate/FileProcessor.FileImportLogAggregate.csproj b/FileProcessor.FileImportLogAggregate/FileProcessor.FileImportLogAggregate.csproj index c2e2e15..46a899c 100644 --- a/FileProcessor.FileImportLogAggregate/FileProcessor.FileImportLogAggregate.csproj +++ b/FileProcessor.FileImportLogAggregate/FileProcessor.FileImportLogAggregate.csproj @@ -6,7 +6,7 @@ - + diff --git a/FileProcessor.IntegrationTesting.Helpers/Class1.cs b/FileProcessor.IntegrationTesting.Helpers/Class1.cs index d5f5022..613eceb 100644 --- a/FileProcessor.IntegrationTesting.Helpers/Class1.cs +++ b/FileProcessor.IntegrationTesting.Helpers/Class1.cs @@ -31,4 +31,16 @@ public Guid GetFileId(String originalFileName) return this.FileImportLogFiles.Single(o => o.OriginalFileName == originalFileName).FileId; } } + + public static class SubscriptionsHelper + { + public static List<(String streamName, String groupName, Int32 maxRetries)> GetSubscriptions() + { + List<(String streamName, String groupName, Int32 maxRetries)> subscriptions = new(){ + ("$ce-FileImportLogAggregate", "File Processor", 0), + ("$ce-FileAggregate", "File Processor", 0) + }; + return subscriptions; + } + } } \ No newline at end of file diff --git a/FileProcessor.IntegrationTesting.Helpers/FileProcessor.IntegrationTesting.Helpers.csproj b/FileProcessor.IntegrationTesting.Helpers/FileProcessor.IntegrationTesting.Helpers.csproj index cf274d9..2441f85 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.IntegrationTesting.Helpers/FileProcessorSteps.cs b/FileProcessor.IntegrationTesting.Helpers/FileProcessorSteps.cs index 13212f4..a38b99d 100644 --- a/FileProcessor.IntegrationTesting.Helpers/FileProcessorSteps.cs +++ b/FileProcessor.IntegrationTesting.Helpers/FileProcessorSteps.cs @@ -64,8 +64,8 @@ await this.FileProcessorClient.UploadFile(accessToken, public async Task WhenIGetTheImportLogsBetweenAndTheFollowingDataIsReturned(String accessToken, String startDateString, String endDateString, String estateName, List estateDetailsList, List<(DateTime, Int32)> expectedImportLogs) { - DateTime queryStartDate = SpecflowTableHelper.GetDateForDateString(startDateString, DateTime.Now); - DateTime queryEndDate = SpecflowTableHelper.GetDateForDateString(endDateString, DateTime.Now); + DateTime queryStartDate = ReqnrollTableHelper.GetDateForDateString(startDateString, DateTime.Now); + DateTime queryEndDate = ReqnrollTableHelper.GetDateForDateString(endDateString, DateTime.Now); EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName); estate.ShouldNotBeNull(); @@ -94,7 +94,7 @@ public async Task WhenIGetTheImportLogForTheFollowingFileInformationIsReturned(S EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName); estate.ShouldNotBeNull(); - DateTime queryStartDate = SpecflowTableHelper.GetDateForDateString(startDate, DateTime.Now); + DateTime queryStartDate = ReqnrollTableHelper.GetDateForDateString(startDate, DateTime.Now); FileImportLogList importLogList = await this.FileProcessorClient.GetFileImportLogs(accessToken, estate.EstateDetails.EstateId, queryStartDate, @@ -129,7 +129,7 @@ public async Task WhenIGetTheImportLogForEstateTheDateOnTheImportLogIs(String ac EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName); estate.ShouldNotBeNull(); - DateTime expectedDate = SpecflowTableHelper.GetDateForDateString(expectedDateString, DateTime.Now); + DateTime expectedDate = ReqnrollTableHelper.GetDateForDateString(expectedDateString, DateTime.Now); FileImportLogList? importLogs = await this.FileProcessorClient.GetFileImportLogs(accessToken, estate.EstateDetails.EstateId, @@ -142,7 +142,7 @@ public async Task WhenIGetTheImportLogForEstateTheDateOnTheImportLogIs(String ac i.ShouldNotBeNull(); } - public async Task WhenIGetTheFileForEstateTheFollowingFileInformationIsReturned(String accessToken, String fileName, String estateName, List estateDetailsList, SpecflowExtensions.FileProcessingSummary fileSummary){ + public async Task WhenIGetTheFileForEstateTheFollowingFileInformationIsReturned(String accessToken, String fileName, String estateName, List estateDetailsList, ReqnrollExtensions.FileProcessingSummary fileSummary){ EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName); estate.ShouldNotBeNull(); @@ -163,7 +163,7 @@ await Retry.For(async () => }, TimeSpan.FromMinutes(4), TimeSpan.FromSeconds(30)); } - public async Task WhenIGetTheFileForEstateTheFollowingFileLinesAreReturned(String accessToken, String fileName, String estateName, List estateDetailsList, List fileLineDetails){ + public async Task WhenIGetTheFileForEstateTheFollowingFileLinesAreReturned(String accessToken, String fileName, String estateName, List estateDetailsList, List fileLineDetails){ EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName); estate.ShouldNotBeNull(); @@ -173,7 +173,7 @@ await Retry.For(async () => { FileDetails fileDetails = await this.FileProcessorClient.GetFile(accessToken, estate.EstateDetails.EstateId, fileId, CancellationToken.None); fileDetails.ShouldNotBeNull(); - foreach (SpecflowExtensions.FileLineDetails fileLineDetail in fileLineDetails){ + foreach (ReqnrollExtensions.FileLineDetails fileLineDetail in fileLineDetails){ FileLine? lineToVerify = fileDetails.FileLines.SingleOrDefault(fl => fl.LineNumber == fileLineDetail.LineNumber); lineToVerify.ShouldNotBeNull(); diff --git a/FileProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs b/FileProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs index 182ace6..5dee870 100644 --- a/FileProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs +++ b/FileProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs @@ -4,31 +4,31 @@ using DataTransferObjects; using DataTransferObjects.Responses; using Microsoft.EntityFrameworkCore.Metadata.Internal; +using Reqnroll; using Shared.IntegrationTesting; using Shouldly; -using TechTalk.SpecFlow; -public static class SpecflowExtensions +public static class ReqnrollExtensions { - public static List<(DateTime, Int32)> ToExpectedImportLogData(this TableRows tableRows) + public static List<(DateTime, Int32)> ToExpectedImportLogData(this DataTableRows tableRows) { List<(DateTime, Int32)> results = new List<(DateTime, Int32)>(); - foreach (TableRow tableRow in tableRows) + foreach (DataTableRow tableRow in tableRows) { - DateTime importLogDateTime = SpecflowTableHelper.GetDateForDateString(SpecflowTableHelper.GetStringRowValue(tableRow, "ImportLogDate"), DateTime.Now); - Int32 fileCount = SpecflowTableHelper.GetIntValue(tableRow, "FileCount"); + DateTime importLogDateTime = ReqnrollTableHelper.GetDateForDateString(ReqnrollTableHelper.GetStringRowValue(tableRow, "ImportLogDate"), DateTime.Now); + Int32 fileCount = ReqnrollTableHelper.GetIntValue(tableRow, "FileCount"); results.Add((importLogDateTime, fileCount)); } return results; } - public static String ToFileData(this TableRows tableRows) + public static String ToFileData(this DataTableRows tableRows) { StringBuilder fileBuilder = new StringBuilder(); Int32 currentRow = 1; - foreach (var row in tableRows) + foreach (DataTableRow row in tableRows) { StringBuilder rowBuilder = new StringBuilder(); foreach (String rowValue in row.Values) @@ -48,15 +48,15 @@ public static String ToFileData(this TableRows tableRows) return fileBuilder.ToString(); } - public static (EstateDetails1, UploadFileRequest) ToUploadFileRequest(this TableRows tableRows, List estateDetailsList, Byte[] fileData) + public static (EstateDetails1, UploadFileRequest) ToUploadFileRequest(this DataTableRows tableRows, List estateDetailsList, Byte[] fileData) { tableRows.Count.ShouldBe(1); // We can only handle 1 row here var row = tableRows.First(); - string estateName = SpecflowTableHelper.GetStringRowValue(row, "EstateName"); - string merchantName = SpecflowTableHelper.GetStringRowValue(row, "MerchantName"); - string fileProfileId = SpecflowTableHelper.GetStringRowValue(row, "FileProfileId"); - string userId = SpecflowTableHelper.GetStringRowValue(row, "UserId"); - string uploadDateTime = SpecflowTableHelper.GetStringRowValue(row, "UploadDateTime"); + string estateName = ReqnrollTableHelper.GetStringRowValue(row, "EstateName"); + string merchantName = ReqnrollTableHelper.GetStringRowValue(row, "MerchantName"); + string fileProfileId = ReqnrollTableHelper.GetStringRowValue(row, "FileProfileId"); + string userId = ReqnrollTableHelper.GetStringRowValue(row, "UserId"); + string uploadDateTime = ReqnrollTableHelper.GetStringRowValue(row, "UploadDateTime"); EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName); estate.ShouldNotBeNull(); @@ -73,20 +73,20 @@ public static (EstateDetails1, UploadFileRequest) ToUploadFileRequest(this Table if (string.IsNullOrEmpty(uploadDateTime) == false) { - uploadFileRequest.UploadDateTime = SpecflowTableHelper.GetDateForDateString(uploadDateTime, DateTime.Now); + uploadFileRequest.UploadDateTime = ReqnrollTableHelper.GetDateForDateString(uploadDateTime, DateTime.Now); } return (estate, uploadFileRequest); } - public static List<(String, Guid)> ToFileDetails(this TableRows tableRows, String estateName, List estateDetailsList) + public static List<(String, Guid)> ToFileDetails(this DataTableRows tableRows, String estateName, List estateDetailsList) { List<(String, Guid)> results = new List<(String, Guid)>(); - foreach (TableRow tableRow in tableRows) + foreach (DataTableRow tableRow in tableRows) { //| MerchantName | OriginalFileName | NumberOfLines | - String merchantName = SpecflowTableHelper.GetStringRowValue(tableRow, "MerchantName"); - String originalFileName = SpecflowTableHelper.GetStringRowValue(tableRow, "OriginalFileName"); + String merchantName = ReqnrollTableHelper.GetStringRowValue(tableRow, "MerchantName"); + String originalFileName = ReqnrollTableHelper.GetStringRowValue(tableRow, "OriginalFileName"); EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName); Guid merchantId = estate.EstateDetails.GetMerchantId(merchantName); @@ -95,29 +95,29 @@ public static (EstateDetails1, UploadFileRequest) ToUploadFileRequest(this Table return results; } - public static FileProcessingSummary ToFileProcessingSummary(this TableRows tableRows) + public static FileProcessingSummary ToFileProcessingSummary(this DataTableRows tableRows) { tableRows.Count.ShouldBe(1); - TableRow tableRow = tableRows.First(); + DataTableRow tableRow = tableRows.First(); FileProcessingSummary summary = new FileProcessingSummary{ - ProcessingCompleted = SpecflowTableHelper.GetBooleanValue(tableRow, "ProcessingCompleted"), - NumberOfLines = SpecflowTableHelper.GetIntValue(tableRow, "NumberOfLines"), - TotaLines = SpecflowTableHelper.GetIntValue(tableRow, "TotaLines"), - SuccessfulLines = SpecflowTableHelper.GetIntValue(tableRow, "SuccessfulLines"), - IgnoredLines = SpecflowTableHelper.GetIntValue(tableRow, "IgnoredLines"), - FailedLines = SpecflowTableHelper.GetIntValue(tableRow, "FailedLines"), - NotProcessedLines = SpecflowTableHelper.GetIntValue(tableRow, "NotProcessedLines") + ProcessingCompleted = ReqnrollTableHelper.GetBooleanValue(tableRow, "ProcessingCompleted"), + NumberOfLines = ReqnrollTableHelper.GetIntValue(tableRow, "NumberOfLines"), + TotaLines = ReqnrollTableHelper.GetIntValue(tableRow, "TotaLines"), + SuccessfulLines = ReqnrollTableHelper.GetIntValue(tableRow, "SuccessfulLines"), + IgnoredLines = ReqnrollTableHelper.GetIntValue(tableRow, "IgnoredLines"), + FailedLines = ReqnrollTableHelper.GetIntValue(tableRow, "FailedLines"), + NotProcessedLines = ReqnrollTableHelper.GetIntValue(tableRow, "NotProcessedLines") }; return summary; } - public static List ToFileLineDetails(this TableRows tableRows){ + public static List ToFileLineDetails(this DataTableRows tableRows){ List< FileLineDetails > results = new List< FileLineDetails >(); - foreach (TableRow tableRow in tableRows){ + foreach (DataTableRow tableRow in tableRows){ FileLineDetails fileLineDetails = new FileLineDetails(); - fileLineDetails.LineNumber = SpecflowTableHelper.GetIntValue(tableRow, "LineNumber"); - fileLineDetails.LineData = SpecflowTableHelper.GetStringRowValue(tableRow, "Data"); - String processingResultString = SpecflowTableHelper.GetStringRowValue(tableRow, "Result"); + fileLineDetails.LineNumber = ReqnrollTableHelper.GetIntValue(tableRow, "LineNumber"); + fileLineDetails.LineData = ReqnrollTableHelper.GetStringRowValue(tableRow, "Data"); + String processingResultString = ReqnrollTableHelper.GetStringRowValue(tableRow, "Result"); fileLineDetails.ProcessingResult = Enum.Parse(processingResultString, true); results.Add(fileLineDetails); } diff --git a/FileProcessor.IntegrationTests/Common/DockerHelper.cs b/FileProcessor.IntegrationTests/Common/DockerHelper.cs index 881307c..b68b23b 100644 --- a/FileProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/FileProcessor.IntegrationTests/Common/DockerHelper.cs @@ -70,6 +70,24 @@ public DockerHelper(){ #region Methods + public override async Task CreateSubscriptions(){ + List<(String streamName, String groupName, Int32 maxRetries)> subscriptions = new(); + subscriptions.AddRange(MessagingService.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions()); + subscriptions.AddRange(EstateManagement.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions()); + subscriptions.AddRange(TransactionProcessor.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions()); + subscriptions.AddRange(FileProcessor.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions()); + + // TODO: this needs moved to Estate Management nuget + subscriptions.Add(("$ce-FileImportLogAggregate", "Estate Management", 0)); + + foreach ((String streamName, String groupName, Int32 maxRetries) subscription in subscriptions) + { + var x = subscription; + x.maxRetries = 2; + await this.CreatePersistentSubscription(x); + } + } + public override async Task StartContainersForScenarioRun(String scenarioName, DockerServices dockerServices){ await base.StartContainersForScenarioRun(scenarioName, dockerServices); diff --git a/FileProcessor.IntegrationTests/Common/GenericSteps.cs b/FileProcessor.IntegrationTests/Common/GenericSteps.cs index fab1ac1..56c112b 100644 --- a/FileProcessor.IntegrationTests/Common/GenericSteps.cs +++ b/FileProcessor.IntegrationTests/Common/GenericSteps.cs @@ -8,10 +8,10 @@ namespace FileProcessor.IntegrationTests.Common { using System.Threading; using NLog; + using Reqnroll; using Shared.IntegrationTesting; using Shared.Logger; - using TechTalk.SpecFlow; - + [Binding] [Scope(Tag = "base")] public class GenericSteps @@ -36,8 +36,18 @@ public async Task StartSystem() logger.Initialise(LogManager.GetLogger(scenarioName), scenarioName); LogManager.AddHiddenAssembly(typeof(NlogLogger).Assembly); + DockerServices dockerServices = DockerServices.EstateManagement | DockerServices.EventStore | DockerServices.FileProcessor | DockerServices.MessagingService | + DockerServices.SecurityService | DockerServices.SqlServer | DockerServices.TestHost | DockerServices.TransactionProcessor | + DockerServices.TestHost | DockerServices.CallbackHandler | DockerServices.TransactionProcessorAcl; + this.TestingContext.DockerHelper = new DockerHelper(); this.TestingContext.DockerHelper.Logger = logger; + this.TestingContext.Logger = logger; + this.TestingContext.DockerHelper.RequiredDockerServices = dockerServices; + this.TestingContext.Logger.LogInformation("About to Start Global Setup"); + + await Setup.GlobalSetup(this.TestingContext.DockerHelper); + this.TestingContext.DockerHelper.SqlServerContainer = Setup.DatabaseServerContainer; this.TestingContext.DockerHelper.SqlServerNetwork = Setup.DatabaseServerNetwork; this.TestingContext.DockerHelper.DockerCredentials = Setup.DockerCredentials; @@ -48,18 +58,16 @@ public async Task StartSystem() this.TestingContext.Logger = logger; this.TestingContext.Logger.LogInformation("About to Start Containers for Scenario Run"); - DockerServices dockerServices = DockerServices.EstateManagement | DockerServices.EventStore | DockerServices.FileProcessor | DockerServices.MessagingService | - DockerServices.SecurityService | DockerServices.SqlServer | DockerServices.TestHost | DockerServices.TransactionProcessor | - DockerServices.TestHost | DockerServices.CallbackHandler | DockerServices.TransactionProcessorAcl; await this.TestingContext.DockerHelper.StartContainersForScenarioRun(scenarioName, dockerServices).ConfigureAwait(false); this.TestingContext.Logger.LogInformation("Containers for Scenario Run Started"); } [AfterScenario] - public async Task StopSystem() - { + public async Task StopSystem(){ + DockerServices shareDockerServices = DockerServices.SqlServer; + this.TestingContext.Logger.LogInformation("About to Stop Containers for Scenario Run"); - await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false); + await this.TestingContext.DockerHelper.StopContainersForScenarioRun(shareDockerServices).ConfigureAwait(false); this.TestingContext.Logger.LogInformation("Containers for Scenario Run Stopped"); } } diff --git a/FileProcessor.IntegrationTests/Common/Setup.cs b/FileProcessor.IntegrationTests/Common/Setup.cs index d013ebf..4fa865b 100644 --- a/FileProcessor.IntegrationTests/Common/Setup.cs +++ b/FileProcessor.IntegrationTests/Common/Setup.cs @@ -5,14 +5,16 @@ using System.Data.SqlClient; using System.Net; using System.Threading; + using System.Threading.Tasks; using Ductus.FluentDocker.Builders; using Ductus.FluentDocker.Services; using Ductus.FluentDocker.Services.Extensions; using Microsoft.Extensions.Logging; using NLog; + using Reqnroll; + using Shared.IntegrationTesting; using Shared.Logger; using Shouldly; - using TechTalk.SpecFlow; using ILogger = Microsoft.Extensions.Logging.ILogger; [Binding] @@ -22,23 +24,18 @@ public class Setup public static INetworkService DatabaseServerNetwork; public static (String usename, String password) SqlCredentials = ("sa", "thisisalongpassword123!"); public static (String url, String username, String password) DockerCredentials = ("https://www.docker.com", "stuartferguson", "Sc0tland"); - [BeforeTestRun] - protected static void GlobalSetup() + + public static async Task GlobalSetup(DockerHelper dockerHelper) { ShouldlyConfiguration.DefaultTaskTimeout = TimeSpan.FromMinutes(1); - - DockerHelper dockerHelper = new DockerHelper(); - - NlogLogger logger = new NlogLogger(); - logger.Initialise(LogManager.GetLogger("Specflow"), "Specflow"); - LogManager.AddHiddenAssembly(typeof(NlogLogger).Assembly); - dockerHelper.Logger = logger; dockerHelper.SqlCredentials = Setup.SqlCredentials; dockerHelper.DockerCredentials = Setup.DockerCredentials; dockerHelper.SqlServerContainerName = "sharedsqlserver"; - Setup.DatabaseServerNetwork = dockerHelper.SetupTestNetwork("sharednetwork", true); - Setup.DatabaseServerContainer = dockerHelper.SetupSqlServerContainer(Setup.DatabaseServerNetwork); + await Retry.For(async () => { + Setup.DatabaseServerNetwork = dockerHelper.SetupTestNetwork("sharednetwork", true); + Setup.DatabaseServerContainer = await dockerHelper.SetupSqlServerContainer(Setup.DatabaseServerNetwork); + }, TimeSpan.FromSeconds(60)); } public static String GetConnectionString(String databaseName) diff --git a/FileProcessor.IntegrationTests/Common/SpecflowTableHelper.cs b/FileProcessor.IntegrationTests/Common/SpecflowTableHelper.cs deleted file mode 100644 index 11a393e..0000000 --- a/FileProcessor.IntegrationTests/Common/SpecflowTableHelper.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace FileProcessor.IntegrationTests.Common -{ - using TechTalk.SpecFlow; - - public static class SpecflowTableHelper - { - #region Methods - - /// - /// Gets the boolean value. - /// - /// The row. - /// The key. - /// - public static Boolean GetBooleanValue(TableRow row, - String key) - { - String field = SpecflowTableHelper.GetStringRowValue(row, key); - - return bool.TryParse(field, out Boolean value) && value; - } - - /// - /// Gets the date for date string. - /// - /// The date string. - /// The today. - /// - public static DateTime GetDateForDateString(String dateString, - DateTime today) - { - switch (dateString.ToUpper()) - { - case "TODAY": - return today.Date; - case "YESTERDAY": - return today.AddDays(-1).Date; - case "LASTWEEK": - return today.AddDays(-7).Date; - case "LASTMONTH": - return today.AddMonths(-1).Date; - case "LASTYEAR": - return today.AddYears(-1).Date; - case "TOMORROW": - return today.AddDays(1).Date; - default: - if (dateString.Length == 10) - { - // We only have a date - return DateTime.ParseExact(dateString, "dd/MM/yyyy", null); - } - else if (dateString.Length == 19) - { - // We have a time as well - return DateTime.ParseExact(dateString, "dd/MM/yyyy hh:MM:ss", null); - } - else - { - return DateTime.MinValue; - } - - } - } - - /// - /// Gets the decimal value. - /// - /// The row. - /// The key. - /// - public static Decimal GetDecimalValue(TableRow row, - String key) - { - String field = SpecflowTableHelper.GetStringRowValue(row, key); - - return decimal.TryParse(field, out Decimal value) ? value : -1; - } - - /// - /// Gets the enum value. - /// - /// - /// The row. - /// The key. - /// - public static T GetEnumValue(TableRow row, - String key) where T : struct - { - String field = SpecflowTableHelper.GetStringRowValue(row, key); - - return Enum.Parse(field, true); - } - - /// - /// Gets the int value. - /// - /// The row. - /// The key. - /// - public static Int32 GetIntValue(TableRow row, - String key) - { - String field = SpecflowTableHelper.GetStringRowValue(row, key); - - return int.TryParse(field, out Int32 value) ? value : -1; - } - - /// - /// Gets the short value. - /// - /// The row. - /// The key. - /// - public static Int16 GetShortValue(TableRow row, - String key) - { - String field = SpecflowTableHelper.GetStringRowValue(row, key); - - if (short.TryParse(field, out Int16 value)) - { - return value; - } - - return -1; - } - - /// - /// Gets the string row value. - /// - /// The row. - /// The key. - /// - public static String GetStringRowValue(TableRow row, - String key) - { - return row.TryGetValue(key, out String value) ? value : ""; - } - - #endregion - } -} diff --git a/FileProcessor.IntegrationTests/Common/TestingContext.cs b/FileProcessor.IntegrationTests/Common/TestingContext.cs index 50cc491..04c0cf0 100644 --- a/FileProcessor.IntegrationTests/Common/TestingContext.cs +++ b/FileProcessor.IntegrationTests/Common/TestingContext.cs @@ -13,7 +13,6 @@ namespace FileProcessor.IntegrationTests.Common using EstateManagement.DataTransferObjects.Responses; using EstateManagement.IntegrationTesting.Helpers; using IntegrationTesting.Helpers; - using TechTalk.SpecFlow; public class ClientDetails { diff --git a/FileProcessor.IntegrationTests/Features/GetFileImportDetails.feature.cs b/FileProcessor.IntegrationTests/Features/GetFileImportDetails.feature.cs index 7747c9a..610fb7e 100644 --- a/FileProcessor.IntegrationTests/Features/GetFileImportDetails.feature.cs +++ b/FileProcessor.IntegrationTests/Features/GetFileImportDetails.feature.cs @@ -1,8 +1,8 @@ // ------------------------------------------------------------------------------ // -// This code was generated by SpecFlow (https://www.specflow.org/). -// SpecFlow Version:3.9.0.0 -// SpecFlow Generator Version:3.9.0.0 +// This code was generated by Reqnroll (https://www.reqnroll.net/). +// Reqnroll Version:1.0.0.0 +// Reqnroll Generator Version:1.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,20 +12,20 @@ #pragma warning disable namespace FileProcessor.IntegrationTests.Features { - using TechTalk.SpecFlow; + using Reqnroll; using System; using System.Linq; - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll", "1.0.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [Xunit.TraitAttribute("Category", "base")] [Xunit.TraitAttribute("Category", "shared")] [Xunit.TraitAttribute("Category", "getfileimportdetails")] - public partial class GetFileImportDetailsFeature : object, Xunit.IClassFixture, System.IDisposable + public partial class GetFileImportDetailsFeature : object, Xunit.IClassFixture, Xunit.IAsyncLifetime { - private static TechTalk.SpecFlow.ITestRunner testRunner; + private static Reqnroll.ITestRunner testRunner; private static string[] featureTags = new string[] { "base", @@ -37,55 +37,56 @@ public partial class GetFileImportDetailsFeature : object, Xunit.IClassFixture