Desarrollo de aplicaciones con wpf

Solo disponible en BuenasTareas
  • Páginas : 24 (5892 palabras )
  • Descarga(s) : 11
  • Publicado : 15 de junio de 2010
Leer documento completo
Vista previa del texto
CodeProject: Using MVC to Unit Test WPF Applications. Free source code and pro... Página 1 de 15

Platforms, Frameworks & Libraries » Windows Presentation Foundation » General License: The Code Project Open License (CPOL)

C# (C# 2.0, C# 3.0, C#), .NET (.NET, .NET 3.5), XAML, WPF, Architect, Dev Posted: 27 Jan 2008 Updated: 27 Jan 2008 Views: 61,548 Bookmarked: 122 times

Using MVC to UnitTest WPF Applications
By Josh Smith Provides guidance for using the Model-View-Controller design pattern to create modular WPF apps that are easy to unit test

55 votes for this Article. Popularity: 8.23 Rating: 4.73 out of 5
1 2 3 4 5

Download the demo app (for Visual Studio 2008) - 132.54 KB

Are you curious about how to create WPF applications that are modular, maintainable, and easyto unit test? Do you want some tips on how to avoid ending up in Spaghetti Hell during your next WPF project? Do you think that bowls make lousy hats? Read on…

Table of Contents
Introduction Background Common Design Concerns

http://www.codeproject.com/KB/WPF/MVCtoUnitTestinWPF.aspx?display=Print

17/02/2009

CodeProject: Using MVC to Unit Test WPF Applications. Free source code andpro... Página 2 de 15

Lower That Flamethrower Introducing MVC Implementing MVC in WPF The Demo App How the Demo App Works Unit Testing the Model and Controller Introducing MVVM Revision History

Introduction
At the time of this writing, the Windows Presentation Foundation (WPF) is a relatively new platform for creating Windows desktop applications. There is not too much available in the way ofguidance for developers to follow when they need to “port” their existing application design skills and best practices to WPF. One critical, yet scarcely reviewed, topic is how to leverage the features and powers of WPF to create unit testable applications. This article begins the process of filling that void, by introducing techniques I developed and evolved while working on several real WPFapplications over the course of two years.

Background
This article has been bouncing around in my head for a long time, just itching to get out. Initially I wanted to focus solely on how to implement the Model-View-Controller pattern in WPF, but eventually I realized that there is already some great material on the Web about that topic. This article introduces how to implement MVC with WPF, butthat is merely a prerequisite for explaining how the application’s unit tests work. Toward the end of this article, I introduce the Model-View-ViewModel pattern that some very smart folks at Microsoft invented specifically for WPF. MVVM is a powerful and useful alternative to MVC when designing a WPF application.

Common Design Concerns
At the end of the day, we all want the same basic things outof our application designs, regardless of the UI platform. This section briefly reviews some of those common concerns, simply to provide context for the rest of this article. Nothing in this section is new or specific to WPF application design. Any sensible software architect values modularity. Modular systems are made of self-contained units of functionality that have well defined relationshipswith each other. Changes made to one module should have a limited and predictable ripple effect on other, closely related, modules. An interface or base class often formally defines the relationship between two modules. One great way to achieve modularity is by creating a layered architecture. This means that the various logical aspects of a system decompose into logical tiers, such as a dataaccess layer, a domain/business layer, a presentation layer, etc. Each layer encapsulates certain concerns into a reusable and generalized abstraction, upon which the other tiers can depend. For example, the data access layer might be the only place in the system that actually reaches out and talks to a database. All other layers call into the data access layer, directly or indirectly, to perform...
tracking img