Friday, October 22, 2004

Snippet Compiler

One of my biggest annoyances with designing orchestrations in BizTalk is how you test expressions. As an example, this morning I've been working with Timespans, and wanted to know:
  • whether you could have a negative timespan (by subtracting the current datetime from a date in the past)
  • what happens if you put a negative timespan into a delay shape.
I decided I needed to run a few lines to sanity-check what I was trying to do, using the following code:
// to generate a negative timespan value subtract a date from an earlier date.
System.DateTime deadline = System.DateTime.Now;
System.Threading.Thread.Sleep(1000);
System.TimeSpan timespan = deadline.Subtract(System.DateTime.Now);
// what is the expected value of timespan - can it be negative, and if so - what happens now:
System.Threading.Thread.Sleep(timespan);

I didn't want to open a new console project to work this out, so I dug around and came across SnippetCompiler (a colleague pointed me at it). This allows you to test small snippets without going through the whole "new...project" routine, and looks like becoming invaluable.
I do have a couple of gripes with the AutoComplete / IntelliSense functionality, but it's probably unreasonable to complain when it's free ;-) .

No comments: