O'Reilly logo

Professional Test-Driven Development with C#: Developing Real World Applications with TDD by Jeff McWherter, James Bender

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11

Testing WPF and Silverlight Applications

WHAT'S IN THIS CHAPTER?

  • Why testing WPF and Silverlight applications is hard
  • The basics of the MVVM pattern

Windows Presentation Foundation (WPF) and Silverlight are both powerful frameworks that allow you to create visually stunning applications. Both frameworks use Extensible Application Markup Language (XAML) as their markup language. WPF is used for creating desktop-based applications, and Silverlight is used to develop mostly browser-based applications and Windows Phone 7 applications. Despite the fact that these technologies are extremely powerful, testing applications developed using these frameworks can be difficult. Following in the footsteps of previous technologies such as ASP.NET and WinForms, WPF and Silverlight both default to using code-behind files. Code-behind files are great for getting an application up and running quickly, but they make it extremely difficult, if not impossible, to write automated tests for your applications. Code-behind-based applications can also be difficult to maintain, especially as more and more functionality is added. In the world of ASP.NET, the MVC pattern has become the standard for creating highly testable applications while avoiding the pain points of the code-behind.

By the end of this chapter, you will have an understanding of why testing the user interface is difficult. You will learn about patterns that help alleviate some, if not most, of the difficulty of testing WPF and Silverlight-based ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required