I think I can see why you did it this way, as executing with inline anonymous functions is ugly. But would still lean towards my above suggestion, as in all non-test code cases we don't use an anonymous function for the listener.