Can NUnitLite call a unit test .dll?

29 Views Asked by At

The standard use of NUnitLite is to convert a NUnit test library and convert it to an exe, and add the Main() method.

I want to keep my test library intact and just add an NUnitLite exe project to my solution, because I want to be able to run the unit tests in Visual Studio AND run the tests in a remote environment. I tried NUnit-console and I get an out of memory exception, so I am trying NUnitLite instead, but it's having trouble running the .dll.

I tried this:

            Directory.SetCurrentDirectory($"..\\..\\..\\{targetName}\\bin\\debug");
            string path = Path.Combine(Directory.GetCurrentDirectory(), $"{targetName}.dll");
            var assy = System.Reflection.Assembly.LoadFile(path);
            return new AutoRun(assy).Execute(args);

It loads the test .dll, but can't load any other dependent .dlls. Is there a better way to set the current directory?

0

There are 0 best solutions below