What steps will reproduce the problem?
In visual studio all tests succeeded just fine. On the build server there are
serveral tests which failed. What they have in common is, that they use the
"raise" method to throw an event. Our build server tests obfuscated what is
good to find obfuscation errors. Every "normal" expectation like
"Setup(something).Returns(something)" works. Only the raise event fails. the
stacktrace looks like the following:
MESSAGE:
Test method
Ade.Graphic.Presenter.Test.RoutingEngineTest.TestRouteOverLadderLinesWithFbd
threw exception:
System.ArgumentException: Could not locate event for attach or detach method
Void ᜀ(ᦜ[ᢈ]).
+++++++++++++++++++
STACK TRACE:
bei Moq.Extensions.GetEvent[TMock](Action`1 eventExpression, TMock mock)
bei Moq.Mock`1.Raise(Action`1 eventExpression, EventArgs args)
bei Ade.Graphic.Presenter.Test.RoutingEngineTest.TestRouteOverLadderLinesWithFbd()
The code for this is:
documentEventHandler.Raise(stub => stub.DocumentChanged += null,
new DocumentChangeEventArgs(DocumentChangeTypes.ViewUpdate));
We have no idea what is the difference between the code above and this
eventHandler.SetupGet(stub =>
stub.DocumentChangeNotify).Returns(documentEventHandler.Object);
because this code works fine.
What version of the product are you using? On what operating system?
Moq version 4.0.10818.0
Original issue reported on code.google.com by tobias.w...@gmail.com on 22 May 2013 at 6:34
Original issue reported on code.google.com by
tobias.w...@gmail.com
on 22 May 2013 at 6:34