Class CaseScriptTestRunner
Case available function test runner
Inheritance
Inherited Members
Namespace: PayrollEngine.Client.Test.Case
Assembly: PayrollEngine.Client.Test.dll
Syntax
public abstract class CaseScriptTestRunner : TestRunnerBase
Constructors
CaseScriptTestRunner(PayrollHttpClient, CaseTestContext)
new instance of CaseScriptTestRunnersee
Declaration
protected CaseScriptTestRunner(PayrollHttpClient httpClient, CaseTestContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| PayrollHttpClient | httpClient | The payroll http client |
| CaseTestContext | context | The test context |
Properties
Context
The test context
Declaration
public CaseTestContext Context { get; }
Property Value
| Type | Description |
|---|---|
| CaseTestContext |
Employee
The employee
Declaration
public Employee Employee { get; }
Property Value
| Type | Description |
|---|---|
| Employee |
EvaluationDate
The evaluation date, default is now
Declaration
public DateTime? EvaluationDate { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Payroll
The payroll
Declaration
public Payroll Payroll { get; }
Property Value
| Type | Description |
|---|---|
| Payroll |
RegulationDate
The regulation date, default is now
Declaration
public DateTime? RegulationDate { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Tenant
The Tenant
Declaration
public Tenant Tenant { get; }
Property Value
| Type | Description |
|---|---|
| Tenant |
User
The user
Declaration
public User User { get; }
Property Value
| Type | Description |
|---|---|
| User |
Methods
AddCaseAsync(CaseChangeSetup)
Add new case
Declaration
protected virtual Task<CaseChange> AddCaseAsync(CaseChangeSetup caseChangeSetup)
Parameters
| Type | Name | Description |
|---|---|---|
| CaseChangeSetup | caseChangeSetup | The case setup |
Returns
| Type | Description |
|---|---|
| Task<CaseChange> | The creation result |
GetAvailableCase(string)
Get case if available
Declaration
protected CaseSet GetAvailableCase(string caseName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseName | The case name |
Returns
| Type | Description |
|---|---|
| CaseSet | The case if available, otherwise null |
GetAvailableCaseAsync(string)
Get case if available
Declaration
protected virtual Task<CaseSet> GetAvailableCaseAsync(string caseName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseName | The case name |
Returns
| Type | Description |
|---|---|
| Task<CaseSet> | The case if available, otherwise null |
GetCase(string, CaseChangeSetup)
Get case by name
Declaration
protected CaseSet GetCase(string caseName, CaseChangeSetup caseChangeSetup = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseName | The case name |
| CaseChangeSetup | caseChangeSetup | The case setup (optional) |
Returns
| Type | Description |
|---|---|
| CaseSet | The case including the case fields and related cases |
GetCaseAsync(string, CaseChangeSetup)
Get case by name async
Declaration
protected virtual Task<CaseSet> GetCaseAsync(string caseName, CaseChangeSetup caseChangeSetup = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseName | The case name |
| CaseChangeSetup | caseChangeSetup | The case setup (optional) |
Returns
| Type | Description |
|---|---|
| Task<CaseSet> | The case including the case fields and related cases |
NewFailedResult(CaseTestType, string, string, object, object)
Create new failed test result
Declaration
protected CaseScriptTestResult NewFailedResult(CaseTestType testType, string testName, string message, object expected = null, object received = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CaseTestType | testType | The case test type |
| string | testName | The test name |
| string | message | The test message |
| object | expected | The expected value |
| object | received | The received value |
Returns
| Type | Description |
|---|---|
| CaseScriptTestResult | The new failed test result |
NewResult(CaseTestType, string, string, object, object)
Create new test result
Declaration
protected CaseScriptTestResult NewResult(CaseTestType testType, string testName, string message, object expected = null, object received = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CaseTestType | testType | The case test type |
| string | testName | The test name |
| string | message | The test message |
| object | expected | The expected value |
| object | received | The received value |
Returns
| Type | Description |
|---|---|
| CaseScriptTestResult | The new test result |
NewResult(bool, CaseTestType, string, string, object, object)
Create new test result with failed condition
Declaration
protected CaseScriptTestResult NewResult(bool failed, CaseTestType testType, string testName, string message, object expected = null, object received = null)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | failed | The failed state |
| CaseTestType | testType | The case test type |
| string | testName | The test name |
| string | message | The test message |
| object | expected | The expected value |
| object | received | The received value |
Returns
| Type | Description |
|---|---|
| CaseScriptTestResult | The new test or test failed result |
NewResult(HttpRequestException, string, object)
Create new test result from http
Declaration
protected CaseScriptTestResult NewResult(HttpRequestException exception, string testName, object expected = null)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpRequestException | exception | The http request exception |
| string | testName | The test name |
| object | expected | The expected value |
Returns
| Type | Description |
|---|---|
| CaseScriptTestResult | The new test result |