new module:ct-services /testing /Connection Service Fixture()
Constructs a ConnectionServiceFixture
.
The ConnectionServiceFixture
serves to create a mocking interface for a ConnectionSevice
to enable tests to simulate connection status changes as follows:
given(PM shows connection-down message)
when('connection.statusChanged => ['OK', 'Liberator has connected']')
then(PM no longer shows connection-down message)
The ConnectionServiceFixture
possible values are OK, ERROR or LIMITED
- Implements:
Methods
can Handle Property(property Name) → {Boolean}
This method is called by the GWTTestRunner to check whether a property used in a GWT test is supported by the fixture.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
String | the property name to check. |
- Implements:
Returns:
true if the fixture handles the property; false otherwise.
- Type
- Boolean
do Given(property Name, value)
This method enables the fixture to trigger the stub to simulate a connection status change event with the property 'statusChanged' and value set to an array containing the connection status value to be set as the first element and any reasons for the status change as further elements. eg ['OK', 'Connected to Liberator', 'All services are available'].
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
String | The property name |
value |
Variant | The value to check. |
- Implements:
- See:
do Then(property Name, value)
ConnectionServiceFixture does not support any properties with doThen.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
String | The property name |
value |
Variant | The value to set |
- Implements:
- See:
do When(property Name, value)
This method enables the fixture to trigger the stub to simulate a connection status change event with the property 'statusChanged' and value set to the connection status value to be set.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
String | The property name |
value |
Variant | The value to set |
- Implements:
- See:
set Connection Service Stub(oConnection Service Stub)
Sets the stub to be used as the connection service provider.
Parameters:
Name | Type | Description |
---|---|---|
oConnectionServiceStub |
module:ct-services |
the mock connection status provider to simulate connection up/down events. |