0

I created a DLL library for AutoCAD, using AutoCAD API. Now I'm creating another project in the same Visual Studio solution so I can unit test some methods I created for the library.

I created the project and installed NUnit 3.11

I created I class with a method which calls a method from the AutoCAD plugin project. When executing the tests I get ´System.BadImageFormatException´ trying to load ´Acdbmgd, Version=22.0.0.0´ even if I import it to the testing project.

I saw this post BadImageFormatException thrown when running NUnit tests on TeamCity with a similar problem. I tried changing the project's configuration from AnyCPU to x86, but I still get that error.

namespace UnitTesting {
    [TestFixture]
    public class UnitTesting {

        [TestCase("80", true)]
        [TestCase("240", true)]
        [TestCase("0", false)]
        [TestCase("33", false)]
        [TestCase("5", false)]
        [TestCase("-10", false)]
        [TestCase("text", false)]
        public void CorrectDiamTest(string value, bool result) {
            bool myCalc = Main.CorrectDiam(value);
            Assert.That(myCalc, Is.EqualTo(result));
        }

    }
}

Edit: Added a test solution https://drive.google.com/open?id=1u9SxazxFHbA3x8e9xxK27bS5oDagC4yc

AwesomeGuy
  • 537
  • 1
  • 6
  • 17

0 Answers0