...
Include Page | ||||
---|---|---|---|---|
|
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.
...
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(); } } }
|
Fig. 19. NUnit Userinterface with Simple River wrapper classes loaded
7. Implementing IManageState
...