Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Stubs, Shims, and Mocks, oh my! 
Unit Testing with Visual Studio Fakes 
Consulting/Training
Consulting/Training 
About Me 
 Microsoft Client Development MVP 
 ASPInsider 
 Twitter: @joelcochran 
 Email: joelcoc...
Consulting/Training 
About Wintellect 
Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbi...
Wintellect’s On-Demand Video Training Solution 
Try it free 
Code: <INSERT CODE HERE> WintellectNOW.com 
COCHRAN-13 
Autho...
What are Microsoft (Visual Studio) Fakes? 
 A tool for generating code entry and isolation endpoints 
 Generates “fake” ...
Consulting/Training 
Stubs 
 Easily create Mock objects based on Interfaces 
 Encourages good design 
 Often requires r...
Consulting/Training 
Demo Title, if Desired
Consulting/Training 
Shims 
 Used for more difficult test items 
 Or when you cannot refactor 
 Shims are considered ev...
Consulting/Training 
Demo Title, if Desired
Consulting/Training 
Configuration 
 Editing the Config files 
 Allows you to minimize generated code 
 Enabling Diagno...
Consulting/Training 
Demo Title, if Desired
Consulting/Training 
Additional Resources 
 Testing un-testable code: 
http://channel9.msdn.com/Events/TechEd/Europe/2012...
Consulting/Training 
Questions?
Upcoming SlideShare
Loading in …5
×

Fakes

464 views

Published on

  • Be the first to comment

Fakes

  1. 1. Stubs, Shims, and Mocks, oh my! Unit Testing with Visual Studio Fakes Consulting/Training
  2. 2. Consulting/Training About Me  Microsoft Client Development MVP  ASPInsider  Twitter: @joelcochran  Email: joelcochran@gmail.com  Blog: joelcochran.com  Lead Developer, WintellectNOW
  3. 3. Consulting/Training About Wintellect Founded by top experts on Microsoft – Jeffrey Richter, Jeff Prosise, and John Robbins – we pull out all the stops to help our customers achieve their goals through advanced software-based consulting and training solutions. consulting Wintellect helps you build better software, faster, tackling the tough projects and solving the software and technology questions that help you transform your business.  Architecture, Analysis and Design  Full lifecycle software development  Debugging and Performance tuning  Database design and development training Wintellect's courses are written and taught by some of the biggest and most respected names in the Microsoft programming industry.  Learn from the best. Access the same training Microsoft’s developers enjoy  Real world knowledge and solutions on both current and cutting edge technologies  Flexibility in training options – onsite, virtual, on demand who we are
  4. 4. Wintellect’s On-Demand Video Training Solution Try it free Code: <INSERT CODE HERE> WintellectNOW.com COCHRAN-13 Authors Enjoy:  Royalty Income  Personal Branding  Cross-Sell Opps  Free library access Subscribers Enjoy:  Expert Instructors  Quality Content  Practical Application  All Devices Consulting/Training Individuals | Businesses | Enterprise Organizations
  5. 5. What are Microsoft (Visual Studio) Fakes?  A tool for generating code entry and isolation endpoints  Generates “fake” assemblies and includes them in your project  Fakes then contain Stub and Shim classes  Included with Visual Studio 2012 and 2013 [requires Ultimate] Consulting/Training
  6. 6. Consulting/Training Stubs  Easily create Mock objects based on Interfaces  Encourages good design  Often requires refactoring
  7. 7. Consulting/Training Demo Title, if Desired
  8. 8. Consulting/Training Shims  Used for more difficult test items  Or when you cannot refactor  Shims are considered evil  Use sparingly  Refactor as soon as possible  Remove Shims
  9. 9. Consulting/Training Demo Title, if Desired
  10. 10. Consulting/Training Configuration  Editing the Config files  Allows you to minimize generated code  Enabling Diagnostics  Don’t forget to turn on Diagnostics in VS Options
  11. 11. Consulting/Training Demo Title, if Desired
  12. 12. Consulting/Training Additional Resources  Testing un-testable code: http://channel9.msdn.com/Events/TechEd/Europe/2012/DEV411  Isolating Code Under Test with Microsoft Fakes: http://msdn.microsoft.com/en-us/library/hh549175(v=vs.110).aspx  Peter Provost’s blog (search for Fakes): http://www.peterprovost.org/blog/
  13. 13. Consulting/Training Questions?

×