Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Include Page
OPENMI: 6.1 Unit testing
OPENMI: 6.1 Unit testing

6.1 Unit testing

The testing procedure described here assumes you are using the NUnit test tool. You can download the NUnit user interface and libraries fromhttp://www.NUnit.org. This web page also gives more information about NUnit. Basically, you create a test class for each of the wrapper classes; in the test classes you implement a test method for each public method in the class.

...

Image Removed
Fig. 18 Wrapper and test classes for the Simple river model

...

Code Block

using System; using Oatc.OpenMI.Examples.ModelComponents.SimpleRiver.Wrapper; using NUnit.Framework; namespace org.OpenMITest.Examples.ModelComponents.SimpleRiver.Wrapper {    \[TestFixture\]    public class SimpleRiverEngineDotNetAccessTest    {       \[Test\]       public void GetModelID()       {          SimpleRiverEngineDotNetAccess \_simpleRiverEngineDotNetAccess;          String \_filePath;         \_simpleRiverEngineDotNetAccess = new SimpleRiverEngineDotNetAccess();         \_filePath = 'C:\\SimpleRiver\\UnitTest\\Data\\Rhine';         \_simpleRiverEngineDotNetAccess.Initialize(_filePath);         Assert.AreEqual('The river Rhine',         \_simpleRiverEngineDotNetAccess.GetModelID());         \_simpleRiverEngineDotNetAccess.Finish();       }    } }

Image Removed
Fig. 19. NUnit Userinterface with Simple River wrapper classes loaded

7. Implementing IManageState

...