Tuesday, January 26, 2010

ValidationAttribute Test Harness updated on Codeplex

Ahead of tomorrow’s 12:00-1:00 Central Brown Bag / Show and Tell over at C4MVC, I made a few changes for the ValidationAttribute Test Harness based on feedback. The changes focus on two areas:

  1. Discoverability: Do we really need to identify all the custom validators on startup? No – MEF handles this very well thank you.
  2. Runtime Statistics: Can we get a picture of what was done on a given run?

These changes were added to software, and the mechanism of calling the Analyze method (1) gives the ability to extend other scanning options and (2) provides for a platform where the MEF discovery results can be reused over multiple calls.

   1: var analyzer = new ValidationAnalyzer();
   2: var results = analyzer.AnalyzeAssembly(typeof (ChangePasswordModel).Assembly, true);
   3:  
   4: Console.WriteLine(results.AnalysisSummary());
   5:             
   6: Assert.That(results.Valid, Is.EqualTo(true), results.CompileErrorMessage());

This is going to be a fun call. We’ll focus on the latest tidbits about how ValidationAttributes are integrated with MVC, a set of ‘gotchas’ that the test harness keeps you clear of and more.

0 comments:

Post a Comment

Twitter Updates