Share Point Development With Unit Testing

Download Share Point Development With Unit Testing

Post on 20-May-2015




17 download

Embed Size (px)


<ul><li> 1. SharePoint Development with Unit Testing<br />JEREMY THAKE<br /></li></ul> <p> 2. OBJECTIVES<br />To explain the 3 goals of unit testing<br />To explain where you can unit test<br />To describe the 3 approaches to unit testing in SharePoint<br /> 3. Unit Testing<br />Run quickly<br />Run on every developer machine<br />Minimal no config<br />(We are not testing MS code)<br /> 4. Where to test?<br />ASP.NET Web Forms<br />Application Pages<br />Web Parts<br />Event Receivers<br />Feature Receivers<br />Workflow coding activities<br />Timer Jobs<br /> 5. WHAT ITS NOT!<br /> 6. UNIT TEST 101 SETUP<br /> 7. TIGHTLY COUPLED CODE<br /> 8. SharePoint + Mocking<br />Interfaces are rarely used<br />Sealed classes<br />Internal Constructors<br />TypeMockIsolator for SharePoint<br /> 9. MOCKING 101<br /> 10. NATURAL MOCKS<br /> 11. SharePoint Guidance<br /> 12. WRAPPERS &amp; faades<br /> 13. REPOSITORY<br /> 14. MVP Model View Presenter<br /> 15. What to test?<br />TDD - lots of code when 80% is usually SharePoint code<br />Tests functionality and requirements work<br />Can cover scenarios and edge cases<br />Missing or empty URL variable<br />Valid URL variable syntax<br />Existence of the specified site<br />Missing or empty ListName variable<br />Existence of the specified list<br />Valid SPListItemCollection return object<br />Null or empty SPListItemCollection return object<br /> 16. MOCKING LARGE AREAS OF SHAREPOINT<br /> 17. CONCLUSION<br />It not easy<br />Lots of code<br />Benefits<br />when refactoring<br />other developers changing it<br />environment dependencies reduced<br />speed<br />Doesn't stop poor quality code:<br />list.Items.Count<br />Dispose()<br /> 18. JEREMY THAKE<br /><br />@jthake<br /></p>