Click or drag to resize

ITestApi Methods

The ITestApi type exposes the following members.

Methods
  Name Description
Public method Code example CleanAll Clear all dummy data created while running the workflow unit test.
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.CleanAll();
Public method Code example 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
Public method Code example 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.
Public method 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.
Public method Code example False Verifies that an expression is false.
Example
C#
var testApi = ctx.Use<ITestApi>();
var dataObject = new JObject() { { "Role", "Admin" }};
testApi.False(dataObject["Role"].ToObject<string>() == "Admin", "Role must contain admin");
Public method Code example Get(String) Get a dummy data object from the cache. This is useful for mocking data while writing a workflow unit test.
Public method Get(String, String) Get value object by name in a workflow.
Public method Code example GetT(String) Get a dummy data object from the cache. This is useful for mocking data while writing a workflow unit test.
Public method Code example GetT(String, String) Get value by name in a workflow.
Public method Code example IsActivityCompleted Evaluate whether the activity is completed or not
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.IsActivityCompleted("workflowName", "activityName")
Public method Code example IsActivityEditable Evaluate whether the activity is editable or not
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.IsActivityEditable("workflowName", "activityName")
Public method Code example IsActivityIncluded Evaluate whether the activity is included or not
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.IsActivityIncluded("workflowName", "activityName")
Public method Code example IsFormFieldEnabled Evaluate whether the form field is enable or not
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.IsFormFieldEnabled("workflowName", "activityName", "componentName")
Public method Code example IsFormFieldReadonly Evaluate whether the form field is readonly or not
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.IsFormFieldReadonly("workflowName", "activityName", "componentName")
Public method Code example IsFormFieldRequired Evaluate whether the form field is required or not
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.IsFormFieldRequired("workflowName", "activityName", "componentName")
Public method Code example IsFormFieldVisible Evaluate whether the form field is visible or not
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.IsFormFieldVisible("workflowName", "activityName", "componentName")
Public method Code example IsWorkflowCompleted Evaluate whether the workflow is completed or not
Public method Code example New(String, String) Generate data class object and can be set to the cache
Example
C#
var testApi = ctx.Use<ITestApi>();
var data = testApi.New("TestSampleData");
Public method Code example NewT(String) Generate value primitive data types and can be set to the cache
Example
C#
var testApi = ctx.Use<ITestApi>();
testApi.New<int>("TestSampleData");
Public method OnExecuted Register an action to be invoked when the specific workflow executed.
Public method OnExecuting Register an action to be invoked when the specific workflow activity starts executing.
Public method Ref Get the data object is being referenced in a workflow.
Public method Code example Replace Replace the value in the cache. This is useful for mocking data while writing a workflow unit test.
Public method Code example Set Set a dummy data object into the cache. This is useful for mocking data while writing a workflow unit test.
Public method Code example SimulatePluginInvocation Invoke a plugin method. This method cannot work with legacy plugins.
Public method Submit Simulating form submission
Public method Code example True Verifies that an expression is true.
Example
C#
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