add TODO and FAQ
[mono.git] / mcs / class / System.Web / Test / mainsoft / NunitWeb / NunitWeb / FAQ
1 Thanks to Julien Couvreur for the questions.\r
2 \r
3 Q: You mention that the test gets invoked in the web appdomain. But does\r
4 this have any impact on the kind of tests that you can do?\r
5 \r
6 A: I'm not aware of any impact yet.\r
7 \r
8 Q: Does that mean that the test class would need to be serializable if it\r
9 needs to keep any state?\r
10 \r
11 A: This turned out to be a complex problem. If you pass a delegate to\r
12 another appdomain, it's serialized only in one way. So, if during this\r
13 delegate you change instance fields, those changes will be lost. I could\r
14 not work around this problem with passing delegate by ref, because then a\r
15 new instance is created and the original remains intact. So to provide an\r
16 ability to pass user data back and forth, I made WebTest.UserData property.\r
17 If few WebTest's run in different threads, each one has it's own UserData.\r
18 \r
19 Q: Do you really think that there is going to be different types of hooks?\r
20 Currently, you have BaseInvoker and PageInvoker, but maybe the base class\r
21 is superfluous?\r
22 \r
23 A: Currently, there are 3 Invokers: BaseInvoker, HandlerInvoker and\r
24 PageInvoker.\r
25 \r
26 BaseInvoker is a stub, only ensuring somebody called it. It exists for\r
27 tests that need no callback, for example for rendering some aspx page.\r
28 \r
29 HandlerInvoker enables to execute a method without parameters in the web\r
30 appdomain. NET 2.0 anonymous delegates are useful here. There is no need to\r
31 instrument anything for this invoker, or to set the URL of the request, the\r
32 DefaultUrl of the HandlerInvoker is sufficient.\r
33 \r
34 PageInvoker calls a method with Page argument, and is used when the test\r
35 must work on a web page. The page must be instrumented to enable the\r
36 framework to do its job.\r