...
The old way:
Code Block | ||||
---|---|---|---|---|
| ||||
[Test]
public void MyOldTest()
{
// Record your expectations here
Expect.Call(myObject.MyProperty).Return(1);
mocks.ReplayAll();
// do your work here
int i = myObject.MyProperty;
// check you values
mocks.VerifyAll();
Assert.AreEqual(1, i);
}
|
The new way:
Code Block |
---|
[Test]
public void MyNewTest()
{
// Record your expectations here
using ( mocks.Record() )
{
Expect.Call(myObject.MyProperty).Return(1);
}
// do your work here
int i;
using ( mocks.Playback() )
{
i = myObject.MyProperty;
}
// check you values
Assert.AreEqual(1, i);
}
|