6 Tips for Turbocharging Your Unit Testing

6 Tips for Turbocharging Your Unit Testing
March 21 07:00 2011 Print This Article

Who doesn’t love making software run even better? Turbocharging, if you will. Here are Typemock developer’s six tips for turbocharging Isolator.

6 Tips for Turbocharging Your Unit Testing

  • 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

Source: http://blog.typemock.com

Related Posts:

  • No Related Posts

About Article Author

view more articles
Nataliia Vasylyna
Nataliia Vasylyna

View More Articles
  • nfl jersey frames

    There isn’t really a escalator for you to success锟斤拷only staircase.