Running Visual Studio 2008 C # Unit Tests (MSTest.exe) in Mono

I am using VS2008 to develop a project that I am starting to test in Mono. There are several unit tests written using the VS unit test structure, is there a tool that will let me run them in Mono?

Thank,

+4
source share
1 answer

Depending on the features you use, this can be trivial or complicated. You can use namespace / type aliases to use another class library to execute statements and attributes. I wrote console programs that run tests manually, but of course I had access to vs namespaces and assemblies.

For mono - my proposal it would be to use a different testing system as a whole, since doing it yourself using the system.reflection namespace to load the assembly, reflect the attributes and execute as you need will be tiring.

For instance:

Pseudo code:

var assembly = loadAsembly(....)
foreach(type in assembly.types) {
 if(type is static class and had method with AssemblyInitialiseAttrubute)){
    InvokeTheMethod(method);
 }
}

foreach(type in assembly.types) {
 if(type is not class and had method with TestClass)){
    InvokeTheMethod(method);
 }
 foreach(method in type with ClassinitialiseAttribute)
}
... etc
+2
source

All Articles