NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: CaseyR on October 08, 2015, 05:55:44 PM
-
Hi, Bruce
I am trying to add unit testing for the many small app specific procedures/methods of my app. Many of these procedures receive a NetWebServerWorker as a parameter, mainly to access or set SessionValues. I would like to instantiate a NetWebServerWorker object independent of an actual connection so I can assign SessionValues and pass it to the procedure as part of the test. Is there a way to do that?
Thank you.
-
Sure, it's just an object.
But all the "global" stuff is done by the WebServer object, so you'll need that as well.
s_web NetWebServer
p_web NetWebServerWorker
Then the p_web needs to be set to point at the s_web;
This is usually done by priming a NetWebServerRequestDataType structure, and assigning it to the p_web.RequestData property;
RequestData Group(NetWebServerRequestDataType).
RequestData.WebServer &= s_web
Obviously the WebHandler is expecting a lot more in the way of data in the structure, so depending on what your methods do you may need to init more properties. but hopefully this will get you started.
cheers
Bruce
-
Excellent. Thanks, Bruce.