22 model-view-viewmodel et testabilité pour wpf/silverlight richard clark clark ingénierie...
TRANSCRIPT
![Page 1: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/1.jpg)
![Page 2: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/2.jpg)
22
Model-View-ViewModel et testabilité
pour WPF/Silverlight
Richard ClarkClark Ingénierie Informatique
Simon FerquelAccess It
![Page 3: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/3.jpg)
33
Clark Ingénierie Informatique
http://www.c2i.frLivres chez Microsoft Press
Expert CodeFluent 2001-2009 RIP!
Expertise .NET
![Page 4: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/4.jpg)
44
Access It en quelques mots…
Consulting/expertise, réalisation (projet /assistance technique) et formation (CPLS) sur les technologies Microsoft
Haut niveau de certification2 agences à Lille et Paris, couverture nationaleCentre des Usages pour la région Nord
3 grands domaines d’expertise technologiquePlateforme applicative : SharePoint, SQL Server & BI, BizTalk.Net : architecture, Framework & langages, RIA/RDA (Silverlight, WPF, Surface), industrialisation/ALM (TFS/VSTS)…Infrastructure : poste de travail, serveurs, virtualisation, messagerie, annuaire…
http://www.access-it.fr
![Page 5: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/5.jpg)
55
M-V-VM : LA STAR !
Cinch MVVM Light ToolkitMVVM Helpers
MVVM FoundationCaliburn
OnyxCalcium
nRoute
Basic MVVM Framework
GoodLight
Ocean
Nito MVVM …Prism ?
![Page 6: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/6.jpg)
66
M-V-VM : Principes de base
View ViewModel Model
XAML Classe
Databinding
Business Objects
![Page 7: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/7.jpg)
77
M-V-VM
DémoMise en place
![Page 8: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/8.jpg)
88
Testabilité - Pourquoi
Testabilité réparatriceReproduire tout bug de manière automatiséeIsoler le composant fautif et à détecter précisément la
cause de l ' erreurAssurer la non-régression pour la suite du projet
Test Driven DevelopmentAssurer la robustesse des composants dès le départDétecter très tôt la plupart des bugsAssurer la facilité d 'utilisation des composants
![Page 9: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/9.jpg)
99
M-V-VM
Démo
![Page 10: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/10.jpg)
1010
M-V-VM
DémoRelay Command
![Page 11: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/11.jpg)
1111
Testabilité – Comment ? (1)
Isolation :Etre capable de remplacer toutes les dépendances
Paramètres de constructeurInjection de propriétés
Appeler une fonctionnalitéValider l'état après appelValider les communications avec les dépendances
![Page 12: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/12.jpg)
1212
Testabilité – Comment ? (2)
IoC / Injection de dépendancesBeaucoup d'implémentations (Unity, Castle / Windsor,
Spring.Net, StructureMap…)Implémentation Microsoft : Unity
![Page 13: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/13.jpg)
1313
DI : Configuration
Container.RegisterType<SocietesViewModelBase, SocietesViewModel>();
Container.RegisterType<ISocieteDAL, SocieteDAL>(new ContainerControlledLifetimeManager());
Ou fichier de configuration
![Page 14: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/14.jpg)
1414
Utilisation
Appel au container
public class SocietesViewModel : SocietesViewModelBase{ public SocieteViewModel(ISocieteDAL dal){}}…var vm = Container.Resolve<SocietesViewModelBase>();
![Page 15: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/15.jpg)
1515
M-V-VM
Démo
![Page 16: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/16.jpg)
1616
M-V-VM
DémoViewModel « complexe »Méthodes asynchrones
![Page 17: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/17.jpg)
1717
Tester du code asynchrone
Mocker un service asynchroneComprendre le fonctionnement Begin/End
DispatcherComprendre le principe de pompe à messagesLe test doit déclencher la pompe…Mais ne doit pas la bloquer…Attention, il va y avoir des Threads !
Pour Silverlight : C'est beaucoup plus simple !
![Page 18: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/18.jpg)
1818
M-V-VM
Démo
![Page 19: 22 Model-View-ViewModel et testabilité pour WPF/Silverlight Richard Clark Clark Ingénierie Informatique Simon Ferquel Access It](https://reader035.vdocuments.us/reader035/viewer/2022062622/551d9da7497959293b8d8a3a/html5/thumbnails/19.jpg)
1919
M-V-VM
Questions ?