mock service using RL

parikshit.dutta's Avatar

parikshit.dutta

23 Feb, 2013 07:55 PM

Is there anyway we can mock service calls using RL as we do with SWIZ, please answer for both RL1 & RL2.

  1. Support Staff 1 Posted by creynders on 24 Feb, 2013 12:51 PM

    creynders's Avatar

    Yes, by creating a mock service implementation. So for instance, you'd create a ILoginService interface and a MockLoginService class that implements the interface. Then you map the MockLoginService to the ILoginService in the injector:

    //RL2
    injector.map( ILoginService ).toSingleton( MockLoginService ); 
    //RL1
    injector.mapSingletonOf( ILoginService, MockLoginService );
    

    When you're ready with the real implementation of your LoginService all you'll need to do is modify the above mapping.

  2. 2 Posted by parikshit.dutta on 25 Feb, 2013 07:52 AM

    parikshit.dutta's Avatar

    Hey creynders, one more friend in list :) Nice having your tips. Perfect!

    Thanks.

  3. Ondina D.F. closed this discussion on 26 Feb, 2013 09:39 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac