vendredi 24 juillet 2015

Unit testing WebAPI, RestSharp and in-memory HTTPServer

You can unit test a web API Layer using an in-memory HttpServer ( see Using NUnit to perform integration tests with ASP.NET WebApi controllers for example)

The relevant lines for testing using the in-memory server are

       var Server = new HttpServer(config);
        ...
       var client = new HttpClient(Server)

. which tells the client to use the in-memory webserver. That works nicely.

I'm using Restsharp : how can I tell the RestClient object (I think) to use my in-memory HttpServer ?

Aucun commentaire:

Enregistrer un commentaire