Executed features | Passed | Failures | Errors | Skipped | Success rate | Time |
---|---|---|---|---|---|---|
13 | 13 | 0 | 0 | 0 | 100.0% | 0.149 seconds |
Project Customer evaluates the balance of funds
As the customer of the project I want to estimate the balance of available funds So that I be able to adjust the estimate if necessary
should calculate zero balance when no assignments
Return
(0.003 seconds)
|
|||||||||||||||||||||
When:
|
we have no assignments
|
||||||||||||||||||||
def fundValuation = FundValuation.of() |
|||||||||||||||||||||
Then:
|
we get zero fund balance
|
||||||||||||||||||||
fundValuation.fundBalance() == 0 |
|||||||||||||||||||||
should calculate balance when one senior worker with one wall assignment
Return
(0.009 seconds)
|
|||||||||||||||||||||
Given:
|
one senior worker
|
||||||||||||||||||||
def painter = new SeniorWorker(Payment.of(rate), Performance.of(amountPerDay)) |
|||||||||||||||||||||
And:
|
one zone with a rectangle surface and some apertures
|
||||||||||||||||||||
def surface = Surface.rectangle(width, height) def zone = zoneFactory.create(type, surface - apertures) |
|||||||||||||||||||||
And:
|
one assignment with one zone for that worker
|
||||||||||||||||||||
def assigment = painter.assign(zone, VendorBonus.of(bonus)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
Then:
|
we can accurate calculate fund balance
|
||||||||||||||||||||
fundValuation.fundBalance() == expected |
|||||||||||||||||||||
Where:
|
surface sides, zone type, vendor bonus and worker characteristics
|
||||||||||||||||||||
Examples:
|
|
||||||||||||||||||||
should calculate balance when one senior worker with one wall assignment with big vendor bonus
Return
(0)
|
|||||||||||||||||||||
Given:
|
one senior worker
|
||||||||||||||||||||
def painter = new SeniorWorker(Payment.of(rate), Performance.of(amountPerDay)) |
|||||||||||||||||||||
And:
|
one zone with a rectangle surface and some apertures
|
||||||||||||||||||||
def surface = Surface.rectangle(width, height) def zone = zoneFactory.create(type, surface - apertures) |
|||||||||||||||||||||
And:
|
one assignment with one zone for that worker
|
||||||||||||||||||||
def assigment = painter.assign(zone, VendorBonus.of(bonus)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
Then:
|
we can accurate calculate fund balance
|
||||||||||||||||||||
fundValuation.fundBalance() == expected |
|||||||||||||||||||||
Where:
|
surface sides, zone type, vendor bonus and worker characteristics
|
||||||||||||||||||||
Examples:
|
|
||||||||||||||||||||
should calculate balance when one senior worker with one big wall with aperture assignment
Return
(0)
|
|||||||||||||||||||||
Given:
|
one senior worker
|
||||||||||||||||||||
def painter = new SeniorWorker(Payment.of(rate), Performance.of(amountPerDay)) |
|||||||||||||||||||||
And:
|
one zone with a rectangle surface and some apertures
|
||||||||||||||||||||
def surface = Surface.rectangle(width, height) def zone = zoneFactory.create(type, surface - apertures) |
|||||||||||||||||||||
And:
|
one assignment with one zone for that worker
|
||||||||||||||||||||
def assigment = painter.assign(zone, VendorBonus.of(bonus)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
Then:
|
we can accurate calculate fund balance
|
||||||||||||||||||||
fundValuation.fundBalance() == expected |
|||||||||||||||||||||
Where:
|
surface sides, zone type, vendor bonus and worker characteristics
|
||||||||||||||||||||
Examples:
|
|
||||||||||||||||||||
should calculate balance when one senior worker with one floor assignment
Return
(0)
|
|||||||||||||||||||||
Given:
|
one senior worker
|
||||||||||||||||||||
def painter = new SeniorWorker(Payment.of(rate), Performance.of(amountPerDay)) |
|||||||||||||||||||||
And:
|
one zone with a rectangle surface and some apertures
|
||||||||||||||||||||
def surface = Surface.rectangle(width, height) def zone = zoneFactory.create(type, surface - apertures) |
|||||||||||||||||||||
And:
|
one assignment with one zone for that worker
|
||||||||||||||||||||
def assigment = painter.assign(zone, VendorBonus.of(bonus)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
Then:
|
we can accurate calculate fund balance
|
||||||||||||||||||||
fundValuation.fundBalance() == expected |
|||||||||||||||||||||
Where:
|
surface sides, zone type, vendor bonus and worker characteristics
|
||||||||||||||||||||
Examples:
|
|
||||||||||||||||||||
should calculate balance when one senior worker with one ceiling assignment
Return
(0)
|
|||||||||||||||||||||
Given:
|
one senior worker
|
||||||||||||||||||||
def painter = new SeniorWorker(Payment.of(rate), Performance.of(amountPerDay)) |
|||||||||||||||||||||
And:
|
one zone with a rectangle surface and some apertures
|
||||||||||||||||||||
def surface = Surface.rectangle(width, height) def zone = zoneFactory.create(type, surface - apertures) |
|||||||||||||||||||||
And:
|
one assignment with one zone for that worker
|
||||||||||||||||||||
def assigment = painter.assign(zone, VendorBonus.of(bonus)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
Then:
|
we can accurate calculate fund balance
|
||||||||||||||||||||
fundValuation.fundBalance() == expected |
|||||||||||||||||||||
Where:
|
surface sides, zone type, vendor bonus and worker characteristics
|
||||||||||||||||||||
Examples:
|
|
||||||||||||||||||||
should calculate balance when one senior worker with one small ceiling assignment
Return
(0)
|
|||||||||||||||||||||
Given:
|
one senior worker
|
||||||||||||||||||||
def painter = new SeniorWorker(Payment.of(rate), Performance.of(amountPerDay)) |
|||||||||||||||||||||
And:
|
one zone with a rectangle surface and some apertures
|
||||||||||||||||||||
def surface = Surface.rectangle(width, height) def zone = zoneFactory.create(type, surface - apertures) |
|||||||||||||||||||||
And:
|
one assignment with one zone for that worker
|
||||||||||||||||||||
def assigment = painter.assign(zone, VendorBonus.of(bonus)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
Then:
|
we can accurate calculate fund balance
|
||||||||||||||||||||
fundValuation.fundBalance() == expected |
|||||||||||||||||||||
Where:
|
surface sides, zone type, vendor bonus and worker characteristics
|
||||||||||||||||||||
Examples:
|
|
||||||||||||||||||||
should calculate balance when one worker with two ceiling assignment
Return
(0.007 seconds)
|
|||||||||||||||||||||
Given:
|
one senior worker
|
||||||||||||||||||||
def painter = new SeniorWorker(Payment.of(200), Performance.of(30)) |
|||||||||||||||||||||
And:
|
two ceiling assignment
|
||||||||||||||||||||
def zone1 = zoneFactory.create("Ceiling", Surface.rectangle(2, 5)) def zone2 = zoneFactory.create("Ceiling", Surface.rectangle(3, 5)) def assigment = new Assignment(painter, Zones.of(zone1, zone2), VendorBonus.of(50)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
And:
|
calculate balance
|
||||||||||||||||||||
def balance = fundValuation.fundBalance() |
|||||||||||||||||||||
Then:
|
we get expected fund balance
|
||||||||||||||||||||
balance == 235 |
|||||||||||||||||||||
should calculate balance when one junior worker with one ceiling assignment and #comment
Return
(0.001 seconds)
|
|||||||||||||||||||||
Given:
|
one junior worker
|
||||||||||||||||||||
def junior = new JuniorWorker(Payment.of(200), Performance.of(30)) |
|||||||||||||||||||||
And:
|
one ceiling assignment
|
||||||||||||||||||||
def zone = zoneFactory.create("Ceiling", Surface.square(5.0)) def assigment = new Assignment(junior, zone, VendorBonus.of(bonus)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
And:
|
calculate balance
|
||||||||||||||||||||
def balance = fundValuation.fundBalance() |
|||||||||||||||||||||
Then:
|
we get expected result
|
||||||||||||||||||||
balance == expected |
|||||||||||||||||||||
Examples:
|
|
2/2 passed
|
|||||||||||||||||||
should calculate balance when one #worker with one ceiling assignment
Return
(0)
|
|||||||||||||||||||||
Given:
|
one ceiling assignment
|
||||||||||||||||||||
def zone = zoneFactory.create("Ceiling", Surface.square(5)) def assigment = new Assignment(painter, Zones.of(zone), VendorBonus.of(50)) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
And:
|
calculate balance
|
||||||||||||||||||||
def balance = fundValuation.fundBalance() |
|||||||||||||||||||||
Then:
|
we get expected result
|
||||||||||||||||||||
balance == expected |
|||||||||||||||||||||
Where:
|
worker defined as
|
||||||||||||||||||||
Examples:
|
|
2/2 passed
|
|||||||||||||||||||
should calculate balance when one worker with one wall assignment #comment
Return
(0.002 seconds)
|
|||||||||||||||||||||
Given:
|
one senior worker
|
||||||||||||||||||||
def senior = new SeniorWorker(Payment.of(250), Performance.of(amountPerDay)) |
|||||||||||||||||||||
And:
|
one wall assignment
|
||||||||||||||||||||
def workScope = zoneFactory.create("Wall", surface) def assigment = senior.assign(workScope, VendorBonus.of(50)) |
|||||||||||||||||||||
When:
|
we create a work estimate with this assignment
|
||||||||||||||||||||
def fundValuation = FundValuation.of(assigment) |
|||||||||||||||||||||
Then:
|
we get expected fund balance
|
||||||||||||||||||||
fundValuation.fundBalance() == expected |
|||||||||||||||||||||
Examples:
|
|
3/3 passed
|
|||||||||||||||||||
should calculate balance when two workers with one wall assignment
Return
(0.002 seconds)
|
|||||||||||||||||||||
Given:
|
two senior workers
|
||||||||||||||||||||
def highDailyRate = Payment.of(250) def ordinaryPerformance = Performance.of(30) def john = new SeniorWorker(highDailyRate, ordinaryPerformance) def mike = new SeniorWorker(highDailyRate, ordinaryPerformance) |
|||||||||||||||||||||
And:
|
one wall zone
|
||||||||||||||||||||
def zone = zoneFactory.create("Wall", Surface.square(5)) |
|||||||||||||||||||||
And:
|
two wall assignments
|
||||||||||||||||||||
def johnAssigment = new Assignment(john, zone, VENDOR_BONUS) def mikeAssigment = new Assignment(mike, zone, VENDOR_BONUS) |
|||||||||||||||||||||
When:
|
we create a fund valuation with this assignments
|
||||||||||||||||||||
def fundValuation = FundValuation.of(johnAssigment, mikeAssigment) |
|||||||||||||||||||||
And:
|
calculate balance
|
||||||||||||||||||||
def balance = fundValuation.fundBalance() |
|||||||||||||||||||||
Then:
|
we get expected result
|
||||||||||||||||||||
balance == 500 |
|||||||||||||||||||||
should calculate balance for complex testcase
Return
(0.003 seconds)
|
|||||||||||||||||||||
Given:
|
several workers
|
||||||||||||||||||||
def liam = new SeniorWorker(Payment.of(250), Performance.of(40)) def jack = new JuniorWorker(Payment.of(200), Performance.of(30)) def owen = new SeniorWorker(Payment.of(280), Performance.of(60)) |
|||||||||||||||||||||
And:
|
def apertures = Surface.rectangle(9, 5).plus(Surface.rectangle(9, 4)) |
||||||||||||||||||||
And:
|
def zone1 = zoneFactory.create("Floor", Surface.rectangle(5, 3)) def zone2 = zoneFactory.create("Wall", Surface.square(10)) def zone3 = zoneFactory.create("Ceiling", Surface.square(5)) def zone4 = zoneFactory.create("Wall", Surface.square(10) - apertures) def zone5 = zoneFactory.create("Wall", Surface.rectangle(1, 5)) def zone6 = zoneFactory.create("Wall", Surface.rectangle(11, 5)) |
||||||||||||||||||||
And:
|
def liamAssigment = liam.assign(Zones.of(zone1, zone2), BIG_VENDOR_BONUS) def jackAssigment = jack.assign(Zones.of(zone3, zone4), VENDOR_BONUS) def owenAssigment = owen.assign(Zones.of(zone5, zone6), VENDOR_BONUS) |
||||||||||||||||||||
When:
|
we create a fund valuation with this assignments
|
||||||||||||||||||||
def fundValuation = FundValuation.of(liamAssigment, jackAssigment, jackAssigment, owenAssigment) |
|||||||||||||||||||||
And:
|
calculate balance
|
||||||||||||||||||||
def actual = fundValuation.fundBalance() |
|||||||||||||||||||||
Then:
|
we get expected result
|
||||||||||||||||||||
actual == expected |
|||||||||||||||||||||
Where:
|
expected fund balance
|
||||||||||||||||||||
Examples:
|
|
1/1 passed
|