I'm a newbie to NUnit (in fact to unit testing in general) and I'm trying to write some tests for a little thing I'm working on.
What I'm doing is attempting to write a Wrapper library for libspotify.
An example of what I'm trying to test is:
/// <summary>
/// The connection state of the specified session.
/// </summary>
/// <param name="sessionPtr">Pointer to Session object</param>
/// <returns>The connection state - see the ConnectionStateE enum for possible values</returns>
[DllImport("libspotify")]
internal static extern ConnectionStateE sp_session_connectionstate(IntPtr sessionPtr);
/// <summary>
/// The connection state of the session
/// </summary>
public ConnectionStateE GetConnectionState()
{
__CheckIsNotDisposed();
return sp_session_connectionstate(this.Ptr);
}
And then the test itself (in a separate project, same solution)
[Test]
public void TestSessionInitializeDisconnected()
{
using (var sess = new Session())
{
Assert.AreEqual(sess.ConnectionState, myLibSpotify.Enums.ConnectionStateE.DISCONNECTED);
}
}
Admittedly this test may not be the most useful but at the moment this is irrelevant. The problem I'm having is when I attempt to run the tests NUnit shows me an exception of:
SpecTests.TestSessionBasics.TestSessionInitializeDisconnected:
System.BadImageFormatException : An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
I'm guessing I've overlooked something here but googleing hasn't really helped because I seem to find results only for testing c++/cli or other results that don't really help.
Any help would be appreciated. Thanks.