What:

A “validation” “framework” that, by default convention, does not throw exceptions but instead sets a failed property and builds a list of fail messages.

“Validation”

I took inspiration from the many other server-side validation frameworks.

“Framework”

It’ is just one (fugly) class, < 300 LOC and 70+ tests.

Samples

Take a look at the tests!

http://github.com/detroitpro/Checkers/blob/master/CheckersTests/FluentAPIDesignTests.cs

 check.That(2).IsA(typeof(string)).Or("2 is not a string fail");
Features
  • That – the item to be checked
  • IsNotNull – null check
  • IsGreaterThan, IsGreatherThanOrEqualTo, IsLessThan, IsLessThanOrEqualTo
  • Is – equality checking for int and string
  • IsA – type checking
  • Or – Override default fail message
  • Fail – No more checks if current check fails
  • EpicFail – throw exception
Source

http://github.com/detroitpro/Checkers

Why?

There are so many ways I could answer this question. I’ll just tell you how I thought it would be used.

In a SOA environment where we:

  • Don’t want to use exceptions to control business logic flow.
  • Don’t want to send exceptions over the wire to our UI/Web servers.
  • Don’t want to send exceptions up to our partner API.
  • Need to squeeze performance out of our underpowered servers.
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

  3 Responses to “Checkers – Fluent “Checking” Framework”

  1. You always find the newest toys. Now am I understanding this correctly in saying that this can be used outside of unit testing? Say for checking inputs for a service or action?

  2. Yeah I figured that out (that you wrote it) minutes after I posted the comment. Shouldn’t be a surprise though, I’m not exactly the brightest tool in the bunch.

    Looks interesting though.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2012 eric.polerecky.com Suffusion theme by Sayontan Sinha