protected void SetupContextProviders(Table table) { if (table.ContainsColumn("Provider")) { for (var rowIndex = 0; rowIndex < table.RowCount; rowIndex++) { StepDefinitionsContext.AddProvider(table.Rows[rowIndex]["Provider"]); } } else { StepDefinitionsContext.SetDefaultProvider(); } }
private void SetupCommitments(Table table) { StepDefinitionsContext.ReferenceDataContext.SetDefaultEmployer( new Dictionary <string, decimal> { { "All", int.MaxValue } }); var employer = StepDefinitionsContext.ReferenceDataContext.Employers[0]; AccountDataHelper.CreateAccount(employer.AccountId, employer.AccountId.ToString(), 0.00m, EnvironmentVariables); foreach (var row in table.Rows) { var ukprn = long.Parse(row["UKPRN"]); var startDate = DateTime.Parse(row["start date"]); var frameworkCode = table.Header.Contains("framework code") ? int.Parse(row["framework code"]) : IlrBuilder.Defaults.FrameworkCode; var programmeType = table.Header.Contains("programme type") ? int.Parse(row["programme type"]) : IlrBuilder.Defaults.ProgrammeType; var pathwayCode = table.Header.Contains("pathway code") ? int.Parse(row["pathway code"]) : IlrBuilder.Defaults.PathwayCode; var standardCode = table.Header.Contains("standard code") ? int.Parse(row["standard code"]) : IlrBuilder.Defaults.StandardCode; if (frameworkCode > 0 && programmeType > 0 && pathwayCode > 0) { standardCode = 0; } var status = row.ContainsKey("status") ? GetCommitmentStatusOrThrow(row["status"]) : CommitmentPaymentStatus.Active; StepDefinitionsContext.AddProvider("provider", ukprn); CommitmentDataHelper.CreateCommitment( new CommitmentEntity { CommitmentId = long.Parse(IdentifierGenerator.GenerateIdentifier(6, false)), Ukprn = ukprn, Uln = long.Parse(row["ULN"]), AccountId = employer.AccountId.ToString(), StartDate = startDate, EndDate = startDate.AddMonths(12), AgreedCost = decimal.Parse(row["agreed price"]), StandardCode = standardCode, FrameworkCode = frameworkCode, ProgrammeType = programmeType, PathwayCode = pathwayCode, Priority = 1, VersionId = 1, PaymentStatus = (int)status, PaymentStatusDescription = status.ToString(), EffectiveFrom = startDate }, EnvironmentVariables); } }