|
From: Owen R. <OR...@th...> - 2004-07-03 11:37:14
|
hi paul, what sort of problem do you receive from nmock when you try to do this? AFAIK, there is nothing stopping you from calling Verify as many times as you like. why is it important to reset the expectations? is there any problem with just accumulating them until the end of the test? cheers, owen. --- R. Owen Rogers ThoughtWorks Technologies (India) Pvt Ltd. ThoughtWorks - Deliver with passion! ThoughtWorks is always looking for talented people who are passionate about technology. To find out more about a career at ThoughtWorks go to http://www.thoughtworks.com/career/. "Paul Brousseau" <Pau...@vi...> 03/07/2004 00:03 To: <jo...@th...>, <cst...@th...>, <or...@th...> cc: Subject: NMock Hello! I'm using NMock for a project, and I need it to do something that it doesn't appear to do at the moment. I would like to be able to set up a dynamic mock and do several tests with it in a row, resetting the expectactions each time. A stripped down example: mockPageView.Expect("ZoomToFullPage"); controller.UndoZoom(); // Do assertions of zoom depth. mockPageView.Verify(); mockPageView.Expect("ZoomToRectangle"); controller.ZoomToRectangle(new RectangleF(0, 0, 5f, 5f)); // Do assertions of zoom depth. mockPageView.Verify(); mockPageView.Expect("ZoomToFullPage"); controller.UndoZoom(); // Do assertions of zoom depth. mockPageView.Verify(); mockPageView.Expect("ZoomToRectangle"); mockPageView.Expect("ZoomToFullPage"); controller.ZoomToRectangle(new RectangleF(0, 0, 5f, 5f)); controller.ZoomToFullPage(); // Do assertions of zoom depth. mockPageView.Verify(); This would all be in one logical unit test, as I'm interested in verifying a certain sequence of events (and related properties), but I want to make sure everything is going as planned along the way. I would like Verify to clear the expectactions, OR make an explicit call to clear them. I didn't see anything like this on the roadmap. Are there plans? If not, does this seem like the kind of thing that a reasonably clever engineer (myself) could hack up in day, without having previous expirience with the source? And if so, would you accept a contribution back? Thanks! |