Report for lv.id.jc.workcost.ZonePriceTest


Summary:

Created on Tue Oct 25 14:34:32 UTC 2022 by runner
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
Issues:

Features:

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:
zoneArea
0 OK (0)
1 OK (0)
100 OK (0)
1000000 OK (0)
2147483647 OK (0)
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:
zoneArea expenses
0 0 OK (0.004 seconds)
10 0 OK (0)
10 22.5 OK (0)
1000 99.9 OK (0)
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:
zoneArea expenses price
0 [] 0 OK (0.016 seconds)
10 [5, 10] 15 OK (0.025 seconds)
10 [22.5, 13, 27, 14] 76.5 OK (0)
90 [99.9, 0, 100.1] 200 OK (0)
120 [0.1, 0.1, 0.1] 0.3 OK (0)
5/5 passed