ITest
|
public interface ITestApi
The ITestApi type exposes the following members.
| Name | Description | |
|---|---|---|
| CleanAll |
Clear all dummy data created while running the workflow unit test.
C# var testApi = ctx.Use<ITestApi>();
testApi.CleanAll(); | |
| Create(String, String) | Create a Dummy Data Object and persist it to the database. The system will automatically clean up the data object after the test is finished | |
| Create(String, Object, String) | Persist a Data Object in the database. The system will automatically clean up the data object after the test is finished. | |
| CreateDocumentUploadSession | Create new document upload session with corresponding workflow, activity and document upload component name. This API is recommended to be called inside OnExecuting method. | |
| False |
Verifies that an expression is false.
C# var testApi = ctx.Use<ITestApi>(); var dataObject = new JObject() { { "Role", "Admin" }}; testApi.False(dataObject["Role"].ToObject<string>() == "Admin", "Role must contain admin"); | |
| Get(String) | Get a dummy data object from the cache. This is useful for mocking data while writing a workflow unit test. | |
| Get(String, String) | Get value object by name in a workflow. | |
| GetT(String) | Get a dummy data object from the cache. This is useful for mocking data while writing a workflow unit test. | |
| GetT(String, String) | Get value by name in a workflow. | |
| IsActivityCompleted |
Evaluate whether the activity is completed or not
C# var testApi = ctx.Use<ITestApi>(); testApi.IsActivityCompleted("workflowName", "activityName") | |
| IsActivityEditable |
Evaluate whether the activity is editable or not
C# var testApi = ctx.Use<ITestApi>(); testApi.IsActivityEditable("workflowName", "activityName") | |
| IsActivityIncluded |
Evaluate whether the activity is included or not
C# var testApi = ctx.Use<ITestApi>(); testApi.IsActivityIncluded("workflowName", "activityName") | |
| IsFormFieldEnabled |
Evaluate whether the form field is enable or not
C# var testApi = ctx.Use<ITestApi>(); testApi.IsFormFieldEnabled("workflowName", "activityName", "componentName") | |
| IsFormFieldReadonly |
Evaluate whether the form field is readonly or not
C# var testApi = ctx.Use<ITestApi>(); testApi.IsFormFieldReadonly("workflowName", "activityName", "componentName") | |
| IsFormFieldRequired |
Evaluate whether the form field is required or not
C# var testApi = ctx.Use<ITestApi>(); testApi.IsFormFieldRequired("workflowName", "activityName", "componentName") | |
| IsFormFieldVisible |
Evaluate whether the form field is visible or not
C# var testApi = ctx.Use<ITestApi>(); testApi.IsFormFieldVisible("workflowName", "activityName", "componentName") | |
| IsWorkflowCompleted | Evaluate whether the workflow is completed or not | |
| New(String, String) |
Generate data class object and can be set to the cache
C# var testApi = ctx.Use<ITestApi>(); var data = testApi.New("TestSampleData"); | |
| NewT(String) |
Generate value primitive data types and can be set to the cache
C# var testApi = ctx.Use<ITestApi>(); testApi.New<int>("TestSampleData"); | |
| OnExecuted | Register an action to be invoked when the specific workflow executed. | |
| OnExecuting | Register an action to be invoked when the specific workflow activity starts executing. | |
| Ref | Get the data object is being referenced in a workflow. | |
| Replace | Replace the value in the cache. This is useful for mocking data while writing a workflow unit test. | |
| Set | Set a dummy data object into the cache. This is useful for mocking data while writing a workflow unit test. | |
| SimulatePluginInvocation | Invoke a plugin method. This method cannot work with legacy plugins. | |
| Submit | Simulating form submission | |
| True |
Verifies that an expression is true.
C# var testApi = ctx.Use<ITestApi>(); var dataObject = new JObject() { { "Role", "Admin" }}; testApi.True(dataObject["Role"].ToObject<string>() == "Admin", "Role must contain admin"); |