public void GivenProviderHasPreviouslyEarnedInPeriod(decimal previousAmount) { var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables(); StepDefinitionsContext.SetDefaultProvider(); var provider = StepDefinitionsContext.GetDefaultProvider(); var learner = StepDefinitionsContext.CreateLearner(15000, new DateTime(2017, 08, 01), new DateTime(2018, 07, 01)); SetupEarningsData(provider, learner); var committment = StepDefinitionsContext.ReferenceDataContext.Commitments.First(); var account = StepDefinitionsContext.ReferenceDataContext.Employers.First(x => x.Name == committment.Employer); //Save the previous earning EarningsDataHelper.SaveEarnedAmount( provider.Ukprn, committment.Id, account.AccountId, learner, "1617-R01", 08, 2017, 1, previousAmount, environmentVariables); }
public void WhenAnAgreedPriceOf(decimal agreedPrice) { //get months value var plannedCensusMonths = ScenarioContext.Current.Get <int>("plannedCensusMonths"); StepDefinitionsContext.SetDefaultProvider(); var provider = StepDefinitionsContext.GetDefaultProvider(); var startDate = new DateTime(2016, 08, 15); var ilrStartDate = startDate.NextCensusDate(); var plannedEndDate = startDate.AddMonths(plannedCensusMonths - 1).NextCensusDate(); DateTime?actualEndDate = null; if (ScenarioContext.Current.ContainsKey("actualCensusMonths")) { var actualCensusMonths = ScenarioContext.Current.Get <int>("actualCensusMonths"); int variation; if (actualCensusMonths < plannedCensusMonths) { variation = (plannedCensusMonths - actualCensusMonths) * -1; } else { variation = actualCensusMonths - plannedCensusMonths; } actualEndDate = plannedEndDate.AddMonths(variation); } var learner = StepDefinitionsContext.CreateLearner(agreedPrice, startDate, plannedEndDate, actualEndDate, Enums.CompletionStatus.Completed); // Store spec values in context StepDefinitionsContext.AddProviderLearner(provider, learner); //set a default employer StepDefinitionsContext.ReferenceDataContext.SetDefaultEmployer( new Dictionary <string, decimal> { { "All", int.MaxValue } }); // Setup reference data SetupReferenceData(); // Process months SubmitIlr(provider, ilrStartDate.GetAcademicYear(), actualEndDate ?? plannedEndDate, new ProcessService(new TestLogger())); }
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(); } }
public void GivenTheAccountHasABalance(decimal employerLevyBalance) { // Setup reference data var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables(); StepDefinitionsContext.SetDefaultProvider(); var provider = StepDefinitionsContext.GetDefaultProvider(); var learner = StepDefinitionsContext.CreateLearner(15000, new DateTime(2017, 08, 01), new DateTime(2018, 08, 08)); learner.LearningDelivery.PriceEpisodes[0].TotalPrice = 15000; learner.LearningDelivery.StandardCode = IlrBuilder.Defaults.StandardCode; //setup the data for learnig delivery,learner and earnings SetupEarningsData(provider, learner); var committment = StepDefinitionsContext.ReferenceDataContext.Commitments.First(); var account = StepDefinitionsContext.ReferenceDataContext.Employers.First(x => x.Name == committment.Employer); //Update the balance to the value passed in AccountDataHelper.UpdateAccountBalance(account.AccountId, employerLevyBalance, environmentVariables); }