Roy Osherove

View Original

Ad hoc Unit Tests with Snippet Compiler

If you're a fan of snippet compiler (if you're not you should seriously check it out)Travis Illig published a little template for writing Typemock Isolator test inside this handy little tool.

the reasons you'd need a specialized template in the first place to write these kinds of tests in snippet compiler:

1) Typemock Isolator uses the .NET profiling APIs to work its magic, so the .net process running your tests need to have a couple of environment variables enabled to work

2) His code template actually creates and runs a new process that triggers nunit-console.exe with the path of the current code you just wrote in snippet compiler allowing you to effecively write and run unit tests in snippet compiler!

3) the nunit-console process will already have the env. vars as mentioned in the first item set to it.

Travis' template will work for anything nunit can run, not just typemock isolator tests, which is pretty cool.

Full info and download here.