lundi 30 novembre 2015

Mock WCF service for another instance

There are two solutions: Web and Server that communicate with wcf services. Another solution is Test where I'm writing UI tests. In this Test solution I have Host project where I have service references to Server solution. Then I just implement fake services from interfaces of referenced services. And depending on build configuration Web use link to fake host from config. So in this way I've separated Web testing from server side, and another benefit it's speed. In the test I need, for example, verify that method was called with appropriate parameters and return something back when I press the button. So in the implementation of the fake method I need to log all parameters and return some information that depends from these parameters. But I'm trying to find another way how to mock it, for example how it looks with Rhino mocks. And test can looks something like this.

Page.PressAddCustomerButton();  
mock.Expect(t => t.AddCustomer("Name", "Surname")).Return(response.Ok);

Could you please help me. Is it possible?

Aucun commentaire:

Enregistrer un commentaire