Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 1.99 KB

README.md

File metadata and controls

25 lines (16 loc) · 1.99 KB

ControllerTests Build status

tl;dr

  • Use Install-Package mk.ControllerTests to quickly build subcutaneous style tests for MVC/webapi controllers or any arbitrary "top of stack" interface.
  • Use MvcControllerTestBase to test a single action on a System.Web.Mvc.Controller. The idea is that you will set up real state in a store/database and make assertions against it, thus testing from the top[ish] of the stack all the way into a real store.
  • Use ApiControllerTestBase to test behaviour on an ApiController. We use the WebApi 2 message pipeline and send a real HttpRequestMessage. This way we can even test filters and other MVC internals.
  • If you have a service/abstraction that say, you use as an entry point for a background task, use that interface with the AnyControllerTestBase to test it's methods, and the behaviour all the way into the store.
  • Used successfully with real/lcoaldb MSSQL, embedded RavenDB, in-memory Event Store.

Why?

TODO: confidence, ROI, etc

Examples

MVC controller

WebApi controller