2 using System.Diagnostics;
7 /// The delegate used for all events related to loading, unloading and reloading tests
9 public delegate void TestLoadEventHandler( object sender, TestLoadEventArgs e );
12 /// Enumeration used to distinguish test load events
14 public enum TestLoadAction
28 /// Argument used for all test load events
30 public class TestLoadEventArgs : EventArgs
32 private TestLoadAction action;
33 private string assemblyName;
34 private UITestNode test;
35 private Exception exception;
38 /// Helper that recognizes failure events
40 private bool IsFailure( TestLoadAction action )
42 return action == TestLoadAction.LoadFailed ||
43 action == TestLoadAction.UnloadFailed ||
44 action == TestLoadAction.ReloadFailed;
48 /// Constructor for non-failure events
50 public TestLoadEventArgs( TestLoadAction action,
51 string assemblyName, UITestNode test )
54 this.assemblyName = assemblyName;
57 Debug.Assert( !IsFailure( action ), "Invalid TestLoadAction in Constructor" );
60 public TestLoadEventArgs( TestLoadAction action, string assemblyName )
63 this.assemblyName = assemblyName;
65 Debug.Assert( action != TestLoadAction.UnloadStarting || action != TestLoadAction.UnloadComplete,
66 "Invalid TestLoadAction in Constructor" );
70 /// Constructor for failure events
72 public TestLoadEventArgs( TestLoadAction action,
73 string assemblyName, Exception exception )
76 this.assemblyName = assemblyName;
77 this.exception = exception;
79 Debug.Assert( IsFailure( action ), "Invalid TestLoadAction in Constructor" );
82 public TestLoadAction Action
84 get { return action; }
87 public string AssemblyName
89 get { return assemblyName; }
92 public UITestNode Test
97 public Exception Exception
99 get { return exception; }