WPF and MVVM: Test Driven Development of ViewModels

Testing your ViewModels while they're in development can help you create better apps. In this course, you'll learn how to use test-driven development (TDD) to build the ViewModels of your MVVM application.
Course info
Rating
(127)
Level
Intermediate
Updated
Apr 12, 2016
Duration
5h 22m
Table of contents
Course Overview
Introduction
Getting Started with Unit Testing
Writing Testable ViewModels
Mocking Dependencies with Moq
Testing and Implementing the Loading of Friends
Closing Tabs and Saving a Friend
Adding a New Friend
Deleting an Existing Friend
Interacting with Dialogs in MVVM
Description
Course info
Rating
(127)
Level
Intermediate
Updated
Apr 12, 2016
Duration
5h 22m
Description

When applying the MVVM pattern, the UI-logic is placed in ViewModels. A key advantage of such a ViewModel is that it is highly testable. In this course, WPF and MVVM: Test Driven Development of ViewModels, you'll learn the specifics of unit testing within MVVM. You'll discover how to create and run unit tests in Visual Studio with the popular testing framework xUnit, and how to write testable ViewModels by moving out typical dependencies like data access logic, event aggregator, modal dialogs and more. Next, you'll be taught how to mock/fake these dependencies in your unit tests by using the mocking library, Moq, as well as inject the dependencies into your ViewModels with a dependency injection framework called Autofac while running your application. Finally, you'll build and unit-test the ViewModels for an MVVM app called FriendStorage from 'empty class' to final by using test-driven development. By the end of this course, you'll understand how to develop your ViewModels through testing in order to create better apps than ever.

About the author
About the author

Thomas is a well-known author, software developer, and speaker from Germany. He specializes in .NET, C#, TypeScript, XAML, and Azure.

More from the author
Testing .NET Code in Visual Studio 2019
Intermediate
2h 53m
Jul 16, 2019
More courses by Thomas Claudius Huber
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone! My name is Thomas Claudius Huber, and welcome to my course, WPF and MVVM: Test Driven Development of ViewModels. I am a Microsoft MVP for Windows development, and I have a passion for user interfaces. When I build a WPF application, I usually apply the MVVM pattern. The big advantage of the MVVM pattern is that you can test the complete code of your ViewModel with unit tests. This course is an introduction to test-driven development of ViewModels. Test-driven development means that you write your unit tests before you implement the actual logic. Some of the major topics that we will cover include creating unit tests in Visual Studio with xUnit, writing testable ViewModels by abstracting away dependencies, mocking dependencies with the Moq library, testing the ViewModels of the FriendStorage application, and also testing dialog interactions in MVVM. By the end of the course, you will know how to develop your ViewModels in a test-driven way to improve the quality and maintainability of your MVVM applications. For this course, no prior experience with unit testing and test-drive development is required. I hope you will join me on this journey to learn how to develop your ViewModels in a test-driven way with the course, WPF and MVVM: Test Driven Development of ViewModels at Pluralsight.