NUnitForms Class Library

NUnitFormTest Members

NUnitFormTest overview

Public Instance Constructors

NUnitFormTest ConstructorInitializes a new instance of the NUnitFormTest class.

Public Instance Properties

CurrentForm This should be marked obsolete. It is used only in combination with the FormType property. If you override the FormType property, then CurrentForm will be initialized (on setup) to an instance of the form whose type you specify. None of the testers require a reference to the active form anymore, so this should not be necessary. It will be marked obsolete soon.
DisplayHidden This property controls whether the separate hidden desktop is displayed for the duration of this test. You will need to override and return true from this property if your test makes use of the keyboard or mouse controllers. (The hidden desktop cannot accept user input.) For tests that do not use the keyboard and mouse controller (most should not) you don't need to do anything with this. The default behavior is fine.
FormType Soon to be marked obsolete. This property specifies the type of form to instantiate before each test. Do not use it anymore.
Keyboard Returns a reference to the current KeyboardController for doing Keyboard tests. I recommend this only when you are writing your own custom controls and need to respond to actual keyboard input to test them properly. In most other cases there is a better way to test for the form's logic.
Mouse Returns a reference to the current MouseController for doing Mouse tests. I recommend this only when you are writing your own custom controls and need to respond to actual mouse input to test them properly. In most other cases there is a better way to test the form's logic.
UseHidden This property controls whether a separate desktop is used at all. I highly recommend that you leave this as returning true. Tests on the separate desktop are faster and safer. (There is no danger of keyboard or mouse input going to your own separate running applications.) However I have heard report of operating systems or environments where the separate desktop does not work. In that case there are 2 options. You can override this method from your test class to return false. Or you can set an environment variable called "UseHiddenDesktop" and set that to "false" Either will cause the tests to run on your original, standard desktop.

Public Instance Methods

ActivateForm This will be marked obsolete soon. This method is called before each test in order to set the CurrentForm property (also obsolete) You can override this method as an alternative to setting the FormType property if you want to test the old way.
BaseSetup Obsolete soon. In your test class, you used to have the choice to override this method, or implement the FormType property. Now neither is necessary. It is still here for compatibility with tests written to use the CurrentForm property.
Equals (inherited from Object)Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object)Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object)Gets the Type of the current instance.
init This is the base classes setup method. It will be called by NUnit before each test. You should not have anything to do with it.
Setup Override this Setup method if you have custom behavior to execute before each test in your fixture.
TearDown This method is called after each test. Put code here to clean up anything you need to between tests. NUnitForms cleans up most everything you need related to the framework (closes extra windows, etc..) but you might need custom behavior beyond this. Put it here.
ToString (inherited from Object)Returns a String that represents the current Object.
UnexpectedModal This is the method that is called to handled unexpected modal dialogs. It is called automatically by the NUnitForms framework when such a dialog appears. You should not need to call it.
Verify This method is called by NUnit after each test runs. If you have custom behavior to run after each test, then override the TearDown method and do it there. That method is called at the beginning of this one. You should not need to do anything with it. Do not call it. If you do call it, call it as the last thing you do in your test.

Protected Instance Methods

ExpectModalOverloaded. One of four overloaded methods to set up a modal dialog handler. If you expect a modal dialog to appear and can handle it during the test, use this method to set up the handler.
Finalize (inherited from Object)Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object)Creates a shallow copy of the current Object.

See Also

NUnitFormTest Class | NUnit.Extensions.Forms Namespace