Versions Compared

Key

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

...


Below is the sample test code for the GetModelID method implementation in the Simple River model. Figure 19 shows the NUnit interface.

Code Block
using System;
using System.Collections;
using System.IO;
using Oatc.OpenMI.Examples.ModelComponents.SimpleRiver.Wrapper; 
using NUnit.Framework; 

namespace orgOatc.OpenMITestOpenMI.Examples.ModelComponents.SimpleRiver.Wrapper {    \.UnitTest
{
	[TestFixture\]    ]
	public class SimpleRiverEngineDotNetAccessTest    {       \[Test\]       public void GetModelID()       {          SimpleRiverEngineDotNetAccess \_simpleRiverEngineDotNetAccess;          String \_filePath;         \
	{
		SimpleRiverEngineDotNetAccess _simpleRiverEngineDotNetAccess;
		String _filePath;

		[SetUp]
		public void Init()
		{
			_simpleRiverEngineDotNetAccess = new SimpleRiverEngineDotNetAccess();
            \_filePath = 'C:\\SimpleRiver\\UnitTest\\Data\\Rhine';@"..\..\";
         \	_simpleRiverEngineDotNetAccess.Initialize(_filePath);
		}

		[TearDown]
		public void ClearUp()
		{
			
		}

		[Test]
		public       void GetModelID()
		{
			try
			{
				_simpleRiverEngineDotNetAccess.Initialize(_filePath);
				Assert.AreEqual('"The river Rhine',         \",_simpleRiverEngineDotNetAccess.GetModelID());         \
				_simpleRiverEngineDotNetAccess.Finish();       }    } 
			}
			catch(System.Exception e)
			{
				this.WriteException(e.Message);
				throw(e);
			}
		}
	}
}


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