Setup the database with clean tables
fixtures.SetupDatabase |
setup() |
true |
Add a CD
fixtures.CDs | ||
PhysicalID |
Title |
add() |
CD1234567890 | Beatles Greatest Hits | true |
and a customer
fixtures.Customers | ||
CustomerID | Name | add() |
C007 | James | true |
Given:
That a CD is not rented
fixtures.CDData | ||||
PhysicalID | Title | Rented | Customer ID | StartTime |
CD1234567890 | Beatles Greatest Hits | No |
and the date is
fixtures.TestDate | |
Date | set() |
1/3/10 8:00 AM | true |
When:
the CD is Checked Out:
fit.ActionFixture | ||
start | fixtures.CheckOut | |
enter | CustomerID | C007 |
enter | CDID | CD1234567890 |
press | Rent | true |
Then:
The CD is recorded as rented at the checkout time
fixtures.CDData | ||||
PhysicalID | Title | Rented | Customer ID | StartTime |
CD1234567890 | Beatles Greatest Hits | Yes | C007 | 1/3/10 8:00 AM |
and the following data is readied to be printed on the Rental Contract
fixtures.RentalContractData | |||||
CustomerID | Customer Name | PhysicalID | Title | RentalDue | check() |
C007 | James | CD1234567890 | Beatles Greatest Hits | 1/5/10 8:00 AM | true |
Given:
at a later date,
fixtures.TestDate | |
Date | set() |
1/8/10 8:00 AM | true |
When:
the CD is Checked in
fit.ActionFixture | ||
start | fixtures.CheckIn | |
enter | CDID | CD1234567890 |
press | Return | true |
Then:
the CD is recorded as not rented
fixtures.CDData | ||||
PhysicalID | Title | Rented | Customer ID | StartTime |
CD1234567890 | Beatles Greatest Hits | No |
and charge data is prepared for the charging system. (This is computed at $2 per day)
fixtures.RentalChargeData |
||||
CustomerName | Title | ReturnDate | RentalFee | check() |
James | Beatles Greatest Hits | 1/8/10 8:00 AM | $10.00 | true |
Given
fees based on categories
fixtures.CDCategoryValues | ||||
Category |
RentalDays |
BaseRentalFee | ExtraDayRentalFee | add() |
NewRelease | 1 | 2.00 | 2.00 | true |
GoldenOldie | 3 | 1.00 | 0.50 | true |
Regular | 2 | 1.50 | 1.00 | true |
NotSet | 2 | 1.00 | 1.00 | true |
When a rental is returned, then the correct rental charge is computed
fixtures.RentalFee | ||
Category | Rental Days | Rental Fee() |
NewRelease | 5 | $10.00 |
GoldenOldie | 3 | $1.00 |
Regular | 3 | $2.50 |