Upload
danstroh
View
204
Download
0
Embed Size (px)
DESCRIPTION
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.
Citation preview
WHY FAKE IT
WHEN YOU CAN FAKE IT EASY
• Husband
• Father
• Software developer for Meta Payment Systems
• Home brewer
• Stat guy
Dan Stroh
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
GOALS
• Write good unit tests
• Know what a good unit test looks like
• Use a mocking framework
ANATOMY OF A UNIT TEST
AAA
ARRANGE
ACT
ASSERT
PILLARS OF UNIT TESTING
UNIT TESTING DEVELOPMENT PRACTICES
TAD
TEST AFTER DEVELOPMENT
TDD
TEST DRIVEN DEVELOPMENT
BDD
BEHAVIOR DRIVEN DEVELOPMENT
FAKES, MOCKS, AND STUBS
INVERSION OF CONTROL
CONSTRUCTOR INJECTION
PROPERTY INJECTION
ARGUMENT INJECTION
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/
FAKEITEASY
RECAP
WRITE GOOD UNIT TESTS
KNOW WHAT A GOOD UNIT TEST LOOKS LIKE
USE A MOCKING FRAMEWORK
QUESTIONS
THANK YOU