views:

72

answers:

1

can someone suggest the ideal Unit test cases that may fit in across each of the layers . (which otherwise can be called as a standard).

for instance, in an ASP.NET MVC applictaion using a Repository pattern -

Controller - can assert for View names and format of the data returned to the views , from the controller action methods( i couldnt think of more , if u can please suggest).

Services Layer - ?? what can be written. because they in turn depend on the layers underneath.. ( can some one suggest a Unit Case with example for sevices layer)?.

One trivial question to finish off. Irrespective of the layers , the method being tested makes calls to other instance methods/static methods say,

public List<string> MethodUnderTest()
{

      instance.SomeOtherMethod();
      StaticMethod();

}

in each case it is neccesary to mock the methods calls by moving that to interfaces .? any thoughts on that . ( coz unit Testing by nomenclature should not depend on anything)

Can some

+2  A: 

I recommend reading the Art of Unit Testing. It covers this stuff in detail.

Preet Sangha
It certainly is a good book and quite a bit easier to read that the xUnit patterns book.
RichardOD