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.

Why just fake it

541 views

Published on

An introduction to mocking frameworks and using FakeItEasy to help make .Net developers write better code through better unit tests. The goal of this session is understand unit testing basics, using fakes and then leveraging a mocking framework to get the most out of unit testing. This session is geared toward the novice unit tester and framework addicts.

Published in: Technology, Education
  • Be the first to comment

Why just fake it

  1. 1. WHY FAKE IT WHEN YOU CAN FAKE IT EASY
  2. 2. Dan Stroh • Husband • Father • Software developer for Meta Payment Systems • Home brewer • Stat guy
  3. 3. AGENDA • Goals • Anatomy of a Unit Test • Pillars of Unit Testing • Unit testing Development Practices • Inversion of control • Fakes, Mocks, Stubs • Mocking Frameworks • FakeItEasy • Recap • Questions
  4. 4. GOALS • Write good unit tests • Know what a good unit test looks like • Use a mocking framework
  5. 5. ANATOMY OF A UNIT TEST
  6. 6. A A A
  7. 7. ARRANGE ACT ASSERT
  8. 8. PILLARS OF UNIT TESTING
  9. 9. UNIT TESTING DEVELOPMENT PRACTICES
  10. 10. TAD TEST AFTER DEVELOPMENT
  11. 11. TDD TEST DRIVEN DEVELOPMENT
  12. 12. BDD BEHAVIOR DRIVEN DEVELOPMENT
  13. 13. FAKES, MOCKS, AND STUBS
  14. 14. INVERSION OF CONTROL
  15. 15. CONSTRUCTOR INJECTION
  16. 16. PROPERTY INJECTION
  17. 17. ARGUMENT INJECTION
  18. 18. MOCKING FRAMEWORKS FakeItEasy (nuget) github.com/fakeiteasy Rhino Mocks (nuget) hibernatingrhinos.com/oss/rhino-mocks Moq (nuget) github.com/Moq Microsoft Fakes msdn.microsoft.com/en-us/library/hh549175%28v=vs.110%29.aspx TypeMocks typemock.com JustMock (nuget) telerik.com/products/mocking.aspx Nmock (nuget) nmock3.codeplex.com Nsubstitute (nuget) nsubstitute.github.io/ EasyMock .Net sourceforge.net/projects/easymocknet/
  19. 19. FAKEITEASY
  20. 20. RECAP
  21. 21. WRITE GOOD UNIT TESTS
  22. 22. KNOW WHAT A GOOD UNIT TEST LOOKS LIKE
  23. 23. USE A MOCKING FRAMEWORK
  24. 24. QUESTIONS
  25. 25. STROH.SD@GMAIL.COM
  26. 26. THANK YOU

×