I am trying to create a Unit test using Visual Studio 2008.
Here is my simple C# class and test.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.opalkelly.frontpanel;
namespace FPGAUnitTesting
{
public class FPGATest
{
okCUsbFrontPanel ok;
public void Run()
{
ok = new okCUsbFrontPanel();
}
}
}
////////////////////////////////////////////////////////////
[TestMethod]
public void TestMethod1()
{
FPGATest tst = new FPGATest();
tst.Run();
}
When I run this test in debugger I get a TypeInitializationException
Error Message:
Test method OKTestProject.OKTest.TestMethod1 threw exception: System.TypeInitializationException: The type initializer for ‘com.opalkelly.frontpanel.libFrontPanelPINVOKE’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘SWIGExceptionHelper’ threw an exception. —> System.DllNotFoundException: Unable to load DLL ‘libFrontPanel-pinv’: The specified module could not be found. (Exception from HRESULT: 0x8007007E).
Error Stack Trace:
com.opalkelly.frontpanel.libFrontPanelPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_libFrontPanel(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
com.opalkelly.frontpanel.libFrontPanelPINVOKE.SWIGExceptionHelper…cctor()
com.opalkelly.frontpanel.libFrontPanelPINVOKE.SWIGExceptionHelper…ctor()
com.opalkelly.frontpanel.libFrontPanelPINVOKE…cctor()
com.opalkelly.frontpanel.libFrontPanelPINVOKE.new_okCUsbFrontPanel()
com.opalkelly.frontpanel.okCUsbFrontPanel…ctor()
FPGAUnitTesting.FPGATest.Run() in C:\Documents and Settings\agilesem\Desktop\1.7\CSGui\mySEM\FPGAUnitTesting\FPGATest.cs: line 15
OKTestProject.OKTest.TestMethod1() in C:\Documents and Settings\agilesem\Desktop\1.7\CSGui\mySEM\OKTestProject\OKTest.cs: line 67
I could not figure out why ‘libFrontPanel-pinv’ could not be found. I guess this message is misleading.
Any suggestion what could be wrong?