Click or drag to resize

ITestApi Methods

The ITestApi type exposes the following members.

Methods
  NameDescription
Public methodCode exampleCleanAll
Clear all dummy data created while running the workflow unit test.
Examples
var testApi = ctx.Use<ITestApi>();
testApi.CleanAll();
Public methodCode exampleCreate(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
Public methodCode exampleCreate(String, Object, String)
Persist a Data Object in the database. The system will automatically clean up the data object after the test is finished.
Public methodCreateDocumentUploadSession
Create new document upload session with corresponding workflow, activity and document upload component name. This API is recommended to be called inside OnExecuting method.
Public methodCode exampleFalse
Verifies that an expression is false.
Examples
var testApi = ctx.Use<ITestApi>();
var dataObject = new JObject() { { "Role", "Admin" }};
testApi.False(dataObject["Role"].ToObject<string>() == "Admin", "Role must contain admin");
Public methodCode exampleGet(String)
Get a dummy data object from the cache. This is useful for mocking data while writing a workflow unit test.
Public methodGet(String, String)
Get value object by name in a workflow.
Public methodCode exampleGetT(String)
Get a dummy data object from the cache. This is useful for mocking data while writing a workflow unit test.
Public methodCode exampleGetT(String, String)
Get value by name in a workflow.
Public methodCode exampleIsActivityCompleted
Evaluate whether the activity is completed or not
Examples
var testApi = ctx.Use<ITestApi>();
testApi.IsActivityCompleted("workflowName", "activityName")
Public methodCode exampleIsActivityEditable
Evaluate whether the activity is editable or not
Examples
var testApi = ctx.Use<ITestApi>();
testApi.IsActivityEditable("workflowName", "activityName")
Public methodCode exampleIsActivityIncluded
Evaluate whether the activity is included or not
Examples
var testApi = ctx.Use<ITestApi>();
testApi.IsActivityIncluded("workflowName", "activityName")
Public methodCode exampleIsFormFieldEnabled
Evaluate whether the form field is enable or not
Examples
var testApi = ctx.Use<ITestApi>();
testApi.IsFormFieldEnabled("workflowName", "activityName", "componentName")
Public methodCode exampleIsFormFieldReadonly
Evaluate whether the form field is readonly or not
Examples
var testApi = ctx.Use<ITestApi>();
testApi.IsFormFieldReadonly("workflowName", "activityName", "componentName")
Public methodCode exampleIsFormFieldRequired
Evaluate whether the form field is required or not
Examples
var testApi = ctx.Use<ITestApi>();
testApi.IsFormFieldRequired("workflowName", "activityName", "componentName")
Public methodCode exampleIsFormFieldVisible
Evaluate whether the form field is visible or not
Examples
var testApi = ctx.Use<ITestApi>();
testApi.IsFormFieldVisible("workflowName", "activityName", "componentName")
Public methodCode exampleIsWorkflowCompleted
Evaluate whether the workflow is completed or not
Public methodCode exampleNew(String, String)
Generate data class object and can be set to the cache
Examples
var testApi = ctx.Use<ITestApi>();
var data = testApi.New("TestSampleData");
Public methodCode exampleNewT(String)
Generate value primitive data types and can be set to the cache
Examples
var testApi = ctx.Use<ITestApi>();
testApi.New<int>("TestSampleData");
Public methodOnExecuted
Register an action to be invoked when the specific workflow executed.
Public methodOnExecuting
Register an action to be invoked when the specific workflow activity starts executing.
Public methodRef
Get the data object is being referenced in a workflow.
Public methodCode exampleReplace
Replace the value in the cache. This is useful for mocking data while writing a workflow unit test.
Public methodCode exampleSet
Set a dummy data object into the cache. This is useful for mocking data while writing a workflow unit test.
Public methodCode exampleSimulatePluginInvocation
Invoke a plugin method. This method cannot work with legacy plugins.
Public methodSubmit
Simulating form submission
Public methodCode exampleTrue
Verifies that an expression is true.
Examples
var testApi = ctx.Use<ITestApi>();
var dataObject = new JObject() { { "Role", "Admin" }};
testApi.True(dataObject["Role"].ToObject<string>() == "Admin", "Role must contain admin");
Top
See Also