Visual Studio/.NET Framework

TH29 Zero to Hero: Untested to Tested with Visual Studio Fakes

03/19/2015

3:00pm - 4:15pm

Level: Intermediate to Advanced

Benjamin Day

Consultant & Trainer

Benjamin Day Consulting, Inc.

You've got an app with no tests. Trust me. You're not alone. You'd love to get some great code coverage but no one ever thought about tests while they were building the app. It's tightly-coupled and there just isn't a good place to start adding unit tests. It feels hopeless, right? Well, the Visual Studio Fakes Framework can help. It helps you with type replacement so you can start turning your tightly-coupled app into something that's *a lot* more testable. It also helps you with mocks and stubs, too. In this session, we'll take an application that has no tests and use the Microsoft Fakes Framework to go from no code coverage to great test code coverage. Along the way, we'll also talk about what the design patterns are that will help you to refactor your code for testability and make *future* code more testable right from the start. When we're done, we'll not only have a well-tested app but we'll have a better software architecture with a clean separation of concerns that's much more maintainable.

You will learn:

  • What mocks and stubs are
  • How to use the Visual Studio Fakes framework to help break tight coupling
  • How to use the Visual Studio Fakes framework for type replacement at test runtime
  • About Design for testability
  • About Code coverage
  • The design patterns that help you stay testable
  • Refactoring code with lots of static methods/classes for testability
  • Testing data access code and service access code