Executed features | Passed | Failures | Errors | Skipped | Success rate | Time |
---|---|---|---|---|---|---|
3 | 3 | 0 | 0 | 0 | 100.0% | 0.089 seconds |
Project Customer calculates the price of the zone
As the customer of the project I want to calculate all costs per zone So that I be able to calculate the price of processing the zone
should return zero if there is no any processing cost
Return
(0)
|
|||||||||||||||||||||||||
Given:
|
surface for processing with a given area
|
||||||||||||||||||||||||
surface.area() >> zoneArea |
|||||||||||||||||||||||||
When:
|
we do not have any costs associated with the processing of the zone
|
||||||||||||||||||||||||
def zonePrice = ZonePrice.of() |
|||||||||||||||||||||||||
Then:
|
we always get zero cost of work
|
||||||||||||||||||||||||
zonePrice.apply(surface) == 0 |
|||||||||||||||||||||||||
Where:
|
the surface area of the zone can be of any size
|
||||||||||||||||||||||||
Examples:
|
|
5/5 passed
|
|||||||||||||||||||||||
should calculate the costs for the zone with one item of expenditure
Return
(0.004 seconds)
|
|||||||||||||||||||||||||
Given:
|
surface for processing with a given area
|
||||||||||||||||||||||||
surface.area() >> zoneArea |
|||||||||||||||||||||||||
And:
|
one item of expenses for processing the zone
|
||||||||||||||||||||||||
def expenditure = Stub(PriceFunction) { apply(surface) >> expenses } |
|||||||||||||||||||||||||
When:
|
zone treatment price consists of only one expense item
|
||||||||||||||||||||||||
def zonePrice = ZonePrice.of(expenditure) |
|||||||||||||||||||||||||
Then:
|
we always get zero cost of work
|
||||||||||||||||||||||||
zonePrice.apply(surface) == expenses |
|||||||||||||||||||||||||
Where:
|
the surface area of the zone can be of any size
|
||||||||||||||||||||||||
Examples:
|
|
4/4 passed
|
|||||||||||||||||||||||
should calculate the costs for the zone with several items of expenditure
Return
(0.041 seconds)
|
|||||||||||||||||||||||||
Given:
|
surface for processing with a given area
|
||||||||||||||||||||||||
surface.area() >> zoneArea |
|||||||||||||||||||||||||
And:
|
several items of expenses for processing the zone
|
||||||||||||||||||||||||
def expenditure = expenses.collect({ cost -> Stub(PriceFunction) { apply(surface) >> cost } }) as PriceFunction[] |
|||||||||||||||||||||||||
When:
|
zone treatment price consists of all expenses
|
||||||||||||||||||||||||
def zonePrice = ZonePrice.of(expenditure) |
|||||||||||||||||||||||||
Then:
|
we get an accurately calculated zone treatment price
|
||||||||||||||||||||||||
zonePrice.apply(surface) == price |
|||||||||||||||||||||||||
Examples:
|
|
5/5 passed
|