PS> msbuild .\My.proj /v:d
One challenge with testing it this way is that the output has a lot of non-repeatable test, including timestamps. Just to make things easier, I'll elevate the logging importance to "high".
Log.LogMessage(MessageImportance.High, " Foo = {0}", this.Foo);
Then I'll run with minimal verbosity, and nologo to clean up the output:
PS> msbuild .\My.proj /v:m /nologo Inputs: Foo = hi
Now I need to actually write a test. The simplest test I can think of:
Loading Gist 7518446
Note that I wrote the expected output as empty, to see the exact actual output (which is already known good, since I'm writing the test after the fact). I'll grab that actual output, make it the expected value, and the test will pass. That way of working is the basis of Llewellyn Falco's ApprovalTests, which I may switch to in a future step. But for now, make the test pass & check in:
const string expected = @" Inputs: Foo = hi ";
No comments:
Post a Comment