Hi all,
I'm trying to test my device access library, part of which is an
Exec method, taking string as a parameter, and returning string +
error code. My code is as follows:
[Test]
[Description("Testing proper device creation")]
public void TestDeviceCtor()
{
var mocks = new MockRepository();
var mockEngine = mocks.StrictMock<ICMEngine>();
using (mocks.Record())
{
mockEngine.Expect(x => x.Exec("1", "sys:cfg?
(type)")).Return(new Pair<int, string>(0, "1,CMC151,0;"));
mockEngine.Expect(x => x.Exec("1", "sys:cfg?
(hard")).Return(new Pair<int, string>(0, "1, 5, 3.300000000E+007;"));
mockEngine.Expect(x => x.Exec("1", "sys:cfg?
(firm)")).Return(new Pair<int, string>(0, "1, 4.20, 4.20;"));
mockEngine.Expect(x => x.Exec("1", "sys:cfg?
(cal)")).Return(new Pair<int, string>(0, "1,200,3,4;"));
}
using (mocks.Playback())
{
CMDevice device = new CMDevice(mockEngine, engineCfg);
}
}
now in CMDevice ctor, Exec method is called with different paramaters,
as recorded. The problem is that first call is OK, ie. returns what I
set up as expectation, but second call throws with
"ICMEngine.Exec("1", "sys:cfg?(hard)"); Expected #0, Actual #1."
I'm probably missing something, but I'm new to Rhino and I can't
figure it out myself.
Any hel would be appreciated.
Bolek.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---