I have found the problem!!!!!
It is so simple, but so easy to miss!
If you had have run the tests I posted, it would also have failed for
you.
So, it is nothing to do with it not working on my machine, but it is
all about the actual code being tested! Curious...?
Well Have a look at these two tests:
[TestFixture]
public class TestMocking
{
[Test]
public void Test_ThisWorks()
{
IBob bob = MockRepository.GenerateStub<IBob>();
bob.AssertWasNotCalled(bob1 => bob1.Action());
}
[Test]
public void Test_ThisDoesntWork()
{
IBob bob = MockRepository.GenerateStub<IBob>();
bob.AssertWasNotCalled(bob1 => bob.Action());
}
}
public interface IBob
{
void Action();
}
The one works, but the other doesn't... Do you spot the difference?
:)... Dramatic pause...
The second test refers to the outside variable in the lambda instead
of the parameter!
That's it. That is why it is failing! So simple, but so easy to miss.
The reason why it worked on other PCs is because I just typed out the
tests again there instead of copy pasting the code (I was being lazy,
ok).
But this does bring me to that error message:
"No expectations were setup to be verified, ensure that the method
call in the action is a virtual (C#) / overridable (VB.Net) method
call"
It really throws you doesn't it! Well, for me it does.
Would it not be a good thing to add a check on the lambda expression
to see if it calls a method on the actual parameter passed in anywhere
in the lambda.
Or does it not use lambda expressions for this...
Anyway. Problem solved. I don't need to reformat my PC anymore (maybe
just my mind...).
Shot for your efforts.
-Mark
On Aug 27, 2:49 pm, Tim Barcz <
timba...@gmail.com> wrote:
> Ah ok ok... So you were in VS 2010? I can run then on my machine as well
>