On 12/4/06, Jeff Chastain <[EMAIL PROTECTED]> wrote:

> First is with my data access layer and the objects that sit right on top of
> Reactor.  I have an enrollment object which accepts form data from an
> enrollment application, validates that form data, then creates an
> enrollmentRecord from Reactor and saves it.  How would you test this
> type of object?

The first thing I would do is delegate validation to a separate
object. The validation object should be very simple to test. Just pass
in all the edge cases and assert that they do / do not validate.

To test functions that use the validation object, mock the validation
object and make sure that it is always called with the right
parameters. Then set up the mock validation object to always pass /
always fail and make sure that the data access layer behaves
appropriately in each case.

To test creating the enrollmentRecord you could create a mock of
Reactor. You don't have to mock out all of Reactor. If the only
function you're using is createRecord() just mock that and have it
return a MockEnrollmentRecord.

HTH,

Patrick

-- 
Patrick McElhaney
704.560.9117

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262793
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to