0

I am trying to test a factory class, checking that the set up was correct:

var request = _target.BuildWebRequest(_url, "POST", "someData", "application/xml");
Assert.That(request.ContentType, Is.EqualTo("application/xml"));

However, for some reason, calling the Getter for ContentType executes the web request, and results in an exception if _url can't be found.

This is weird, and not the behavior I am expecting.
How can I get ContentType without triggering this request?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Uri Kutner
  • 122
  • 8
  • I think request is executing not when you calling getter for ContentType. I see that you trying to put some data ("someData") to request - in this case you opening RequestStream and receive an exception for bad url. – maseal Oct 03 '13 at 11:45
  • Hmm. I this makes sense with some of the other tests. I will look into it. Any way to put "someData" without triggering the request? I'm sure it's a possible scenario that could come up. – Uri Kutner Oct 06 '13 at 08:04

0 Answers0