@@ -12,9 +12,6 @@ namespace PayrollEngine.Client.Test.Payrun;
1212/// <summary>Payrun employee test runner</summary>
1313public class PayrunEmployeeTestRunner : PayrunTestRunnerBase
1414{
15- /// <summary>The delay between creation and test</summary>
16- public int DelayBetweenCreateAndTest { get ; set ; }
17-
1815 /// <summary>The employee test mode</summary>
1916 public IScriptParser ScriptParser { get ; }
2017
@@ -27,17 +24,15 @@ public class PayrunEmployeeTestRunner : PayrunTestRunnerBase
2724 /// <summary>Initializes a new instance of the <see cref="PayrunEmployeeTestRunner"/> class</summary>
2825 /// <param name="httpClient">The payroll engine http client</param>
2926 /// <param name="scriptParser">The script parser</param>
30- /// <param name="owner">The test owner</param>
31- /// <param name="testPrecision">The testing precision</param>
27+ /// <param name="settings">The test settings</param>
3228 /// <param name="employeeMode">The test running mode</param>
33- /// <param name="resultMode">The test result mode (default: clean)</param>
3429 /// <param name="runMode">The employee test mode</param>
35- public PayrunEmployeeTestRunner ( PayrollHttpClient httpClient , IScriptParser scriptParser ,
36- TestPrecision testPrecision = TestPrecision . TestPrecision2 , string owner = null ,
30+ public PayrunEmployeeTestRunner ( PayrollHttpClient httpClient ,
31+ IScriptParser scriptParser ,
32+ PayrunTestSettings settings ,
3733 EmployeeTestMode employeeMode = EmployeeTestMode . InsertEmployee ,
38- TestResultMode resultMode = TestResultMode . CleanTest ,
3934 TestRunMode runMode = TestRunMode . RunTests ) :
40- base ( httpClient , testPrecision , resultMode , owner )
35+ base ( httpClient , settings )
4136 {
4237 ScriptParser = scriptParser ?? throw new ArgumentNullException ( nameof ( scriptParser ) ) ;
4338 EmployeeMode = employeeMode ;
@@ -50,7 +45,7 @@ public PayrunEmployeeTestRunner(PayrollHttpClient httpClient, IScriptParser scri
5045 public override async Task < Dictionary < Tenant , List < PayrollTestResult > > > TestAllAsync ( Model . Exchange exchange )
5146 {
5247 // apply owner
53- ApplyOwner ( exchange , Owner ) ;
48+ ApplyOwner ( exchange , Settings . Owner ) ;
5449
5550 var results = new Dictionary < Tenant , List < PayrollTestResult > > ( ) ;
5651 try
@@ -77,12 +72,6 @@ public override async Task<Dictionary<Tenant, List<PayrollTestResult>>> TestAllA
7772 continue ;
7873 }
7974
80- // all payrun jobs should be executed
81- if ( DelayBetweenCreateAndTest > 0 )
82- {
83- Task . Delay ( DelayBetweenCreateAndTest ) . Wait ( ) ;
84- }
85-
8675 // test results
8776 var payrunJobResult = await TestPayrunJobAsync ( tenant , JobResultMode . Multiple ) ;
8877 results . Add ( tenant , payrunJobResult . ToList ( ) ) ;
@@ -196,7 +185,7 @@ protected virtual async Task DuplicateTestEmployees(int tenantId, ExchangeTenant
196185 /// <param name="tenantResults">Results</param>
197186 protected virtual async Task CleanupEmployees ( Dictionary < Tenant , List < PayrollTestResult > > tenantResults )
198187 {
199- if ( ResultMode == TestResultMode . KeepTest )
188+ if ( Settings . ResultMode == TestResultMode . KeepTest )
200189 {
201190 return ;
202191 }
@@ -208,7 +197,7 @@ protected virtual async Task CleanupEmployees(Dictionary<Tenant, List<PayrollTes
208197 foreach ( var result in tenantResult . Value )
209198 {
210199 // keep failed
211- if ( ResultMode == TestResultMode . KeepFailedTest && result . Failed )
200+ if ( Settings . ResultMode == TestResultMode . KeepFailedTest && result . Failed )
212201 {
213202 continue ;
214203 }
@@ -223,9 +212,9 @@ protected virtual async Task CleanupEmployees(Dictionary<Tenant, List<PayrollTes
223212
224213 try
225214 {
226- await DeleteEmployeeAsync ( tenantId , employeeId ) ;
227- // update delete history
228- deleteEmployeeIds . Add ( employeeId ) ;
215+ await DeleteEmployeeAsync ( tenantId , employeeId ) ;
216+ // update delete history
217+ deleteEmployeeIds . Add ( employeeId ) ;
229218 }
230219 catch ( Exception exception )
231220 {
0 commit comments