Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Assignment 2 Effective Unit Test

Course Name:

Effective Unit Test Workshop

Date:

09 13 Apr 2015

Trainer:

Le Hoang Dung

Trainee:

MS Freshers

Build a web application by using either ASP.NET MVC, Entity Framework or Java and Spring
MVC and applied unit test as well as integration test for the below problem:

Create a web page (/Triage/Determine) for:


o Allow user to inputs the three sides of a triangle
o Return the calculation result:
Are they the sides of a triangles? (there is no side that is bigger than the
total of the two other sides, but no less than the subtraction of the other
bigger side to the other smaller side)
If they are three sides of a triangle, what is the type of triangle?
Triangle quilatral
Triangle isocle
A normal triangle
Assumption: the calculation cost is very high so we decide to store all calculations to
database for later usages
o Triangle entity
Side 1
Side 2
Side 3
IsTriangle (True/False)
TriangleType (Normal/Equilateral/Isocele)
Each time user request to evaluate 3 sides
o Check the database to see if they were calculated before
o YES
Get the result for the database and show to user
o NO
Calculate the result
Show to user and save to database for later usages
Report feature (Triangle report)
o Return a statistic report by running a stored procedure created by you at SQL Server
o The stored procedure namely spTriangleCalReport will return a table with two
column, eg:

Ho Chi Minh City Office: e-town Building, 364 Cong Hoa Street, Tan Binh District, Ho Chi Minh City, Vietnam Tel: +84 8 810 6200 Fax: +84 8
810 6201

Assignment 2 Effective Unit Test

TYPE

AMOUNT

NotTriangle

10

Normal

40

Equilateral

Isocele

Please create two additional projects for Unit Test and Integration Test

Unit Test
o Test for business logic of Triangle calculation
o Isolate unit tests by apply mocking technique
Integration Test
o For testing the stored procedure results (from a test database).

The application and the test projects should be well designed and easy to maintain.

Ho Chi Minh City Office: e-town Building, 364 Cong Hoa Street, Tan Binh District, Ho Chi Minh City, Vietnam Tel: +84 8 810 6200 Fax: +84 8
810 6201

You might also like