vendredi 4 janvier 2019

Using MockHttpClient nuget package in VS 2017

I am trying to test an adapter service in VS 2017 in C#. My test is failing because it is wanting a 400 through 499 response from the HTTPClient. When my test runs the service returns a 500. So searching I found MockHttpClient nuget package but the examples given are not working when I try them in my test.

example: https://github.com/codecutout/MockHttpClient/blob/master/README.md

I get an error saying 'MockHttpClient' is a namespace but is used like a type

I also added in a using MockHTTPClient at the top of my test.

What am I doing wrong?

getting error with the below

var mockHttpClient = new MockHttpClient(); mockHttpClient.When("the url I am using").Returns(HttpStatusCode.Forbidden)

Aucun commentaire:

Enregistrer un commentaire