asp.net mvc 3 - MVC Unit Testing -


can explain me real concept of doing unit testing model classes.

public class category {     public int id;     public string name; } 

in test class, saw people writing code this

[testclass] public class categorytest {     [testmethod]     public void category_test()     {         //arrange         category = new category() { intialisation};         //act          //assert         check again have same values not;     } } 

i couldn't see value of testing model classes testing without interacting databases?

unit testing - wiki

unit testing method individual units of source code tested determine if fit use. unit smallest testable part of application. in procedural programming unit may individual function or procedure. in object-oriented programming unit method. unit tests created programmers or white box testers during development process.

unit tests not use actual objects; performed using mock objects.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -