Unit testing with Mono on Unix

So, I've done a fair bit of research over the past couple nights, and I can't seem to find solid documentation on getting unit tests to run on Ubuntu. Before I go further, let me give some context.

I've got a .NET 4.5 PCL I've made that I'd like to make cross platform compatible. Cool, right? So, I tried compiling. The PCL itself compiles fine with a simple 'xcompile'. I tried compiling the unit test class, and that failed because it couldn't find Visual Studio's unit test dlls. Fair enough. So I switched the test cases to use NUnit instead because it looked like it had cross platform capability.

Now, with NUnit tests, I have gotten the tests to compile with minimal difficulty by running Xcompile and basically commenting everything out that references Visual studio in the .csproj file. Time to run the tests!

After trying to run the tests, I get an error like this one:

$ mono /home/user1/Documents/Tools/NuGet/NUnit.Runners.2.6.4/tools/nunit-console.exe -run=SourceHeader.Tests.IO ./SourceHeader.Tests.dll WARNING: The runtime version supported by this application is unavailable. Using default runtime: v4.0.30319 NUnit-Console version Copyright (C) 2002-2012 Charlie Poole. Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. Copyright (C) 2000-2002 Philip Craig. All Rights Reserved. Runtime Environment - OS Version: Unix CLR Version: 4.0.30319.17020 ( Mono 4.0 ( 4.0.2 (Stable Wed Jun 24 10:04:37 UTC 2015) ) ) ProcessModel: Default DomainUsage: Single Execution Runtime: mono-4.0 Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type. Server stack trace: at (wrapper xdomain-dispatch) NUnit.Core.RemoteTestRunner:Load (object,byte[]&,byte[]&) Exception rethrown at [0]: at (wrapper xdomain-invoke) NUnit.Core.RemoteTestRunner:Load (NUnit.Core.TestPackage) at NUnit.Util.TestDomain.Load (NUnit.Core.TestPackage package) [0x00000] in <filename unknown>:0 

So at this point, I'm just curious: Does anyone ever get unit tests to run on Unix? If so, I'd love some pointers. I really don't want to sound like a whiney imbecile who needs someone to do their work for them. It's just that I've been searching frantically for a couple days and am coming up with no new results.

Thanks in advance, everyone.

by MonsterAbe via /r/csharp

Leave a Reply