public UpdateProcessLevyDeclarationsSagaProgressCommandHandlerTestsFixture SetAllImportLevyDeclarationTasksCompleted() { Tasks = AccountPayeSchemes .Take(Saga.ImportPayeSchemeLevyDeclarationsTasksCount) .Select(aps => LevyDeclarationSagaTask.CreateImportPayeSchemeLevyDeclarationsTask(Saga.Id, aps.Id)) .ToList(); Db.LevyDeclarationSagaTasks.AddRange(Tasks); Db.SaveChanges(); return(this); }
public UpdateProcessLevyDeclarationsSagaProgressCommandHandlerTestsFixture SetAllTasksCompleted() { Saga.Set(s => s.ImportPayeSchemeLevyDeclarationsTasksCompleteCount, Saga.ImportPayeSchemeLevyDeclarationsTasksCount) .Set(s => s.UpdateAccountTransactionBalancesTasksCompleteCount, Saga.UpdateAccountTransactionBalancesTasksCount) .Set(s => s.IsComplete, true) .Set(s => s.Updated, Now); var importPayeSchemeLevyDeclarationsTasks = AccountPayeSchemes .Take(Saga.ImportPayeSchemeLevyDeclarationsTasksCount) .Select(aps => LevyDeclarationSagaTask.CreateImportPayeSchemeLevyDeclarationsTask(Saga.Id, aps.Id)); var updateAccountTransactionBalancesTasks = Accounts .Take(Saga.UpdateAccountTransactionBalancesTasksCount) .Select(a => LevyDeclarationSagaTask.CreateUpdateAccountTransactionBalancesTask(Saga.Id, a.Id)); Tasks = importPayeSchemeLevyDeclarationsTasks.Concat(updateAccountTransactionBalancesTasks).ToList(); Db.LevyDeclarationSagaTasks.AddRange(Tasks); Db.SaveChanges(); return(this); }