Chapter 9. Driving Development with Customer Tests: Exposing a Failure Condition

In the previous chapter, we defined a customer test for adding and deleting a review from the database and then built the implementation accordingly. In this chapter, we enhance the AddReview Web service to prevent a reviewer from submitting multiple reviews for the same recording. When a reviewer attempts to do this, the Web service should not add the review to the database; it should return the id of the review that already exists in the database. Here is this requirement expressed as a customer test:

fit.ActionFixture

start

CustomerTests.ReviewAdapter

 

enter

FindByRecordingId

100001

enter

SetRating

4

enter

SetContent

Test Fit Content

enter

SetReviewerName

Example Reviewer

enter ...

Get Test-Driven Development in Microsoft® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.