TDD 0 to 60 - An Introduction to Test-Driven Development in .NET


Published on

If you've heard of Test-driven Development, and you're wondering what all the fuss is about, this slidedeck will provide a code-centric introduction to the concepts, tools, and practices of TDD in the .NET framework.

We'll start with the basics of setting up a unit testing framework and writing the first test, then we'll move on to techniques for mocking dependencies and demonstrate patterns like Dependency Injection that will help you move past testing just the basics.

We invite you to download the full webinar replay at which includes live demonstrations. After viewing the webinar replay, you should be able to sit down and start writing tests that will drive the design of your application, creating loosely-coupled and testable code.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

TDD 0 to 60 - An Introduction to Test-Driven Development in .NET

  1. 1. TDD 0 to 60 An Introduction in Test-Driven Development Michael Joseph Kramer Pillar Technology in .NET
  2. 2. What do you mean by “unit test”? • code tests code • small • fast • independent
  3. 3. the whole truthiness • Anything I can do with a unit test, I can do with a debugger. • It’s an ivory tower activity, not something real businesses do. • Unit testing isn’t for small businesses. • Unit testing isn’t for the enterprise. • We don’t need no stinkin’ unit tests. We have a QA team! • We don’t need no stinkin’ QA team. We have unit tests! • Writing tests will take me longer, which makes it cost more. • Most of the stuff I write isn’t interesting enough for a unit tests. It’s only for complicated stuff. • Unit testing prevents you from writing crappy software. • Everything I have ever learned about software development is wrong.
  4. 4. What do I need? • NUnit • MbUnit • MsTest •
  5. 5.
  6. 6. AAA ain’t just the auto club Arrange – Set it up! Act – Call It! Assert – Verify it worked!
  7. 7.
  8. 8. Is this TDD???
  9. 9.
  10. 10. only refactor green tests!
  11. 11. http://
  12. 12. Weak. My code uses a database...
  13. 13. Dependencies • inject the dependency • replace with a stub
  14. 14.
  15. 15. Why can’t I just go to the database?
  16. 16. Mocking: not just for when your manager out of the room • a mock knows if your test passed • behavior, not state • void methods • brittle
  17. 17.
  18. 18. Mocks aren’t Stubs, abridged • Stubs vs. Mocks, in a nutshell: – Stubs: return dummy data – Mocks: Test passes or fails based on what the method does, not what it returns – Test Double or Fake: Generic terms for either a mock or stub I.E., a mock can make a test fail, a stub can’t. Full Version:
  19. 19.
  20. 20. Our Next Steps • Upcoming Webinars: Please visit • All of the webinar content is available to your business in a 1-2 day on-site workshop or as a “lunch and learn” format. Please contact us for details. • Visit to access presentation slides and full archived broadcasts of past webinars. • • Blog: • LinkedIn: Join the Agile Enthusiast Group on LinkedIn: • YouTube: • Phone: (888) 3-pillar • Web: • Email: