Follow @RoyOsherove on Twitter

Unit Testing your ASP.NET Validators - Validation Everywhere

heynemann just posted about a very nice and testable validation framework for ASP.NET called "Validation Everywhere".

"The Validation Everywhere project was born because I have a very complex UI that I need to unit test. This UI is built using MVP Architecture (Powered by NMVP), but in ASP.Net it has a lot of Validators logic to perform UI Validation. Since this logic is extremely complex I need to unit test it. ?"

Example can be seen here.

I'd highly recommend taking a look, mainly because if you do a lot of custom validation, or you simply have one validation with lots of logic in it, you would want to make sure it works.  the best way to do that is to write unit tests or it, which is hard to do when you have those things running under ASP.NET.

The V.E framework releases you from that burden by separating concerns - running the validator under its own context, giving you a simple interface you need to implement in your own validator.

Testable code is still not very easy to find. When a framework is written specifically with testability in mind, I'd take a long hard look at that.

Macro - Workaround for VS 2005 unit testing build problem

Video: Implementing Continuous Integration: With and Without Team System