<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tim Van Wassenhove &#187; Visual Studio</title>
	<atom:link href="http://www.timvw.be/category/information-technology/visual-studio/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.timvw.be</link>
	<description>The journey of a thousand miles begins with one step.</description>
	<lastBuildDate>Thu, 29 Jul 2010 17:07:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Add &#8220;Run as administrator&#8221; to .sln files</title>
		<link>http://www.timvw.be/add-run-as-administrator-to-sln-files/</link>
		<comments>http://www.timvw.be/add-run-as-administrator-to-sln-files/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 19:07:01 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=1611</guid>
		<description><![CDATA[Another trick i learned from the &#8220;How-To Geek&#8221; is how to add a &#8220;Run as administrator&#8221; option in the windows shell for .sln files which makes life considerably easier AddRunAsAdministratorToSlnFilesInShell.reg.txt AddRunAsAdministratorAsDefaultToSlnFilesInShell.reg.txt]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.howtogeek.com/howto/windows-vista/add-run-as-administrator-to-any-file-type-in-windows-vista/">Another trick</a> i learned from the &#8220;How-To Geek&#8221; is how to add a &#8220;Run as administrator&#8221; option in the windows shell for .sln files which makes life considerably easier <img src='http://www.timvw.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<ul>
<li><a href="http://www.timvw.be/wp-content/code/csharp/AddRunAsAdministratorToSlnFilesInShell.reg.txt">AddRunAsAdministratorToSlnFilesInShell.reg.txt</a></li>
<li><a href="http://www.timvw.be/wp-content/code/csharp/AddRunAsAdministratorAsDefaultToSlnFilesInShell.reg.txt">AddRunAsAdministratorAsDefaultToSlnFilesInShell.reg.txt</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/add-run-as-administrator-to-sln-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSTEST tip: Add &#8216;Full Class Name&#8217; column to results view</title>
		<link>http://www.timvw.be/mstest-tip-add-full-class-name-column-to-results-view/</link>
		<comments>http://www.timvw.be/mstest-tip-add-full-class-name-column-to-results-view/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 08:22:36 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=1339</guid>
		<description><![CDATA[I firmly believe that adding the &#8216;Full Class Name&#8217; column to MSTEST&#8217;s result view makes it a lot easier to clarify the requirements:]]></description>
			<content:encoded><![CDATA[<p>I firmly believe that adding the &#8216;Full Class Name&#8217; column to MSTEST&#8217;s result view makes it a lot easier to clarify the requirements:</p>

<img src="http://www.timvw.be/wp-content/images/mstest-result-enhanced.png" alt="screenshot of mstest result view with full class name column added" /> ]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/mstest-tip-add-full-class-name-column-to-results-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About the design of a fluent interface</title>
		<link>http://www.timvw.be/about-the-design-of-a-fluent-interface/</link>
		<comments>http://www.timvw.be/about-the-design-of-a-fluent-interface/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 13:59:43 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=1184</guid>
		<description><![CDATA[Now that i have presented a simple ControlStateMachine i can raise the bar a little. A statemachine that handles commands. Here is how a developer should be able to initialize this machine: sut.WhenIn(States.Loading) .On(Commands.Next) .Do(() =&#62; Console.WriteLine(&#34;got next command while loading...&#34;)) .Do(() =&#62; Console.WriteLine(&#34;doing it again...&#34;)) .On(Commands.Previous) .Do(() =&#62; Console.WriteLine(&#34;got previous command while loading...&#34;)); sut.WhenIn(States.Ready) [...]]]></description>
			<content:encoded><![CDATA[<p>Now that i have <a href="">presented a simple ControlStateMachine</a> i can raise the bar a little. A statemachine that handles commands. Here is how a developer should be able to initialize this machine:</p>

<pre class="brush: csharp;">sut.WhenIn(States.Loading)
 .On(Commands.Next)
  .Do(() =&gt; Console.WriteLine(&quot;got next command while loading...&quot;))
  .Do(() =&gt; Console.WriteLine(&quot;doing it again...&quot;))
 .On(Commands.Previous)
  .Do(() =&gt; Console.WriteLine(&quot;got previous command while loading...&quot;));

sut.WhenIn(States.Ready)
 .On(Commands.Previous)
  .Do(() =&gt; Console.WriteLine(&quot;got previous command while ready...&quot;));</pre>

<p>So how should we define our methods to accomplish this initialization style? Let&#8217;s begin with identifying the methods we need.</p>

<ul>
<li>WhenIn(TSTate state)</li>
<li>On(TCommand command)</li>
<li>Do(Action action)</li>
</ul>

<p>Next thing to do is analyze in which sequence these methods can be called:</p>

<table>
<tr><th style="width: 200px">From -> To</th><th style="width: 100px">WhenIn</th><th style="width: 100px">On</th><th style="width: 100px">Do</th></tr>
<tr><td>WhenIn</td><td></td><td>X</td><td></td></tr>
<tr><td>On</td><td></td><td></td><td>X</td></tr>
<tr><td>Do</td><td></td><td>X</td><td>X</td></tr>
</table>

<p>Ok, now that we have clarified the requirements a little we can start working on a solution. Let&#8217;s start with defining an interface for each of the methods:</p>

<pre class="brush: csharp;">interface IChooseState&lt;TState, TCommand&gt; { Q1 WhenIn(TState state); }
interface IChooseCommand&lt;TState, TCommand&gt; { Q2 On(TCommand command); }
interface IChooseAction&lt;TState, TCommand&gt; { Q3 Do(Action action); }</pre>

<p>From WhenIn we need to be able to call On. Thus Q1 = IChooseCommand&lt;TState, TCommand&gt;. Q2 is also easily solved because from On we only have to be able to call Do, thus Q2 = IChooseAction&lt;TState, TCommand&gt;.</p>

<p>From Do we should be able to call both On and Do. We can do that by defining another interface which has both methods:</p>

<pre class="brush: csharp;">interface IChooseCommandAndAction&lt;TState, TCommand&gt; : IChooseCommand&lt;TState, TCommand&gt;, IChooseAction&lt;TState, TCommand&gt; { }</pre>

<p>Now that we have found answers for Q1, Q2 and Q3 we can define the API for initializing our StateMachine as following:</p>

<pre class="brush: csharp;">IChooseCommand&lt;TState, TCommand&gt; WhenIn(TState state);
IChooseAction&lt;TState, TCommand&gt; On(TCommand command);
IChooseCommandAndAction&lt;TState, TCommand&gt; Do(Action action);</pre>

<p>Now tell me about your strategy for implementing a fluent interface!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/about-the-design-of-a-fluent-interface/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VS2010: Unable to insert a breakpoint by clicking next to the line number</title>
		<link>http://www.timvw.be/vs2010-unable-to-insert-a-breakpoint-by-clicking-next-to-the-line-number/</link>
		<comments>http://www.timvw.be/vs2010-unable-to-insert-a-breakpoint-by-clicking-next-to-the-line-number/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 14:49:52 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=1085</guid>
		<description><![CDATA[For some reason i was unable to insert a breakpoint by clicking next to the line number in VS2010. Anyway, here is the trick that made the problem disappear for me: Go to &#8220;Tools > Import and export settings&#8230; &#8221; and choose &#8220;Reset all settings&#8221;.]]></description>
			<content:encoded><![CDATA[<p>For some reason i was <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=464203">unable to insert a breakpoint by clicking next to the line number</a> in VS2010. Anyway, here is the trick that made the problem disappear for me: Go to &#8220;Tools > Import and export settings&#8230; &#8221; and choose &#8220;Reset all settings&#8221;.</p>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/vs2010-unable-to-insert-a-breakpoint-by-clicking-next-to-the-line-number/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Another reason for not using mstest</title>
		<link>http://www.timvw.be/another-reason-for-not-using-mstest/</link>
		<comments>http://www.timvw.be/another-reason-for-not-using-mstest/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 06:11:43 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=857</guid>
		<description><![CDATA[As you can read in CA1001: Types that own disposable fields should be disposable. Pretty solid advice, but for some reason the mstest runner does not dispose of classes that implement IDisposable. A possible workaround is to apply a TestCleanupAttribute to the Dispose method, but this is really contradictory with the &#8220;Shared test fixture&#8221; approach [...]]]></description>
			<content:encoded><![CDATA[<p>As you can read in <a href="http://msdn.microsoft.com/en-us/library/ms182172(VS.80).aspx">CA1001</a>: Types that own disposable fields should be disposable. Pretty solid advice, but for some reason the mstest runner does not dispose of classes that implement IDisposable. A possible workaround is to apply a <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.testcleanupattribute(VS.80).aspx">TestCleanupAttribute</a> to the Dispose method, but this is really contradictory with the &#8220;Shared test fixture&#8221; approach mstest uses. Imho, there is only one clean solution: use a decent testing framework instead.</p>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/another-reason-for-not-using-mstest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presenting MyTestRunner</title>
		<link>http://www.timvw.be/presenting-mytestrunner/</link>
		<comments>http://www.timvw.be/presenting-mytestrunner/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 12:58:11 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=751</guid>
		<description><![CDATA[Here are a couple of reasons why i dislike the Unit Testing Framework that comes with Visual Studio Team System: Not all versions of Visual Studio are capable of running the tests. Test inheritance is not supported. Running tests via mstest.exe is slow. Visual Studio creating tens of .vmsdi files. There are already a couple [...]]]></description>
			<content:encoded><![CDATA[<p>Here are a couple of reasons why i dislike the <a href="http://msdn.microsoft.com/en-us/library/ms243147(VS.80).aspx">Unit Testing Framework</a> that comes with <a href="http://msdn.microsoft.com/en-us/library/fda2bad5(VS.80).aspx">Visual Studio Team System</a>:</p>

<ul>
<li>Not all versions of Visual Studio are capable of running the tests.</li>
<li>Test inheritance is not supported.</li>
<li>Running tests via mstest.exe is slow.</li>
<li>Visual Studio creating tens of .vmsdi files.</li>
</ul>

<p>There are already a couple of better frameworks out there, and currently <a href="http://mbunit.com/">MbUnit</a> is my favorite one, certainly in combination with <a href="http://www.testdriven.net/">TestDriven.NET</a>.</p>

<p>I have created a custom implementation of the Microsoft.VisualStudio.QualityTools.UnitTestingFramework assembly. Actually, the assembly only has a couple of Attributes for the moment but contributions are always welcome <img src='http://www.timvw.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<p>In order to achieve better performance i decided to implement a custom test runner. Currently <a href="http://www.gallio.org/">Gallio</a> uses mstest.exe but there might be a day that i decide to write a plugin so that mytestrunner can be used instead.</p>

<p>I was inspired by <a href="http://docs.mbunit.com/help/html/MbUnitAndVisualStudio/CreatingSelfTestingAssemblies.htm">Creating Self-testing Assemblies</a> and decided to use that approach but for some odd reason visual studio insists on running unit tests although the assembly is a console application <img src='http://www.timvw.be/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  Anyway, i can still invoke mytestrunner via the external tools as following:</p>

<img src="http://www.timvw.be/wp-content/images/mytestrunner-external-tools.gif" alt="screenshot of external tools dialog"/>

<p>The source code is available at <a href="http://code.google.com/p/mytestrunner/">http://code.google.com/p/mytestrunner/</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/presenting-mytestrunner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Revisited the int and string ValueObject templates</title>
		<link>http://www.timvw.be/revisited-the-int-and-string-valueobject-templates/</link>
		<comments>http://www.timvw.be/revisited-the-int-and-string-valueobject-templates/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 16:08:45 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=677</guid>
		<description><![CDATA[After reading The Compare Contract last week i realized that my templates for int and string ValueObjects did not comply with the contract so i decided to add a unittest that reproduces the faulty behavior (and then corrected the implementation): /// &#60;summary&#62; /// When comparing instance with null, instance should be greater. /// &#60;/summary&#62; [TestMethod] [...]]]></description>
			<content:encoded><![CDATA[<p>After reading <a href="http://blogs.msdn.com/bclteam/archive/2008/10/06/the-compare-contract-kim-hamilton.aspx">The Compare Contract</a> last week i realized that my <a href="http://www.timvw.be/presenting-templates-for-int-and-string-valueobjects">templates for int and string ValueObjects</a> did not comply with the contract so i decided to add a unittest that reproduces the faulty behavior (and then corrected the implementation):</p>

<pre class="brush: csharp;">/// &lt;summary&gt;
/// When comparing instance with null, instance should be greater.
/// &lt;/summary&gt;
[TestMethod]
public void ShouldReturnPositiveWhenComparedWithNull()
{
 $classname$ value = new $classname$(&quot;0&quot;);
 Assert.IsTrue(value.CompareTo(null) &gt; 0);
}</pre>

<p>Anyway, feel free to download the corrected <a href="http://www.timvw.be/wp-content/code/csharp/IntValueObject.zip">IntValueObject</a> and <a href="http://www.timvw.be/wp-content/code/csharp/StringValueObject.zip">StringValueObject</a> templates.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/revisited-the-int-and-string-valueobject-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presenting templates for int and string ValueObjects</title>
		<link>http://www.timvw.be/presenting-templates-for-int-and-string-valueobjects/</link>
		<comments>http://www.timvw.be/presenting-templates-for-int-and-string-valueobjects/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 15:01:30 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=611</guid>
		<description><![CDATA[Most ValueObjects that i have implemented were wrappers around an int or a string. Apart from the domain specific rules, there is a lot of repetitive work in implementing operator overloads, IEquatable&#60;T&#62;, IComparable&#60;T&#62;, &#8230; Thus i decided to create a couple of Item templates that generate this code (and related tests). Simply save IntValueObject.zip and [...]]]></description>
			<content:encoded><![CDATA[<p>Most <a href="http://domaindrivendesign.org/discussion/messageboardarchive/ValueObjects.html">ValueObjects</a> that i have implemented were wrappers around an int or a string. Apart from the domain specific rules, there is a lot of repetitive work in implementing operator overloads, IEquatable&lt;T&gt;, IComparable&lt;T&gt;, &#8230; Thus i decided to create a couple of Item templates that generate this code (and related tests).</p>
<p>Simply save <a href="http://www.timvw.be/wp-content/code/csharp/IntValueObject.zip">IntValueObject.zip</a> and <a href="http://www.timvw.be/wp-content/code/csharp/StringValueObject.zip">StringValueObject.zip</a> under %My Documents%\Visual Studio 2005\Templates\ItemTemplates and click on &#8220;Add New Item&#8221; in your project:</p>

<img src="http://www.timvw.be/wp-content/images/template_add_new_item.gif" alt="screenshot of add new item dialog in visual studio"/>

<p>Add the bottom of the dialog you can choose one of the templates:</p>

<img src="http://www.timvw.be/wp-content/images/template_my_templates.gif" alt="screenshot of add new item dialog in visual studio"/>

<p>Here is the result of adding an <a href="http://en.wikipedia.org/wiki/International_Standard_Book_Number">International Standard Book Number</a> class:</p>

<img src="http://www.timvw.be/wp-content/images/template_isbn.gif" alt="screenshot of generated artificates for isbn"/>
]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/presenting-templates-for-int-and-string-valueobjects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2008 (SP1) crashes when opening ViewPage in designer</title>
		<link>http://www.timvw.be/visual-studio-2008-sp1-crashes-when-opening-viewpage-in-designer/</link>
		<comments>http://www.timvw.be/visual-studio-2008-sp1-crashes-when-opening-viewpage-in-designer/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 16:44:32 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=562</guid>
		<description><![CDATA[Visual Studio 2008 (SP1) crashed every time i tried to open a ViewPage with the Web Form Editor (designer). Kudos go to eniac who suggested the removal of the Power Commands add-in. This made the crashes disappear.]]></description>
			<content:encoded><![CDATA[<p>Visual Studio 2008 (SP1) crashed every time i tried to open a ViewPage with the Web Form Editor (designer). Kudos go to eniac who <a href="http://haacked.com/archive/2008/09/05/mvcfutures-and-asp.net-mvc-beta.aspx">suggested</a> the removal of the <a href="http://code.msdn.microsoft.com/PowerCommands">Power Commands</a> add-in. This made the crashes disappear.</p> ]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/visual-studio-2008-sp1-crashes-when-opening-viewpage-in-designer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Error loading testrunconfig: Failed to instantiate type Microsoft.VisualStudio.TestTools.WebStress.WebTestRunConfig</title>
		<link>http://www.timvw.be/error-loading-testrunconfig-failed-to-instantiate-type-microsoftvisualstudiotesttoolswebstresswebtestrunconfig/</link>
		<comments>http://www.timvw.be/error-loading-testrunconfig-failed-to-instantiate-type-microsoftvisualstudiotesttoolswebstresswebtestrunconfig/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 06:40:00 +0000</pubDate>
		<dc:creator>timvw</dc:creator>
				<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.timvw.be/?p=283</guid>
		<description><![CDATA[Earlier this week i ran into the following exception when opening a solution: &#8220;Error loading TestRunConfig1.testrunconfig: Failed to instantiate type Microsoft.VisualStudio.TestTools.WebStress.WebTestRunConfig&#8221;. Apparently (here and here) the VS2005 Developer edition is missing a couple of libraries that the VS2005 Tester edition adds to the testrunconfig. If your tests don&#8217;t depend on these, the simplest way to [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week i ran into the following exception when opening a solution: &#8220;Error loading TestRunConfig1.testrunconfig: Failed to instantiate type Microsoft.VisualStudio.TestTools.WebStress.WebTestRunConfig&#8221;.</p>

<img src="http://www.timvw.be/wp-content/images/testrunconfig_notexpectedformat.gif" alt="screenshot of testrunconfig not expected format dialog box"/>

<p>Apparently (<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=228438&#038;SiteID=1">here</a> and <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=425717&#038;SiteID=1">here</a>) the VS2005 Developer edition is missing a couple of libraries that the VS2005 Tester edition adds to the testrunconfig. If your tests don&#8217;t depend on these, the simplest way to solve this problem is to remove all the values nodes, and their childnodes, where the type is defined in the Microsoft.VisualStudio.QualityTools.LoadTest, Microsoft.VisualStudio.QualityTools.WebTest and Microsoft.VisualStudio.QualityTools.LoadTest.WebStress assemblies.</p>]]></content:encoded>
			<wfw:commentRss>http://www.timvw.be/error-loading-testrunconfig-failed-to-instantiate-type-microsoftvisualstudiotesttoolswebstresswebtestrunconfig/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
