---
title: "Unit Testing your ASP.NET Validators - Validation Everywhere"
url: "https://osherove.com/blog/2006/12/9/unit-testing-your-aspnet-validators-validation-everywhere.md"
canonical: "https://osherove.com/blog/2006/12/9/unit-testing-your-aspnet-validators-validation-everywhere.html"
published: "2006-12-09T23:57:22"
updated: "2006-12-09T23:57:22"
tags: [".NET", ".Net 2.0", "ASP.NET", "Testing Guidelines", "Unit Testing"]
author: "Roy Osherove"
description: "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…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Unit Testing your ASP.NET Validators - Validation Everywhere

By Roy Osherove December 9, 2006 In [.NET](https://osherove.com/blog/category/net), [.Net 2.0](https://osherove.com/blog/category/net-2-0), [ASP.NET](https://osherove.com/blog/category/asp-net), [Testing Guidelines](https://osherove.com/blog/category/testing-guidelines), [Unit Testing](https://osherove.com/blog/category/unit-testing)

**Historical article** · Originally published December 9, 2006; technical details may be outdated.

heynemann [just posted](http://manicprogrammer.com/cs/blogs/heynemann/archive/2006/12/10/250.aspx) about a very nice and **testable** validation framework for ASP.NET called "[Validation Everywhere](http://www.codeplex.com/valever/Release/ProjectReleases.aspx?ReleaseId=1163)".

> "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](http://www.codeplex.com/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](http://manicprogrammer.com/cs/blogs/heynemann/archive/2006/12/10/250.aspx).

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.

## More in .NET

[All posts in .NET](https://osherove.com/blog/category/net)

- Dec 14, 2006

    ### [Vote for the top talks to see at the upcoming MS Israeli Conference](https://osherove.com/blog/2006/12/14/vote-for-the-top-talks-to-see-at-the-upcoming-ms-israeli-con.html)

- Dec 11, 2006

    ### [Html Agility Pack](https://osherove.com/blog/2006/12/11/html-agility-pack.html)

- Nov 30, 2006

    ### [New research shows SQL Server 2005 more secure than Oracle](https://osherove.com/blog/2006/11/30/new-research-shows-sql-server-2005-more-secure-than-oracle.html)

- Nov 7, 2006

    ### [SQL Refactor looks cool](https://osherove.com/blog/2006/11/7/sql-refactor-looks-cool.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
