This is a mirror of official site: http://jasper-net.blogspot.com/

6 Tips for Turbocharging Your Unit Testing

| Tuesday, March 22, 2011
Who doesn't love making software run even better? Turbocharging, if you will. Here are Typemock developer's six tips for turbocharging Isolator.
  • Need to simulate a fault? Just use Isolate.WhenCalled(...).WillThrow(new Exception()) with any method!
  • Isolate.WhenCalled(...) uses Behavior Sequencing - use multiple expectations in sequence
  • Isolate.Swap.AllInstances() affects both existing and future instances of T!
  • Use Isolator to fake any Singleton without changing a line of code: Isolate.WhenCalled(() => MyFactory.Instance).WillReturn(...)
  • Use Isolate.WhenCalled(() => ...).CallOriginal() to have the fake object call an original implementation!
  • Use different flavors of argument matching when setting expectations: exact or custom
What are your favorite tips with Isolator or Isolator++? Leave them in the comments and we’ll post the best ones in the next Typemock newsletter.

Read more: Typemock

Posted via email from Jasper-net

0 comments: