1

I have created an ISAPI project in Delphi, based off TWebModule.

I would like to unit test the actions that are handled, using the Delphi TestFramework.

The input is a TWebRequest and TWebResponse. My question is, how do I create a TWebRequest and define the content and query fields? These appear to be read only. Do I need to create a mock server protocol to create web requests?

Mr T
  • 11
  • 2
  • for a related question see also http://stackoverflow.com/questions/422379/how-can-i-test-private-methods-with-dunit – mjn Jun 10 '13 at 14:41

1 Answers1

0

With Extended RTTI (available in Delphi 2010 and newer) it should be possible to modify the object state even if it is hidden in private fields. (Maybe a lot of work but it has to be done only once, and can be reused in all tests.)

mjn
  • 36,362
  • 28
  • 176
  • 378
  • Hi, thanks for your suggest - but it would be a lot of work, if you look at how the TWebRequest class is created. I might have a go, but I thought someone would have done unit tests of Web requests before in Delphi. Surely there is an easier way. – Mr T Jun 17 '13 at 06:34