Test Driving a MVVM app<br />Emanuele DelBono <br />emanuele@codiceplastico.com<br />http://blog.codiceplastico.com/ema<br...
Who I am<br />Dev in CodicePlastico<br />C#WPF/ASP.NET MVC<br />Ruby/Ruby on Rails<br />TDD passionate<br />UgiALT.NET fou...
Agenda<br />Very short intro to TDD<br />2 pomodori of live coding<br />Q&A&Discussion<br />
Prerequisites<br />MVVM pattern<br />Testing framework<br />Test doubles (Mock/Stub)<br />
Doubts?<br />
MVVM in one slide<br />View<br />textbox<br />button<br />Properties<br />listbox<br />Commands<br />ViewModel<br />Model<...
Testing Frameworks<br />An xUnit tool to<br />Minimize effort in writing tests<br />Simplify the running phase<br />Usuall...
Test doubles<br />To keep the focus on the tested object we need to remove all the dependencies<br />Test doubles act as “...
TDD<br />Test Driven Development / Test Driven Design<br />A design practice<br />3 simple rules<br />Write no production ...
Sample App<br />A simple Todo list manager<br />When the app starts  I want see the to do list<br />I want to be able to a...
Tools<br />Visual Studio 2010 / Expression Blend<br />Resharper<br />xUnit + xUnitContrib<br />Moq<br />Pomodoro<br />
First step<br />
Let’s Code<br />
Thanks<br />References:<br />Growing object oriented software – Freeman, Pryce – Addison Wesley<br />The art of Unit Testi...
…un ultimacosa…<br />12 e 13 Giugno<br />…ricordatevidei referendum <br />
Upcoming SlideShare
Loading in …5
×

Test driving an MVVM App

4,935 views

Published on

A brief introduction on how to write a WPF/MVM application in Test Driven Development

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,935
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Test driving an MVVM App

  1. 1. Test Driving a MVVM app<br />Emanuele DelBono <br />emanuele@codiceplastico.com<br />http://blog.codiceplastico.com/ema<br />Twitter @emadb<br />
  2. 2. Who I am<br />Dev in CodicePlastico<br />C#WPF/ASP.NET MVC<br />Ruby/Ruby on Rails<br />TDD passionate<br />UgiALT.NET founder<br />Speaker/blogger<br />
  3. 3. Agenda<br />Very short intro to TDD<br />2 pomodori of live coding<br />Q&A&Discussion<br />
  4. 4. Prerequisites<br />MVVM pattern<br />Testing framework<br />Test doubles (Mock/Stub)<br />
  5. 5. Doubts?<br />
  6. 6. MVVM in one slide<br />View<br />textbox<br />button<br />Properties<br />listbox<br />Commands<br />ViewModel<br />Model<br />
  7. 7. Testing Frameworks<br />An xUnit tool to<br />Minimize effort in writing tests<br />Simplify the running phase<br />Usually is an assembly to reference in your test projects, with:<br />A bunch of attributes to mark the test methods<br />A bunch of asserts to verify your expectations<br />
  8. 8. Test doubles<br />To keep the focus on the tested object we need to remove all the dependencies<br />Test doubles act as “fake” dependencies that replace the real ones<br />Frameworks like Moq, RhinoMock, etc…came to help<br />
  9. 9. TDD<br />Test Driven Development / Test Driven Design<br />A design practice<br />3 simple rules<br />Write no production code without failing tests<br />Write only enough test code so that it fails<br />Write only enough production code to get your tests to pass<br />Robert (uncle bob) Martin<br />
  10. 10. Sample App<br />A simple Todo list manager<br />When the app starts I want see the to do list<br />I want to be able to add a new Item specifing a description and a due date<br />I want to be able to delete an item<br />I want to be able to mark an item as complete<br />
  11. 11. Tools<br />Visual Studio 2010 / Expression Blend<br />Resharper<br />xUnit + xUnitContrib<br />Moq<br />Pomodoro<br />
  12. 12. First step<br />
  13. 13. Let’s Code<br />
  14. 14. Thanks<br />References:<br />Growing object oriented software – Freeman, Pryce – Addison Wesley<br />The art of Unit Testing – RoyOsherove - Manning<br />http://xunitpatterns.com/<br />http://www.mockobjects.com/<br />Code<br />http://wpftodolist.googlecode.com<br />
  15. 15. …un ultimacosa…<br />12 e 13 Giugno<br />…ricordatevidei referendum <br />

×