[TestFixture]
public class TestMocking
{
       [Test]
       public void Test_AssertWasNotCalled_ShouldWork()
       {
               var bob = MockRepository.GenerateMock<IBob>();
               bob.AssertWasNotCalled(o => o.Action());
       }
}

Can you try that?


Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Tue, Aug 24, 2010 at 3:30 AM, Mark Whitfeld <[email protected]>wrote:

> OK, I'm so stumped about this one!
> I have been using Rhino Mocks for years and it has never given me
> problems.
> I run the following simple code and it gives this error message:
>
> (on the line with AssertWasNotCalled)
> System.InvalidOperationException : No expectations were setup to be
> verified, ensure that the method call in the action is a virtual
> (C#) / overridable (VB.Net) method call
>
> Stack Trace:
> at Rhino.Mocks.RhinoMocksExtensions.AssertExactlySingleExpectaton[T]
> (MockRepository mocks, T mockToRecordExpectation)
> at Rhino.Mocks.RhinoMocksExtensions.GetExpectationsToVerify[T](T mock,
> Action`1 action, Action`1 setupConstraints)
> at Rhino.Mocks.RhinoMocksExtensions.AssertWasNotCalled[T](T mock,
> Action`1 action, Action`1 setupConstraints)
> at Rhino.Mocks.RhinoMocksExtensions.AssertWasNotCalled[T](T mock,
> Action`1 action)
> at Habanero.Templates.Test.Processor.TestMocking.Test_ShouldWork()
>
> Here is the code (I know its testing the mocking framework, that's the
> point):
>
> [TestFixture]
> public class TestMocking
> {
>        [Test]
>        public void Test_AssertWasNotCalled_ShouldWork()
>        {
>                var bob = MockRepository.GenerateStub<IBob>();
>                bob.AssertWasNotCalled(o => o.Action());
>        }
> }
>
> public interface IBob
> {
>        void Action();
> }
>
> The project is compiled for AnyCPU (and I have tried all the others)
> and .NET 3.5.
> This fails on my PC, but works on every other PC. Aaaargh!
>
> My PC is as follows:
> Intel Core i7 CPU 860 @ 2.80GHz
> 8.00 GB RAM
> Windows 7 64-bit OS
>
> I have restarted Visual Studio, and the PC as well as run the tests
> from Resharper and the nunit test runner.
> All have the same result: It fails!
>
> Please help!
>
> --
> 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]<rhinomocks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rhinomocks?hl=en.
>
>

-- 
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.

Reply via email to