We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi Drew
I try to use expect() instead received() and find the problem (received() works properly). Clean test below
package { import flash.events.Event; import flash.events.EventDispatcher; import mockolate.arg; import mockolate.expect; import mockolate.runner.MockolateRule; import org.hamcrest.core.anything; import org.hamcrest.object.hasProperty; public class FoobarTest { [Rule] public var rule:MockolateRule = new MockolateRule(); [Mock] public var ed:EventDispatcher; [Test] public function works():void { expect(ed.dispatchEvent(arg(anything()))).twice(); expect(ed.dispatchEvent(arg(hasProperty('type', '1')))); expect(ed.dispatchEvent(arg(hasProperty('type', '2')))); ed.dispatchEvent(new Event('1')); ed.dispatchEvent(new Event('2')) } [Test] public function notWorks():void { expect(ed.dispatchEvent(arg(anything()))).thrice(); expect(ed.dispatchEvent(arg(hasProperty('type', '1')))).twice(); expect(ed.dispatchEvent(arg(hasProperty('type', '2')))); ed.dispatchEvent(new Event('1')); ed.dispatchEvent(new Event('1')); ed.dispatchEvent(new Event('2')) } [Test] public function butAgainWorks():void { expect(ed.dispatchEvent(arg(hasProperty('type', '1')))).twice(); expect(ed.dispatchEvent(arg(hasProperty('type', '2')))); ed.dispatchEvent(new Event('1')); ed.dispatchEvent(new Event('1')); ed.dispatchEvent(new Event('2')) } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi Drew
I try to use expect() instead received() and find the problem (received() works properly). Clean test below
The text was updated successfully, but these errors were encountered: