[Cleanup] Removed TARGET_JVM
[mono.git] / mcs / class / System.Web / Test / mainsoft / NunitWeb / NunitWeb / BaseInvoker.cs
1 using System;
2
3 namespace MonoTests.SystemWeb.Framework
4 {
5         /// <summary>
6         /// Base class for invokers, which can be used on its own when no user callbacks need
7         /// to be executed in the Web context. When a user callback needs to be called, use
8         /// one of the <see cref="BaseInvoker"/> subclasses (the most common is
9         /// <see cref="PageInvoker"/>).
10         /// </summary>
11         /// <seealso cref="PageInvoker"/>
12         [Serializable]
13         public class BaseInvoker
14         {
15                 bool _invokeDone = false;
16                 /// <summary>
17                 /// This method is called to activate the invoker. When <see cref="BaseInvoker"/>
18                 /// is overriden, the subclasses should call the base class <c>DoInvoke</c>, if they want
19                 /// to use the default <see cref="CheckInvokeDone"/> implementation.
20                 /// </summary>
21                 /// <param name="parameters"></param>
22                 public virtual void DoInvoke (params object [] parameters)
23                 {
24                         _invokeDone = true;
25                 }
26
27                 /// <summary>
28                 /// This method returns the default URL specific to the invoker type. By default,
29                 /// there is no default URL.
30                 /// </summary>
31                 /// <returns></returns>
32                 public virtual string GetDefaultUrl ()
33                 {
34                         return null;
35                 }
36
37                 /// <summary>
38                 /// Checks whether <c>DoInvoke</c> was called or not. If subclasses do not override this
39                 /// method, they have to call <see cref="BaseInvoker.DoInvoke"/> to register the
40                 /// invocation.
41                 /// </summary>
42                 /// <seealso cref="BaseInvoker.DoInvoke"/>
43                 public virtual void CheckInvokeDone ()
44                 {
45                         if (!_invokeDone)
46                                 throw new Exception ("Invoker was not activated");
47                 }
48         }
49 }