Terse controller testing with ASP.NET MVC (part 1)

As I alluded to in a previous post, I think that achieving high code coverage in controller tests is often a waste of time in terms of return on investment – most of the stuff in there will be trivial things that either work or don’t and will be hard to regressively break (e.g. returning the view with the model if model validation failed). In saying that, if there is a way to get really terse tests then they become easier to write and maintain and then it’s worth aiming for high code coverage (since the reward outweighs the cost).
Continue reading “Terse controller testing with ASP.NET MVC (part 1)”

Simulating Tag Syntax with Razor Templating

When using a templating language to output HTML it’s often quite useful and natural to have the concept of a “tag” syntax e.g. (using some random custom ColdFusion tags as an example):

  • Self-closing: <cf_form_field label="Some Label" value="The value" />
  • Nested: <cf_form_section heading="Some heading"> ... </cf_form_section>

The tags would implicitly output to the page and can be side-by-side with HTML code without needing start and end code delimiters (such as <% … %> or <? … ?>, etc.).
Continue reading “Simulating Tag Syntax with Razor Templating”