Test Driving a MVVM appEmanuele DelBono emanuele@codiceplastico.comhttp://blog.codiceplastico.com/emaTwitter @emadb
Who I amDev in CodicePlasticoC#WPF/ASP.NET MVCRuby/Ruby on RailsTDD passionateUgiALT.NET founderSpeaker/blogger
AgendaVery short intro to TDD2 pomodori of live codingQ&A&Discussion
PrerequisitesMVVM patternTesting frameworkTest doubles (Mock/Stub)
Doubts?
MVVM in one slideViewtextboxbuttonPropertieslistboxCommandsViewModelModel
Testing FrameworksAn xUnit tool toMinimize effort in writing testsSimplify the running phaseUsually is an assembly to reference in your test projects, with:A bunch of attributes to mark the test methodsA bunch of asserts to verify your expectations
Test doublesTo keep the focus on the tested object we need to remove all the dependenciesTest doubles act as “fake” dependencies that replace the real onesFrameworks like Moq, RhinoMock, etc…came to help
TDDTest Driven Development / Test Driven DesignA design practice3 simple rulesWrite no production code without failing testsWrite only enough test code so that it failsWrite only enough production code to get your tests to passRobert (uncle bob) Martin
Sample AppA simple Todo list managerWhen the app starts  I want see the to do listI want to be able to add a new Item specifing a description and a due dateI want to be able to delete an itemI want to be able to mark an item as complete
ToolsVisual Studio 2010 / Expression BlendResharperxUnit + xUnitContribMoqPomodoro
First step
Let’s Code
ThanksReferences:Growing object oriented software – Freeman, Pryce – Addison WesleyThe art of Unit Testing – RoyOsherove - Manninghttp://xunitpatterns.com/http://www.mockobjects.com/Codehttp://wpftodolist.googlecode.com
…un ultimacosa…12 e 13 Giugno…ricordatevidei referendum 

Test driving an MVVM App

  • 1.
    Test Driving aMVVM appEmanuele DelBono emanuele@codiceplastico.comhttp://blog.codiceplastico.com/emaTwitter @emadb
  • 2.
    Who I amDevin CodicePlasticoC#WPF/ASP.NET MVCRuby/Ruby on RailsTDD passionateUgiALT.NET founderSpeaker/blogger
  • 3.
    AgendaVery short introto TDD2 pomodori of live codingQ&A&Discussion
  • 4.
  • 5.
  • 6.
    MVVM in oneslideViewtextboxbuttonPropertieslistboxCommandsViewModelModel
  • 7.
    Testing FrameworksAn xUnittool toMinimize effort in writing testsSimplify the running phaseUsually is an assembly to reference in your test projects, with:A bunch of attributes to mark the test methodsA bunch of asserts to verify your expectations
  • 8.
    Test doublesTo keepthe focus on the tested object we need to remove all the dependenciesTest doubles act as “fake” dependencies that replace the real onesFrameworks like Moq, RhinoMock, etc…came to help
  • 9.
    TDDTest Driven Development/ Test Driven DesignA design practice3 simple rulesWrite no production code without failing testsWrite only enough test code so that it failsWrite only enough production code to get your tests to passRobert (uncle bob) Martin
  • 10.
    Sample AppA simpleTodo list managerWhen the app starts I want see the to do listI want to be able to add a new Item specifing a description and a due dateI want to be able to delete an itemI want to be able to mark an item as complete
  • 11.
    ToolsVisual Studio 2010/ Expression BlendResharperxUnit + xUnitContribMoqPomodoro
  • 12.
  • 13.
  • 14.
    ThanksReferences:Growing object orientedsoftware – Freeman, Pryce – Addison WesleyThe art of Unit Testing – RoyOsherove - Manninghttp://xunitpatterns.com/http://www.mockobjects.com/Codehttp://wpftodolist.googlecode.com
  • 15.
    …un ultimacosa…12 e13 Giugno…ricordatevidei referendum 