ria 04 & 05 - first asp.net mvc project

Post on 27-Nov-2014

1.052 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

STAATLICHANERKANNTEFACHHOCHSCHULE

Author: Dip.-Inf. (FH) Johannes HoppeDate: 27.10.2010

10.11.2010

STUDIERENUND DURCHSTARTEN.

STAATLICHANERKANNTEFACHHOCHSCHULE

RIA – Rich Internet Applications

Author: Dip.-Inf. (FH) Johannes HoppeDate: 27.10.2010

10.11.2010

First ASP.NET Project: WebNoteMvc

0109.04.2023

Folie 3

First ASP.NET Project: WebNoteMvc

09.04.2023

Folie 4

View(Presentation)

Controller Layer(Application flow controll)

Model(Business Layer)

Service Layer

Repository Layer

Data Access Layer

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)

09.04.2023

Folie 5

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

09.04.2023

Folie 6

Repetition of creating “WebNoteMvc”

0209.04.2023

Folie 7

Repetition of creating “WebNoteMvc”

1. We created a database and a table

09.04.2023

Folie 8

Repetition of creating “WebNoteMvc”

2. We created an EDMX file based on the database

09.04.2023

Folie 9

Repetition of creating “WebNoteMvc”

3. We used the extension ”MCGe v0.3” to generate POCOs

09.04.2023

Folie 10

http://blog.johanneshoppe.de/2010/10/ado-net-mocking-context-generator-extended-walkthrough/

Repetition of creating “WebNoteMvc”

3. We used the extension ”MCGe v0.3” to generate POCOs

09.04.2023

Folie 11

Repetition of creating “WebNoteMvc”

4. We created a repository layer with all CRUD operations

09.04.2023

Folie 12

Repetition of creating “WebNoteMvc”

5. We changed the default controller to provide all CRUD operations

09.04.2023

Folie 13

Repetition of creating “WebNoteMvc”

6. We created views for every Controller operation

09.04.2023

Folie 14

Repetition of creating “WebNoteMvc”

09.04.2023

Folie 15

Repetition of creating “WebNoteMvc”

Questions?

?

09.04.2023

Folie 16

Unit Tests

0309.04.2023

Folie 17

Unit Tests

What?Why?

When?How?

09.04.2023

Folie 18

Unit Tests

What?

A piece of softwarethat (automatically)tests the smallest parts of an application.

09.04.2023

Folie 19

Unit Tests

What?

A unit test enables you to verifywhether a particular method

works as you intend it to work.

09.04.2023

Folie 20

Unit Tests

What?

A unit test is a straightforwardway to produce code

with a low error rate.

09.04.2023

Folie 21

Unit Tests

Why?

09.04.2023

Folie 22

Unit Tests

09.04.2023

Folie 23

Building tests for your code

avoids software bugs.

Unit Tests

09.04.2023

Folie 24

Building tests for your code

provides you with a safety net for change.

Unit Tests

09.04.2023

Folie 25

Building tests for your code

forces you to write loosely coupled code.

Unit Tests

09.04.2023

Folie 26

Building tests for your code

forces you to take a user perspective on the code.

Unit Tests

09.04.2023

Folie 27

Building tests for your code

provides a documentation for future coders.

Unit Tests

When?

09.04.2023

Folie 28

Unit Tests

When?

Always.or

Whenever it is plannedto reuse the software.

09.04.2023

Folie 29

Unit Tests

When?

Beforewriting the actual code.(Test-Driven Development)

09.04.2023

Folie 30

Unit Tests

When?

Test-Driven Development1. Write a unit test that fails.2. Write code that passes the unit tests.3. Refactor your code.

09.04.2023

Folie 31

Unit Tests

09.04.2023

Folie 32

How?

Unit Tests

Questions?

?

09.04.2023

Folie 33

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

09.04.2023

Folie 34

THANK YOUFOR YOUR ATTENTION

09.04.2023

Folie 35

top related