Having read good things about Moles I'd like to add an isolation framework to our set of tools for writing unit tests.
Our application runs under Mono as it is deployed on both Linux and Windows and I cannot seem to find a framework that supports Mono.
I've seen some articles about manipulating assemblies using Cecil but I'm struggling to find anything we could realistically use.
Looks like Moles works using the JIT, so I'd expect it to be very very tied to microsoft's implementation.
I've had a fantastic amount of success using Moq on mono, With a very small amount of effort it is possible to create a proxy instance of almost any class and intercept nearly all method calls. The latest binary version of Moq works very well on mono for me.
using Moq;
var mock = new Mock<MyClass> { CallBase = true };
mock.Setup( x => x.MyMethod() ).Returns ( 1 );
After using Moq to setup things I generally prefer to use NUnit but you can use any other test framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With