NUnit Test Project - Unable to create Xamarin MockContext - java-interop could not be found

0

I have an NUnit test project which works fine on its own until I start trying to bring Xamarin into the mix. Here is what my test looks like just to start:

[Test]
public void Test1()
{
    //ARRANGE
    var mockContext = new Android.Test.Mock.MockContext();
    var textView = new Android.Widget.TextView(mockContext);


    //ASSERT
    var response = 1;
    Assert.AreEqual(1, response);
}

This compiles fine, but when I run it, I get an error from the first line:

Message: System.DllNotFoundException : Unable to load DLL 'java-interop' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I have verified that this reference java.interop is included in the project and also confirmed that the .dll is in the location on the drive that the reference is pointing to:

enter image description here

Is it just not possible to create instances of Xamarin objects in the NUnit test project?

I've seen this brought up numerous times from my research but the conclusion is usually along the lines of "Not sure if its possible, just avoid referencing Xamarin" Does anyone know for sure?

android
unit-testing
xamarin
xamarin.android
nunit
asked on Stack Overflow Jun 12, 2019 by Reddy

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0