Unit Testing your ASP.NET Validators - Validation Everywhere - ISerializable - Roy Osherove's Blog

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.

Published Sunday, December 10, 2006 1:57 AM by RoyOsherove

Comments

Sunday, December 10, 2006 10:20 AM by Bernardo Heynemann

# re: Unit Testing your ASP.NET Validators - Validation Everywhere

Thanks for the kind words Roy.

Today ValEver will help you a LOT if you must unit test your validation logic, but it will do a lot more for you once I implement the XML Configuration and ASP.Net Validator part.

When this second release is done, you will use the EXACT same logic whether you are in ASP.Net, Unit Testing or Windows Forms.

One thing I'd really like, though, is that people would follow your guidance, and just take a look at the project, test it, and give some feedback. It could be about whether it's useful, what they miss or joining the project team to help out.

Anyway, thanks again for the mention. It's always nice when your hard work is recognized.

Bernardo Heynemann

Monday, February 26, 2007 9:18 AM by Patrick Vanbrabant

# re: Unit Testing your ASP.NET Validators - Validation Everywhere

Why didn't you use the Spring.Net validation framework.