I had to blog about this because it brought a smile to my face when I saw it.
After some discussion yesterday over the benefits of implementing a REST model in ASP.Net MVC. I was up late last night looking over the MVCContrib project. I came across Adam Tybor’s SimplyRestful contribution.
When I look at most OSS project I usually look at the objects implementation first and then I look for the test coverage.
I found a class named “RestfulActionResolver”, the name alone peek my curiosity. I noticed this class had a ResolveActionMethod that would seem to, resolve the action. I used ReSharper to find the usages of this method to see just how it was being acted upon by other objects(ctrl-alt-F7).
What appeared next shocked me:
The top of the report read like a normal test suite no surprise there but then I quickly noticed the bottom two entries!
Two things shocked me!
- Usage of BDD context/action/behavior (sweet!)
- How well it read from a usage report perspective (double sweet!)
Most of you that read my blog love OSS. I sometimes hate to go into a project and figure out how some OSS project actually works. Lets face it documentation is very pore on OSS projects. But by utilizing a BDD approach the test fixtures and test become self describing meta data for comprehending the intentions and actions of the code.
I know there has been some debate on should the specification files contain multiple class entries defining context.
- File Name: SimplyRestfulSpecs.cs
public class When_The_Form_Is_Posted_With_A_Form_Field_Named_Method_And_A_Value_Of_PUT
public class When_The_Form_Is_Posted_With_A_Form_Field_Named_Method_And_A_Value_Of_DELETE
Well chalk this one up in the “Favor” column for “multiple class entries defining context”. With out this I don’t know if the report would have read as well.