ikeough/Dynamo — pull request #627 by Benglin (2013-10-26 16:24:25+00:00)
Title: Integration of Command Framework and NUnit Tests

#### Background

This pull request represents the first integration of command framework into NUnit test cases. These recorded test cases replay commands as they were issued during a real user scenario.

In a regular UI NUnit test, even though the dispatcher is created as the result of having DynamoView, it does not get an opportunity to run (i.e. pump messages in its queue). The command playback takes a different approach, instead of creating a modeless DynamoView (DynamoView.Show), it creates a modal DynamoView (ShowDialog). This allows the DynamoView to show up and handle events for as long as the command playback is still running (the playback eventually closes DynamoView as soon as playback is done). After DynamoView returns from command playback, NUnit test cases then given a chance to run. Not only does this exercise View-Model and Model codes, it also tests corresponding View codes.

As of this pull request, the following commands are folded to make use of the command framework:

- CreateNodeCommand
- CreateNoteCommand
- SelectInRegionCommand
- SelectModelCommand
- DeleteModelCommand
- DragSelectionCommand
- MakeConnectionCommand
- UndoRedoCommand

The following important functionalities are missing and will be implemented in subsequent submissions:

- The ability to modify node contents
- The ability to deal with +/- buttons on list nodes
- The ability to copy-and-paste

There are various other commands that will be folded into the command framework as soon as the need arises. For example, "Align All to Left" command is currently placed on the lowest priority and will only be made available as needed.

#### Recording and Playback

##### Support commands as listed above can be recorded with the following steps:

- Perform actions with DynamoSandbox.exe (e.g. create a node, and move it)
- Press CTRL+SHIFT+R to store the recorded commands into an XML
- The newly generated XML file will open up with the default viewer of XML file

##### To playback the command XML file:

- Launch DynamoSandbox with the following command line argument:

- DynamoSandbox.exe /c "X:\file\path\command.xml"

- DynamoSandbox automatically shuts down after the command playback is done. To prevent that, open the XML file and change "ExitAfterPlayback" attribute to "false".

#### Testing

The following functionality of Dynamo are involved in the code changes in this pull request, and should be tested as a regular user:

- Undo-redo functionality
- Node deletion

#### Unit Testing

Introduced NUnit test cases in a new category "RecordedTests":

- TestCreateNodes
- TestCreateConnectors
- TestDeleteCommands
- TestUndoRedoNodesAndConnections.

Tests cases are passing:

- DynamoPythonTests
- DynamoCoreUITests
- DynamoMSOfficeTests
- DynamoCoreTests
- DSCoreNodesTests.

Revit related test cases are producing the same result as in the master branch (through RunRevitTests.py).