0

I have a endpoint of a websevice that we consume with application/xml header which it accepts and it returns data for a code we look.

Now our code has all implementations for different type of responses, however, I want to simulate a scenario that the service is down and hence I should test my code for what I implemented when it is down.

I don't know how to simulate a service down, can someone please help me with .net C# code

Plamen G
  • 4,729
  • 4
  • 33
  • 44
Jasmine
  • 5,186
  • 16
  • 62
  • 114
  • Point the end point to something incorrect? – Sayse Oct 20 '16 at 13:31
  • is this a wcf service? are you unit testing? if you are using wcf, there's always a interface contract. you can mock that and return whatver you want. – Fran Oct 20 '16 at 13:32
  • if you are integration testing do what sayse says. if your trying to do unit testing mock it out like i said. – Fran Oct 20 '16 at 13:33
  • @Fran: Thank you, it is integration and it is not WCF service. – Jasmine Oct 20 '16 at 13:37
  • @Sayse: apologize, could you please provide me a quick example? – Jasmine Oct 20 '16 at 13:37
  • `endpoint = "thiswebsitedoesntexist.com"` (although it would appear that that url example would return a 200 so pick something else) – Sayse Oct 20 '16 at 13:40
  • @Sayse: I vaugley understand, let me try what you say :) Thank you so much cheers, – Jasmine Oct 20 '16 at 13:50

0 Answers0