Caplin Trader 5.1.0

Class: module:ct-fx/testing/BusinessDateServiceFixture

module:ct-fx/testing/BusinessDateServiceFixture()

new module:ct-fx/testing/BusinessDateServiceFixture()

Constructs a BusinessDateServiceFixture.

The BusinessDateServiceFixture serves to interact with the mock business date provider by setting business dates on it.

Tests may use the BusinessDateServiceFixture in the following way:

  • dateProvider.tradeDate = '20110622' - will set tradeDate to 20110622 on mock business date provider
  • dateProvider.transactionDate = '20110622' - will set transactionDate to 20110622 on mock business date provider
  • dateProvider.settlementDate = '20110622' - will set settlementDate to 20110622 on mock business date provider
  • dateProvider.tenor = '1M' - will set tenor for a settlementDate to 1M on mock business date provider
  • dateProvider.businessDateIsValid = 'true' - will set isValidBusinessDay to true on mock business date provider
dateProvider.isValidBusinessDay is deprecated, use dateProvider.businessDateIsValid instead.
Implements:

Methods

canHandleProperty(propertyName) → {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

doGiven(propertyName, value)

This method is called in order to manipulate a property on the system under test in a given clause.

Parameters:
Name Type Description
propertyName String

The property to be changed.

value String

The new value of the property.

Implements:

doThen(propertyName, value)

This method is called in order to assert a property's value on the system under test.

Parameters:
Name Type Description
propertyName String

The property name to assert.

value String

The value to assert.

Implements:

doWhen(propertyName, value)

This method is called in order to manipulate a property on the system under test in a when clause.

Parameters:
Name Type Description
propertyName String

The property to be changed.

value String

The new value of the property.

Implements:

setBusinessDateServiceStub(oBusinessDateServiceStub)

Parameters:
Name Type Description
oBusinessDateServiceStub module:ct-fx/testing/BusinessDateServiceStub

the mock business date provider which provides simulated business dates. Required.

setUp()

This method is called just before a GWT test. This optional interface method can be implemented if the fixture is required to correctly set up the system-under-test before each test.

Implements:

tearDown()

This method is called just after a GWT test. This optional interface method can be implemented if the fixture is required to correctly tear down the system-under-test after each test or to reset any state held in the fixture's implementation.

Implements: