Ria 04 & 05 - First ASP.NET MVC project

1,011 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
1,011
On SlideShare
0
From Embeds
0
Number of Embeds
199
Actions
Shares
0
Downloads
54
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ria 04 & 05 - First ASP.NET MVC project

  1. 1. STAATLICH ANERKANNTE FACHHOCHSCHULE Author: Dip.-Inf. (FH) Johannes Hoppe Date: 27.10.2010 10.11.2010 STUDIEREN UND DURCHSTARTEN.
  2. 2. STAATLICH ANERKANNTE FACHHOCHSCHULE RIA – Rich Internet Applications Author: Dip.-Inf. (FH) Johannes Hoppe Date: 27.10.2010 10.11.2010
  3. 3. First ASP.NET Project: WebNoteMvc 01 30.01.2015 Folie 3
  4. 4. First ASP.NET Project: WebNoteMvc 30.01.2015 Folie 4 View (Presentation) Controller Layer (Application flow controll) Model (Business Layer) Service Layer Repository Layer Data Access Layer
  5. 5. First ASP.NET Project: WebNoteMvc Tiers for the Model › Service Layer › Sub-Applications boundary  “Access from outside” › CRUD, Validation, Transactions… › A good place to “talk” with other repositories › Repository Layer › “Shields” application from real data access › A good place for caching › Data Access Layer (here: Entity Framework) › Data mapper that moves data between objects and a database (brutally simplified Martin Fowler: Patterns of Enterprise Application Architecture) 30.01.2015 Folie 5
  6. 6. First ASP.NET Project: WebNoteMvc Implementation › 1. We created a database and a table › 2. We created an EDMX file based on the database › 3. We used the plugin ”MCGe” to generate POCOs › 4. We created a repository layer with all CRUD operations › We did not created a service layer (for now) › 5. We changed the default controller to provide all CRUD operations › 6. We created views for every Controller operation http://code.google.com/p/lecture- hoppe/downloads/detail?name=WebNoteMvc_v0.3.zip 30.01.2015 Folie 6
  7. 7. Repetition of creating “WebNoteMvc” 02 30.01.2015 Folie 7
  8. 8. Repetition of creating “WebNoteMvc” 1. We created a database and a table 30.01.2015 Folie 8
  9. 9. Repetition of creating “WebNoteMvc” 2. We created an EDMX file based on the database 30.01.2015 Folie 9
  10. 10. Repetition of creating “WebNoteMvc” 3. We used the extension ”MCGe v0.3” to generate POCOs 30.01.2015 Folie 10 http://blog.johanneshoppe.de/2010/10/ado-net-mocking-context-generator- extended-walkthrough/
  11. 11. Repetition of creating “WebNoteMvc” 3. We used the extension ”MCGe v0.3” to generate POCOs 30.01.2015 Folie 11
  12. 12. Repetition of creating “WebNoteMvc” 4. We created a repository layer with all CRUD operations 30.01.2015 Folie 12
  13. 13. Repetition of creating “WebNoteMvc” 5. We changed the default controller to provide all CRUD operations 30.01.2015 Folie 13
  14. 14. Repetition of creating “WebNoteMvc” 6. We created views for every Controller operation 30.01.2015 Folie 14
  15. 15. Repetition of creating “WebNoteMvc” 30.01.2015 Folie 15
  16. 16. Repetition of creating “WebNoteMvc” Questions? ? 30.01.2015 Folie 16
  17. 17. Unit Tests 03 30.01.2015 Folie 17
  18. 18. Unit Tests What? Why? When? How? 30.01.2015 Folie 18
  19. 19. Unit Tests What? A piece of software that (automatically) tests the smallest parts of an application. 30.01.2015 Folie 19
  20. 20. Unit Tests What? A unit test enables you to verify whether a particular method works as you intend it to work. 30.01.2015 Folie 20
  21. 21. Unit Tests What? A unit test is a straightforward way to produce code with a low error rate. 30.01.2015 Folie 21
  22. 22. Unit Tests Why? 30.01.2015 Folie 22
  23. 23. Unit Tests 30.01.2015 Folie 23 Building tests for your code avoids software bugs.
  24. 24. Unit Tests 30.01.2015 Folie 24 Building tests for your code provides you with a safety net for change.
  25. 25. Unit Tests 30.01.2015 Folie 25 Building tests for your code forces you to write loosely coupled code.
  26. 26. Unit Tests 30.01.2015 Folie 26 Building tests for your code forces you to take a user perspective on the code.
  27. 27. Unit Tests 30.01.2015 Folie 27 Building tests for your code provides a documentation for future coders.
  28. 28. Unit Tests When? 30.01.2015 Folie 28
  29. 29. Unit Tests When? Always. or Whenever it is planned to reuse the software. 30.01.2015 Folie 29
  30. 30. Unit Tests When? Before writing the actual code. (Test-Driven Development) 30.01.2015 Folie 30
  31. 31. Unit Tests When? Test-Driven Development 1. Write a unit test that fails. 2. Write code that passes the unit tests. 3. Refactor your code. 30.01.2015 Folie 31
  32. 32. Unit Tests 30.01.2015 Folie 32 How?
  33. 33. Unit Tests Questions? ? 30.01.2015 Folie 33
  34. 34. Unit Tests Your tasks: › Try to write your first set of unit tests › Work together with you neighbor (2 persons, one team) › Use the Mock-Framework “Moq” from www.moq.me › Implement:  AddNoteTest, EditNoteTest, DeleteNoteTest  DeleteNoteShouldThrowExceptionTest  GetNoteShouldNotCallSaveChangesTest  6 Tests for the Controller 30.01.2015 Folie 34
  35. 35. THANK YOU FOR YOUR ATTENTION 30.01.2015 Folie 35

×