From: <joe...@us...> - 2002-11-15 22:31:14
|
Update of /cvsroot/nmock/nmock/sample/order In directory usw-pr-cvs1:/tmp/cvs-serv30242/sample/order Modified Files: OrderProcessorTest.cs Log Message: - Added sensible error messages - Renamed IMock.Object to IMock.MockInstance - Renamed Conditions to Constraints and moved to new namespace. - Renamed eval() to Eval() (.NET conventions). - Renamed IMock.SetValue() to IMock.SetupResult (as in Java MockObjects). Index: OrderProcessorTest.cs =================================================================== RCS file: /cvsroot/nmock/nmock/sample/order/OrderProcessorTest.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** OrderProcessorTest.cs 10 Nov 2002 16:32:27 -0000 1.1.1.1 --- OrderProcessorTest.cs 15 Nov 2002 22:31:09 -0000 1.2 *************** *** 29,36 **** // setup mock Order and populate with default return values. order = new DynamicMock(typeof(Order)); ! order.SetValue("Amount", 1002.0); ! order.SetValue("Urgent", false); ! order.SetValue("Number", 123); ! order.SetValue("User", "joe"); // create mock Notifier --- 29,36 ---- // setup mock Order and populate with default return values. order = new DynamicMock(typeof(Order)); ! order.SetupResult("Amount", 1002.0); ! order.SetupResult("Urgent", false); ! order.SetupResult("Number", 123); ! order.SetupResult("User", "joe"); // create mock Notifier *************** *** 41,45 **** // switch the OrderProcessor to use the mock Notifier ! orderProcessor.notifier = (Notifier)notifier.Object; } --- 41,45 ---- // switch the OrderProcessor to use the mock Notifier ! orderProcessor.notifier = (Notifier)notifier.MockInstance; } *************** *** 51,55 **** // execute ! orderProcessor.Process((Order)order.Object); // verify --- 51,55 ---- // execute ! orderProcessor.Process((Order)order.MockInstance); // verify *************** *** 61,70 **** { // setup ! order.SetValue("Number", 456); ! order.SetValue("User", "chris"); notifier.Expect("NotifyUser", "chris", "Order 456 has been dispatched"); // execute ! orderProcessor.Process((Order)order.Object); // verify --- 61,70 ---- { // setup ! order.SetupResult("Number", 456); ! order.SetupResult("User", "chris"); notifier.Expect("NotifyUser", "chris", "Order 456 has been dispatched"); // execute ! orderProcessor.Process((Order)order.MockInstance); // verify *************** *** 76,83 **** { // setup ! order.SetValue("Amount", 999.0); // execute ! orderProcessor.Process((Order)order.Object); // verify --- 76,83 ---- { // setup ! order.SetupResult("Amount", 999.0); // execute ! orderProcessor.Process((Order)order.MockInstance); // verify *************** *** 89,98 **** { // setuo ! order.SetValue("Urgent", true); notifier.Expect("NotifyUser", "joe", "Order 123 has been dispatched"); notifier.Expect("NotifyAdmin", "Order 123 needs to be urgently dispatched to joe"); // execute ! orderProcessor.Process((Order)order.Object); // verify --- 89,98 ---- { // setuo ! order.SetupResult("Urgent", true); notifier.Expect("NotifyUser", "joe", "Order 123 has been dispatched"); notifier.Expect("NotifyAdmin", "Order 123 needs to be urgently dispatched to joe"); // execute ! orderProcessor.Process((Order)order.MockInstance); // verify *************** *** 104,112 **** { // setup ! order.SetValue("Amount", 999.0); ! order.SetValue("Urgent", true); // execute ! orderProcessor.Process((Order)order.Object); // verify --- 104,112 ---- { // setup ! order.SetupResult("Amount", 999.0); ! order.SetupResult("Urgent", true); // execute ! orderProcessor.Process((Order)order.MockInstance); // verify |