prepare strict expect combo erroring out

24 views
Skip to first unread message

John Nyquist

unread,
Nov 25, 2014, 10:09:26 AM11/25/14
to mock...@googlegroups.com
If I use prepare() on an interface, then create an instance with it with strict(), and use it as a parameter to expect(), I get an error when I run it that there is no expectation defined for the method. For example, in the code below, you'd get an error saying that there is no expectation defined for IFoo.bar() .  Is this a bug in Mockolate or am I doing something incorrectly?

    [Before(async, timeout=5000)]
public function prepareMocks():void
{
Async.proceedOnEvent(this, prepare(IFoo), Event.COMPLETE);
}

[Test]
public function executeTest():void {
var foo:IFoo = strict(IFoo);

expect(foo.bar(
));

}

John Nyquist

unread,
Nov 30, 2014, 9:57:15 AM11/30/14
to mock...@googlegroups.com
Ahh, I didn't realize that when you used expect() on mocks made with strict() you needed to do it within expecting(). Found the answer here:
Reply all
Reply to author
Forward
0 new messages