<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Mads Tjørnelund Toustrup</title>
 <link href="http://madstt.dk/atom.xml" rel="self"/>
 <link href="http://madstt.dk/"/>
 <updated>2017-02-02T11:20:31+00:00</updated>
 <id>http://madstt.dk</id>
 <author>
   <name>Mads Tjørnelund Toustrup</name>
 </author>

 
 <entry>
   <title>Squirrel - The Basics</title>
   <link href="http://madstt.dk/squirrel-the-basic/"/>
   <updated>2016-03-11T00:00:00+00:00</updated>
   <id>http://madstt.dk/squirrel-the-basic</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;Squirrel is like ClickOnce, but works.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This intriguing thesis made me wanna know more. By coincidence, I got the opportunity to spend the last few days fiddling with &lt;a href=&quot;https://github.com/Squirrel/Squirrel.Windows&quot;&gt;Squirrel&lt;/a&gt;. Squirrel is an install and update framework. It comes in a few flavours, for Mac, Windows, and iOS. In this post we’ll focus on Squirrel.Windows, the Windows flavour.&lt;/p&gt;

&lt;p&gt;If you’ve ever had the pleasure of working with &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/t71a733d.aspx&quot;&gt;ClickOnce&lt;/a&gt;, you know that it has its flaws and that it can really be a pain to work with and maintain.&lt;/p&gt;

&lt;p&gt;This post takes you through all steps of packing your application for release, distribution, installation, and updating.&lt;/p&gt;

&lt;h2 id=&quot;packaging&quot;&gt;Packaging&lt;/h2&gt;
&lt;p&gt;Squirrel is based upon NuGet. Your application is therefore wrapped into a NuGet package before Squirrel can make an installer.&lt;/p&gt;

&lt;p&gt;I would recommend creating a &lt;code class=&quot;highlighter-rouge&quot;&gt;.nuspec&lt;/code&gt; file and use the &lt;code class=&quot;highlighter-rouge&quot;&gt;nuget pack&lt;/code&gt; command to create the &lt;code class=&quot;highlighter-rouge&quot;&gt;.nupkg&lt;/code&gt; file. For a quick demo you can create the &lt;code class=&quot;highlighter-rouge&quot;&gt;.nupkg&lt;/code&gt; using a tool like &lt;a href=&quot;https://github.com/NuGetPackageExplorer/NuGetPackageExplorer&quot;&gt;NuGet Package Explorer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You &lt;code class=&quot;highlighter-rouge&quot;&gt;.nupkg&lt;/code&gt; file should contain a single &lt;code class=&quot;highlighter-rouge&quot;&gt;lib&lt;/code&gt; folder with a &lt;code class=&quot;highlighter-rouge&quot;&gt;net45&lt;/code&gt; folder inside. .Net 4.5 is a requirement for Squirrel, but it is not restrained to only be used with .Net 4.5 projects. Actually, you can use Squirrel to distribute and install any sort of desktop application on Windows and Mac.&lt;/p&gt;

&lt;p&gt;Then inside your &lt;code class=&quot;highlighter-rouge&quot;&gt;net45&lt;/code&gt; folder you put the content you want to install. For .Net projects, this is often the output of a Release build. You can remove all IDE related files and debugging symbols, such as &lt;code class=&quot;highlighter-rouge&quot;&gt;.pdb&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;.vshost&lt;/code&gt; etc. Set the appropriate metadata on the &lt;code class=&quot;highlighter-rouge&quot;&gt;.nupkg&lt;/code&gt; file. The icon will be used on the application, and the package summary will be used as Name in the Programs and Features list.&lt;/p&gt;

&lt;p&gt;Once you have a nice &lt;code class=&quot;highlighter-rouge&quot;&gt;.nupkg&lt;/code&gt; file, you use Squirrel to Releasify the application:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; squirrel.exe --releasify myapp.1.0.0.nupkg
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This means that Squirrel wraps it into a folder, a Releases folder per default, next to the &lt;code class=&quot;highlighter-rouge&quot;&gt;.nupkg&lt;/code&gt; file. The &lt;code class=&quot;highlighter-rouge&quot;&gt;Squirrel.exe&lt;/code&gt; is part of the &lt;code class=&quot;highlighter-rouge&quot;&gt;squirrel.windows&lt;/code&gt; NuGet package. This means that an easy way to access it, is through the NuGet Package Manager Console in Visual Studio. &lt;code class=&quot;highlighter-rouge&quot;&gt;Squirrel.exe&lt;/code&gt; comes with a number of command line options, which are worth looking into.&lt;/p&gt;

&lt;p&gt;Inside the Releases folder is the &lt;code class=&quot;highlighter-rouge&quot;&gt;.nupkg&lt;/code&gt; file, a &lt;code class=&quot;highlighter-rouge&quot;&gt;Setup.exe&lt;/code&gt;, a &lt;code class=&quot;highlighter-rouge&quot;&gt;Setup.msi&lt;/code&gt;, and a RELEASES file. The two Setup files are used for installation. The RELEASES file contains information, a SHA, name, and size of the releases in the folder.&lt;/p&gt;

&lt;p&gt;The content of the Releases folder is your installation pieces. Just run the &lt;code class=&quot;highlighter-rouge&quot;&gt;Setup.exe&lt;/code&gt; or the &lt;code class=&quot;highlighter-rouge&quot;&gt;Setup.msi&lt;/code&gt; to install your application.&lt;/p&gt;

&lt;h2 id=&quot;distribution&quot;&gt;Distribution&lt;/h2&gt;
&lt;p&gt;One of the key features of Squirrel is that you can distribute your application from almost anywhere.&lt;/p&gt;

&lt;p&gt;You can copy the content of the Releases folder to a local path, a Dropbox folder, Amazon S3, Azure Blob Storage, Microsoft IIS, etc. There are no requirements what so ever. You can even change the path or url and move the installation files. If you wanna use the background updating mechanism, you just have to update the path or url in your application.&lt;/p&gt;

&lt;h2 id=&quot;updating&quot;&gt;Updating&lt;/h2&gt;
&lt;p&gt;To get started with updating your application you would need to pick up the &lt;a href=&quot;https://www.nuget.org/packages/squirrel.windows/&quot;&gt;Squirrel.Windows NuGet package&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; install-package squirrel.windows
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This will give you the Squirrel namespace. Now you have two options, you can take the Easy-Mode or the Step-Wise path.&lt;/p&gt;

&lt;h3 id=&quot;easy-mode&quot;&gt;Easy Mode&lt;/h3&gt;
&lt;p&gt;When you have referenced the NuGet package you use the ‘Easy Mode’, which will run all the tasks necessary to check, download and apply new releases.&lt;/p&gt;

&lt;p&gt;You can use the ‘Easy Mode’ with the following snippet:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;using (var mgr = new UpdateManager(&quot;C:\\Projects\\MyApp\\Releases&quot;))
{
    await mgr.UpdateApp();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You can place this snippet somewhere that makes sense. Some applications checks for updates on startup others have a separate UI for this.&lt;/p&gt;

&lt;p&gt;If there is a new release for the application it will be installed silently in the background, and when the user restarts the application he will be using the new version.&lt;/p&gt;

&lt;h3 id=&quot;step-wise&quot;&gt;Step-Wise&lt;/h3&gt;
&lt;p&gt;Opposite to the Easy-Mode, the Step-Wise updating mechanism is the solution if you would like to notify the user that there is a new release, and ask the user for permission to install.&lt;/p&gt;

&lt;p&gt;As with Easy-Mode it is good practice to put the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt; into a using statement. It is required that the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt; is disposed prior to application termination. You can either handle this manually or use a using statement.&lt;/p&gt;

&lt;h4 id=&quot;checkforupdate&quot;&gt;CheckForUpdate()&lt;/h4&gt;
&lt;p&gt;First step is to call the &lt;code class=&quot;highlighter-rouge&quot;&gt;CheckForUpdate()&lt;/code&gt; method on the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt; object:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;using (var mgr = new UpdateManager(&quot;C:\\Projects\\MyApp\\Releases&quot;))
{
    var updateInfo = await mgr.CheckForUpdate();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You can then use the &lt;code class=&quot;highlighter-rouge&quot;&gt;updateInfo&lt;/code&gt; object to check the installed version and whether there is any new releases available. Using the &lt;code class=&quot;highlighter-rouge&quot;&gt;FetchReleaseNotes()&lt;/code&gt; method you can retrieve the release notes from the &lt;code class=&quot;highlighter-rouge&quot;&gt;.nupkg&lt;/code&gt;, display them to the users and let them decide whether they’d like to install the update.&lt;/p&gt;

&lt;h4 id=&quot;downloadreleases&quot;&gt;DownloadReleases()&lt;/h4&gt;
&lt;p&gt;So if you want to install the release, we can extend our small sample with the following:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;if (updateInfo.ReleasesToApply.Any())
{
    newVersion = updateInfo.FutureReleaseEntry.Version;

    Console.WriteLine(&quot;New version: {0}&quot;, newVersion);

    Console.Write(&quot;New version available. Install? (y/n) &quot;);
    if (Console.ReadKey().Key == ConsoleKey.Y)
    {
        Console.WriteLine(&quot;Beginning to download...&quot;);

        mgr.DownloadReleases(updateInfo.ReleasesToApply).Wait();
        Console.WriteLine(&quot;... done downloading.&quot;);
    }
} What happens is that we check the `updateInfo` for any releases to apply. This would be any new releases. If this is the case we ask the user whether to install the latest release. If this is the case to call the `DownloadReleases()` method on the `UpdateManager` object. Upon downloaded, we can apply the release.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The downloaded release will be put into a folder next to the current.&lt;/p&gt;

&lt;h4 id=&quot;applyreleases&quot;&gt;ApplyReleases()&lt;/h4&gt;
&lt;p&gt;Once we have downloaded our releases, we can apply the releases using the &lt;code class=&quot;highlighter-rouge&quot;&gt;ApplyReleases()&lt;/code&gt; method. This would extend our sample with this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Console.WriteLine(&quot;Beginning to apply release...&quot;);
mgr.ApplyReleases(updateInfo).Wait();
Console.WriteLine(&quot;... done applying.&quot;); This step will change shortcut pointers from the current installed release to the newly downloaded.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h4 id=&quot;createuninstallerregistryentry&quot;&gt;CreateUninstallerRegistryEntry()&lt;/h4&gt;
&lt;p&gt;It is by all good practice to create an uninstaller for the user to uninstall the application in the Programs and Features page. This is done with the following:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Console.WriteLine(&quot;Creating uninstaller...&quot;);
mgr.CreateUninstallerRegistryEntry().Wait();
Console.WriteLine(&quot;... done creating uninstaller.&quot;);
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;restarting-your-application&quot;&gt;Restarting Your Application&lt;/h3&gt;
&lt;p&gt;Whether you use the easy-mode or step-wise, you can restart your application after applying a new release. Squirrel has a buit-in feature for this. It is a static method on the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;UpdateManager.RestartApp();
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This is the final step in creating a step-wise updating process for your application.&lt;/p&gt;

&lt;h2 id=&quot;gotchas&quot;&gt;Gotchas&lt;/h2&gt;
&lt;p&gt;During my experimentation with Squirrel I came across some gotchas, which could be of interest to others.&lt;/p&gt;

&lt;p&gt;There is an &lt;code class=&quot;highlighter-rouge&quot;&gt;ArgumentException&lt;/code&gt; with a message saying, &lt;code class=&quot;highlighter-rouge&quot;&gt;You must dispose UpdateManager!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You will run into this issue if you wrap your &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt; into a using statement and awaits the any of the async methods on &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt;, like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;using (var mgr = new UpdateManager(&quot;C:\\Projects\\MyApp\\Releases&quot;))
{
    var updateInfo = await mgr.CheckForUpdates();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The runtime will not be able to dispose your &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt; object before the application terminates.&lt;/p&gt;

&lt;p&gt;To resolve this you can either make the &lt;code class=&quot;highlighter-rouge&quot;&gt;CheckForUpdate()&lt;/code&gt; call synchronous, applying &lt;code class=&quot;highlighter-rouge&quot;&gt;.Result&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;CheckForUpdate&lt;/code&gt; or make sure to dispose the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt; when finalizing the AppDomain, like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;AppDomain.CurrentDomain.ProcessExit += () =&amp;gt; DisposeUpdateManager(); 
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The other gotcha I ran into was a &lt;code class=&quot;highlighter-rouge&quot;&gt;AbandonedMutexException&lt;/code&gt; with a message saying, &lt;code class=&quot;highlighter-rouge&quot;&gt;Leaked a Mutex!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Again this is related to the locking mechanism of the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt;. I got this exception when I tried to call the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager.RestartApp()&lt;/code&gt; method inside my using statement. This would close the running application before the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager&lt;/code&gt;’s mutex is released.&lt;/p&gt;

&lt;p&gt;To resolve this, move the &lt;code class=&quot;highlighter-rouge&quot;&gt;UpdateManager.RestartApp()&lt;/code&gt; outside the using statement.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Coming with some experience using ClickOnce, it is a relief to use Squirrel. It is much more lean, and requires so much less effort. Both in maintenance and development.&lt;/p&gt;

&lt;p&gt;I have put my sample application on &lt;a href=&quot;https://github.com/madstt/SquirrelTest&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you have any comments or feedback on this post, throw them into the comments.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Electron, From Web to Desktop - Part 1</title>
   <link href="http://madstt.dk/Electron-from-Web-to-Desktop-part1/"/>
   <updated>2016-01-22T00:00:00+00:00</updated>
   <id>http://madstt.dk/Electron-from-Web-to-Desktop-part1</id>
   <content type="html">&lt;p&gt;Some time back I kicked the tires of &lt;a href=&quot;http://electron.atom.io&quot;&gt;Electron&lt;/a&gt;. I really fancy the idea that you can use web technologies on your desktop.&lt;/p&gt;

&lt;p&gt;With this mindset I decided to try out Electron. In this first post in a series of Electron posts, I’ll create a small and simple desktop app using Electron.&lt;/p&gt;

&lt;p&gt;In this first post I’ll be showing how quickly you can get up and running with Electron.&lt;/p&gt;

&lt;p&gt;Once again, &lt;a href=&quot;http://npm.org&quot;&gt;npm&lt;/a&gt; is your friend. We create a folder in which we would like to hold our Electron desktop application:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; mkdir electron-hello
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Then inside this folder we run &lt;code class=&quot;highlighter-rouge&quot;&gt;npm init&lt;/code&gt;. You then have to answer some questions about application. This will create the &lt;code class=&quot;highlighter-rouge&quot;&gt;packages.json&lt;/code&gt; file which contains some metadata about your application. This &lt;code class=&quot;highlighter-rouge&quot;&gt;packages.json&lt;/code&gt; is mandatory in any Electron application.&lt;/p&gt;

&lt;p&gt;Now we need to install the &lt;code class=&quot;highlighter-rouge&quot;&gt;electron-prebuilt&lt;/code&gt; package:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; npm install electron-prebuilt --save-dev
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This will install the &lt;code class=&quot;highlighter-rouge&quot;&gt;electron-prebuilt&lt;/code&gt; package and store this dependecy as a development dependency in the &lt;code class=&quot;highlighter-rouge&quot;&gt;packages.json&lt;/code&gt;, we created above.&lt;/p&gt;

&lt;p&gt;Now go on and create a folder that will hold the application specific files:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; mkdir app
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;I’ve called the folder &lt;code class=&quot;highlighter-rouge&quot;&gt;app&lt;/code&gt;. In this folder we once again run the &lt;code class=&quot;highlighter-rouge&quot;&gt;npm init&lt;/code&gt; command, and answer the questions. Now we need to edit the &lt;code class=&quot;highlighter-rouge&quot;&gt;packages.json&lt;/code&gt; file created. When you open the file in your favorite text editor it should look like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;main&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;index.js&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;echo \&quot;Error: no test specified\&quot; &amp;amp;&amp;amp; exit 1&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;author&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;license&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ISC&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;For my own convenience I change the &lt;code class=&quot;highlighter-rouge&quot;&gt;main&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;main.js&lt;/code&gt;, so my &lt;code class=&quot;highlighter-rouge&quot;&gt;packages.json&lt;/code&gt; will look like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;main&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;main.js&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;echo \&quot;Error: no test specified\&quot; &amp;amp;&amp;amp; exit 1&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;author&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;license&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ISC&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Now create the &lt;code class=&quot;highlighter-rouge&quot;&gt;main.js&lt;/code&gt; in the &lt;code class=&quot;highlighter-rouge&quot;&gt;app&lt;/code&gt; folder. In this very trivial sample application the &lt;code class=&quot;highlighter-rouge&quot;&gt;main.js&lt;/code&gt; will look like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var app = require('app');
var BrowserWindow = require('browser-window');
var mainWindow = null;

app.on('ready', function() {
    mainWindow = new BrowserWindow({
        width: 800,
        height: 600
    });

    mainWindow.loadUrl('file://' + __dirname + '/index.html');
    
    mainWindow.on('closed', function(){
        mainWindow = null;
    })
});
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;In the first line we require the &lt;code class=&quot;highlighter-rouge&quot;&gt;app&lt;/code&gt;, which is our application. Next we require a &lt;code class=&quot;highlighter-rouge&quot;&gt;browser-window&lt;/code&gt;. This is the actual Electron shell, which will host our application. The &lt;code class=&quot;highlighter-rouge&quot;&gt;mainWindow&lt;/code&gt; variable will hold a reference to an instance of the &lt;code class=&quot;highlighter-rouge&quot;&gt;BrowserWindow&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then we hook up our application by listening to the &lt;code class=&quot;highlighter-rouge&quot;&gt;ready&lt;/code&gt; event. So, when the application is ready we create the &lt;code class=&quot;highlighter-rouge&quot;&gt;BrowserWindow&lt;/code&gt; instance and sets its dimensions. Then we load some content into the &lt;code class=&quot;highlighter-rouge&quot;&gt;mainWindow&lt;/code&gt; by using the &lt;code class=&quot;highlighter-rouge&quot;&gt;loadUrl&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;loadUrl&lt;/code&gt; method can take anything basically. In this case we want to show a local &lt;code class=&quot;highlighter-rouge&quot;&gt;index.html&lt;/code&gt;, but there is nothing that can stop you from host a website inside your Electron application. I could host and distribute this blog as a desktop application like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mainWindow.loadUrl('http://www.madstt.dk');
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The last line in my &lt;code class=&quot;highlighter-rouge&quot;&gt;main.js&lt;/code&gt; is an event handler, which will release the reference to the &lt;code class=&quot;highlighter-rouge&quot;&gt;mainWindow&lt;/code&gt; object upon the application is closed.&lt;/p&gt;

&lt;p&gt;We’re almost ready to take this little beast for a spin. We need to create &lt;code class=&quot;highlighter-rouge&quot;&gt;index.html&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Hello from Electron!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello from Electron!&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This is very simple.&lt;/p&gt;

&lt;p&gt;Now, to launch this application we move to the outer folder (the folder containing the app folder). Here we can run the following command:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; electron app
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Now your first Electron application is airborne. That’s was easy, right? In the following posts we’ll extend this simple application with more advanced features. On the top of my mind, the next post will focus on setting up &lt;a href=&quot;http://gulpjs.com/&quot;&gt;gulp&lt;/a&gt; for building, running, packaging, and distributing the application. Other topics will be setting up AngularJS, crash reporting, distribution, automatic updating, debugging, etc.&lt;/p&gt;

&lt;p&gt;Throw me a comment for suggestions.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Freelancing</title>
   <link href="http://madstt.dk/freelancer/"/>
   <updated>2016-01-01T00:00:00+00:00</updated>
   <id>http://madstt.dk/freelancer</id>
   <content type="html">&lt;p&gt;The last year or so I have had a growing wish to try myself of as an entrepreneur and become a freelancer. Time has come, and from January 1st I have started my own business. The name is &lt;a href=&quot;http://madskills.dk&quot;&gt;madSkills&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I am so pleased that this is finally taking off. I am so much looking forward to service my own customers and help develop their businesses. My main focus is to support all kinds of businesses in my local area. I believe that the outer western part of Denmark upholds a large potential of businesse in the need of aware, present, and state-of-the-art consultancy. These services should not only be something for the larger cities in the Eastern parts of Denmark. I hope to be able to help and support small to large businesses in realizing their potential and growing great ideas to meet the challenges of the future.&lt;/p&gt;

&lt;p&gt;I will continue working for &lt;a href=&quot;http://d60.dk&quot;&gt;d60&lt;/a&gt;, but in parallel I will take upon freelance tasks. As many of you know I have commuted 5½ hours a day to get to Aarhus and back. With my new business located locally, I will be much more flexible and have more time to see my kids and be part of their everyday life.&lt;/p&gt;

&lt;p&gt;So what kind of tasks will I be up for? I am not that choosy with the kind of jobs and tasks I am up for. My main experience is with .Net and C#. So obviously that is where I’ll be building my business. In the last years have had a growing interest and experience with AngularJS and all web related. I hope to find tasks in these areas as well. Finally, I hope that I can build my business on Ionic.&lt;/p&gt;

&lt;p&gt;Would you be interested in hiring me send me an email at &lt;a href=&quot;mailto:kontakt@madskills.dk&quot;&gt;kontakt@madskills.dk&lt;/a&gt; or ping me at &lt;a href=&quot;https://twitter.com/madSkillsdk&quot;&gt;@madskillsdk&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ionic Denmark</title>
   <link href="http://madstt.dk/ionic-denmark/"/>
   <updated>2015-06-11T00:00:00+00:00</updated>
   <id>http://madstt.dk/ionic-denmark</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;http://i.imgur.com/0pGhOuO.png&quot; style=&quot;float: left&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In this post I’ll outline how I became organizer of Ionic Denmark, and why this is such a good idea.&lt;/p&gt;

&lt;p&gt;In a work-related context I recently had the opportunity to get chance to play around with Ionic. And it was love at first sight. There are so many aspects of Ionic, that I find attractive. I’ll cover many of these in the first meetup.&lt;/p&gt;

&lt;p&gt;I’m no expert, but I’d really like to learn more about Ionic, so this motivates me into starting a meetup for Ionic, Ionic Denmark.&lt;/p&gt;

&lt;p&gt;It was by a co-incidence that I started this meetup. I saw a tweet from &lt;a href=&quot;https://twitter.com/ionicframework&quot;&gt;@ionicframework&lt;/a&gt; about a scheduled meetup in &lt;a href=&quot;https://twitter.com/ionicpoland&quot;&gt;@ionicpoland&lt;/a&gt;. I thought there might also be a meetup about Ionic in Denmark. But, unfortunately, no. There is no user group nor meetup about Ionic, so one thing let to another, and I picked up the &lt;a href=&quot;https://twitter.com/ionicdenmark&quot;&gt;@ionicdenmark&lt;/a&gt; Twitter handle. I asked &lt;a href=&quot;https://twitter.com/ionicpoland&quot;&gt;@ionicpoland&lt;/a&gt; were they had their awesome logo from. They replied that &lt;a href=&quot;https://twitter.com/katiegv&quot;&gt;@katiegv&lt;/a&gt;, marketing and communications manager of Ionic, was the one to talk to.&lt;/p&gt;

&lt;p&gt;I got in contact with Katie, who informed me that Ionic has a complete setup for starting and supporting meetups. The logo is designed by &lt;a href=&quot;http://twitter.com/benjsperry&quot;&gt;@benjsparry&lt;/a&gt;, one of the co-founders of Ionic. We just received it a couple of days ago.&lt;/p&gt;

&lt;p&gt;I started a meetup at &lt;a href=&quot;http://meetup.com/ionicdenmark&quot;&gt;meetup.com&lt;/a&gt;. I’ve used meetup.com as an attendee on other meetups, but never as an organizer, but it has really been a pleasure. I like the tool and its different features.&lt;/p&gt;

&lt;p&gt;We have already scheduled the &lt;a href=&quot;http://www.meetup.com/ionicdenmark/events/223035364/&quot;&gt;first meetup&lt;/a&gt;. Which will be on the 12th of August in Århus. The plan is to re-run this meetup in Copenhagen some time during September. The ambition is that we try to cover both Århus and Copenhagen with the same meetups. It can be difficult, and it depends on the event host, whether he/she will do the meetup both places.&lt;/p&gt;

&lt;p&gt;In the first meetup we will cover hybrid apps in general and dig into the world of Ionic. This deep dive will take the audience around how to get started, tooling, the framework, etc.&lt;/p&gt;

&lt;p&gt;I really hope to get this meetup up and running, so please register at &lt;a href=&quot;http://meetup.com/ionicdenmark&quot;&gt;meetup.com&lt;/a&gt; and join us.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Creating A Custom Log Handler In scriptcs.rebus</title>
   <link href="http://madstt.dk/creating-a-custom-log-handler-in-scriptcs-rebus/"/>
   <updated>2015-06-09T00:00:00+00:00</updated>
   <id>http://madstt.dk/creating-a-custom-log-handler-in-scriptcs-rebus</id>
   <content type="html">&lt;p&gt;In the &lt;a href=&quot;http://madstt.dk/scriptcs-rebus-0-6-0/&quot;&gt;latest release of scriptcs.rebus&lt;/a&gt;, it is possible to receive the log entries from a remote script execution process. On the client side you can define a number of log entry handlers, and specify at which log level they should receive the log entries.&lt;/p&gt;

&lt;p&gt;Out of the box there is a console log handler, the &lt;code class=&quot;highlighter-rouge&quot;&gt;ToConsole()&lt;/code&gt;, which you can add like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureBus(&quot;someBus&quot;)
	.With.AScriptFile(&quot;scriptfile_simple.csx&quot;)
		.Log.ToConsole()
.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You can specify the at which log level you would like to receive logs entries in the console like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureBus(&quot;someBus&quot;)
	.With.AScriptFile(&quot;scriptfile_simple.csx&quot;)
		.Log.ToConsole(LogLevel.Debug)
.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Now this would make all log entries with log level &lt;code class=&quot;highlighter-rouge&quot;&gt;Debug&lt;/code&gt; send to the console of the client. This is great, but what if I’d like to get all log entries of &lt;code class=&quot;highlighter-rouge&quot;&gt;LogLevel.Error&lt;/code&gt; put into a rolling file? Well, easy, you just implement the &lt;code class=&quot;highlighter-rouge&quot;&gt;IReceiveLogEntries&lt;/code&gt; interface, and then add it.&lt;/p&gt;

&lt;p&gt;This is an example of a simple, and yet naive, rolling file implementation:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;public class RollingFileLogger : IReceiveLogEntries
{
	private StreamWriter _writer;

	public RollingFileLogger()
	{
		_writer = new StreamWriter(new FileStream(&quot;logs.txt&quot;, FileMode.OpenOrCreate));
		_writer.AutoFlush = true;
	}

	public void Log(string logEntry)
	{
		_writer.WriteLine(logEntry);
	}

	public LogLevel LogLevel { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Now we can add this rolling file logger to our list of log entry handlers like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureBus(&quot;someBus&quot;)
	.With.AScriptFile(&quot;scriptfile_simple.csx&quot;)
		.Log.ToConsole(LogLevel.Debug)
		.Log.To&amp;lt;RollingFileLogger&amp;gt;(LogLevel.Error)
.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This sends the all &lt;code class=&quot;highlighter-rouge&quot;&gt;LogLevel.Debug&lt;/code&gt;, and below, entries to the console, while all &lt;code class=&quot;highlighter-rouge&quot;&gt;LogLevel.Error&lt;/code&gt;, and below, are sent to a rolling file.&lt;/p&gt;

&lt;p&gt;Other examples of log entry handlers could be SQL Server, MongoDB, RavenDB, Azure Blob Storage, etc. I might post examples of these in futures posts.&lt;/p&gt;

&lt;p&gt;Throw me a comment below or ping me on Twitter, to let hear what you think of this feature.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>scriptcs.rebus 0.6.0</title>
   <link href="http://madstt.dk/scriptcs-rebus-0-6-0/"/>
   <updated>2015-05-06T00:00:00+00:00</updated>
   <id>http://madstt.dk/scriptcs-rebus-0-6-0</id>
   <content type="html">&lt;p&gt;I’m really excited to finally announce the release of scriptcs.rebus 0.6.0. The 0.5.0 version was release back in November 2014, so this release has been under development for some time. This release is feature packed, its the version with the most new features since 0.1.0. It is a major step towards 1.0. It has been a great and fun ride, and I could have dumped more features in there, but on the other hand I’d also like to share these new features with you guys.&lt;/p&gt;

&lt;p&gt;At the time of writing, scriptcs.rebus has been downloaded more than &lt;a href=&quot;https://www.nuget.org/packages/ScriptCs.Rebus/&quot;&gt;850 times on nuget.org&lt;/a&gt;. Still, I haven’t received any feedback what so ever. The numbers count for themselves, there is someone out there using it. So, basically, I’m doing the features and the fixing the issues I find. If you’re using scriptcs.rebus, please let me know how you’re using it and if there is anything you’re missing.&lt;/p&gt;

&lt;h2 id=&quot;whats-new&quot;&gt;What’s New&lt;/h2&gt;
&lt;p&gt;A bunch. In the following subsections I outline all the new features that is packed into 0.6.0.&lt;/p&gt;

&lt;h3 id=&quot;dynamic-webapi-controller-generation&quot;&gt;Dynamic WebAPI Controller Generation&lt;/h3&gt;
&lt;p&gt;scriptcs.rebus now has built-in support for dynamically creating new controllers inside a running WebAPI application. Sounds awesome? It is. How does this work? I’ve extended scriptcs.rebus.hosting with the capabilities to take some controller logic and on-the-fly wrapped it into a controller class and served for the API. The scripting logic is saved to disk, so that if the server is restarted, the controllers are still available.&lt;/p&gt;

&lt;p&gt;In which context could this feature become relevant, you may ask? Well, instead of having to take your API down for maintenance, you create new controllers without. You could also use this in the initial phases of creating your WebAPI. Just throw an empty WebAPI in the air, and dynamically create controllers as you explore the domain.&lt;/p&gt;

&lt;p&gt;Let’s look at an example. The following code sends some controller logic to a WebAPI:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureBus(&quot;hostedBus&quot;)
	.With.AWebApiController(&quot;Customer&quot;)
		.AsAScript(&quot;public string Get() {return \&quot;Customer name is Adam!\&quot;;}&quot;)
	.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;AWebApiController()&lt;/code&gt; extension method takes a single parameter, which is the desired controller name. The &lt;code class=&quot;highlighter-rouge&quot;&gt;Get()&lt;/code&gt; method is sent to the WebAPI. scriptcs.rebus.hosting saves this script, and on the next request to the WebAPI, a new controller is dynamically created and served. On all subsequent calls WebAPI serves the controller from memory. Script execution only happens on server restart or if a new controller script is sent to the WebAPI.&lt;/p&gt;

&lt;p&gt;It is also possible to send your controller script as file, like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureBus(&quot;hostedBus&quot;)
	.With.AWebApiController(&quot;Customer&quot;)
		.AsAScriptFile(&quot;CustomerController.csx&quot;)
	.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Now to set this script execution feature in your WebAPI, you should reference the &lt;a href=&quot;https://www.nuget.org/packages/ScriptCs.Rebus.Hosting/&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;scriptcs.rebus.hosting&lt;/code&gt; NuGet package&lt;/a&gt;. Then add the following piece to your &lt;code class=&quot;highlighter-rouge&quot;&gt;WebApiConfig.cs&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var bus = new MsmqBus(&quot;hostedBus&quot;);
bus.RegisterHandler(() =&amp;gt; new ReceiveWebApiControllerHandler());
bus.Start();
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This will enable your server to receive and correctly save the controller script appropriately. Now, also in your &lt;code class=&quot;highlighter-rouge&quot;&gt;WebApiConfig.cs&lt;/code&gt; add:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var builder = new WebApiControllerBuilder();
builder.Build(config);
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This will pick up the scripts and turn them into actual WebAPI controllers.&lt;/p&gt;

&lt;p&gt;The credits for this feature goes to &lt;a href=&quot;https://twitter.com/gblock&quot;&gt;Glenn Block&lt;/a&gt;, who made some initial spiking on this. I basically teared it apart and put it into a messaging and scriptcs.rebus context.&lt;/p&gt;

&lt;p&gt;You still have the same options with regard to downloading and referencing NuGet dependencies, local dependencies, etc. as you are used to from previous versions. See more &lt;a href=&quot;https://github.com/scriptcs-contrib/scriptcs-rebus#sending-scripts-to-a-host&quot;&gt;here&lt;/a&gt;. Just as it is now:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
.ConfigureBus(&quot;hostedBus&quot;)
	.With.AWebApiController(&quot;Customer&quot;)
		.AsAScript(&quot;public string Get() {return \&quot;Listen to your customers!\&quot;;}&quot;)
	.AddFromNuGet(&quot;MongoDB.Driver&quot;)
.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This would download and reference the MongoDB driver for usage in your controller.&lt;/p&gt;

&lt;h3 id=&quot;returning-script-execution-output&quot;&gt;Returning Script Execution Output&lt;/h3&gt;
&lt;p&gt;This is a great feature, and nonetheless quite unique in the script execution context. Currently, we can send scripts to host application for execution. We can use this feature to extend running applications with new features, dynamically. This is possible already today, but in this release I’ve added a feature to receive any script execution output in the client. This is possible since the backbone in scriptcs.rebus is &lt;a href=&quot;https://github.com/rebus-org/Rebus/&quot;&gt;Rebus&lt;/a&gt;, which makes it possible for the server, the host application, and the client, the script execution initiator, to communicate.&lt;/p&gt;

&lt;p&gt;Currently all script execution output is sent to the console of the host. Often, or in many cases, the host application is blackbox and it is not possible to see any output.&lt;/p&gt;

&lt;p&gt;Lets take a look at an example:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
.ConfigureBus(&quot;someBus&quot;)
	.With.AScriptFile(&quot;scriptfile_simple.csx&quot;)
		.Log.ToConsole()
.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;In this example a script file, &lt;code class=&quot;highlighter-rouge&quot;&gt;scriptfile_simple.csx&lt;/code&gt;, is sent the a host application for execution. The &lt;code class=&quot;highlighter-rouge&quot;&gt;.Log.ToConsole()&lt;/code&gt; extension method tell the server to send all output back to the console of the client. This is a great way to get some insights into how your scripts are executed.&lt;/p&gt;

&lt;p&gt;By default the log level is set to &lt;code class=&quot;highlighter-rouge&quot;&gt;LogLevel.Info&lt;/code&gt;, other options are &lt;code class=&quot;highlighter-rouge&quot;&gt;LogLevel.Debug&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;LogLevel.Error&lt;/code&gt;, and &lt;code class=&quot;highlighter-rouge&quot;&gt;LogLevel.Trace&lt;/code&gt;, with raising density. The log level is set as a parameter on the &lt;code class=&quot;highlighter-rouge&quot;&gt;ToConsole()&lt;/code&gt; method like this:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
.ConfigureBus(&quot;someBus&quot;)
	.With.AScriptFile(&quot;scriptfile_simple.csx&quot;)
		.Log.ToConsole(LogLevel.Debug)
.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This release ships with the built-in &lt;code class=&quot;highlighter-rouge&quot;&gt;.ToConsole()&lt;/code&gt;, but there is an extension point to adding your log receiver. This is done through the &lt;code class=&quot;highlighter-rouge&quot;&gt;To&amp;lt;T&amp;gt;&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
.ConfigureBus(&quot;someBus&quot;)
	.With.AScriptFile(&quot;scriptfile_simple.csx&quot;)
		.Log.To&amp;lt;RollingFile&amp;gt;()
.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Where T is an implementation of the &lt;code class=&quot;highlighter-rouge&quot;&gt;IReceiveLogEntries&lt;/code&gt; interface. In this case a rolling file. Other examples could the Azure Web Storage or SQL Server. This interface contains a single &lt;code class=&quot;highlighter-rouge&quot;&gt;Log()&lt;/code&gt; method and a &lt;code class=&quot;highlighter-rouge&quot;&gt;LogLevel&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;This opens up for some pretty advanced logging scenarios. Like the following:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
.ConfigureBus(&quot;someBus&quot;)
	.With.AScriptFile(&quot;scriptfile_simple.csx&quot;)
		.Log.ToConsole()
		.Log.To&amp;lt;RollingFile&amp;gt;(LogLevel.Debug)
.Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Here all log entries of log level &lt;code class=&quot;highlighter-rouge&quot;&gt;Info&lt;/code&gt; is sent to both the console and the rolling file, but the rolling file also receives log entries of log level &lt;code class=&quot;highlighter-rouge&quot;&gt;Debug&lt;/code&gt;. So cool..&lt;/p&gt;

&lt;h3 id=&quot;new-hosting-api&quot;&gt;New Hosting API&lt;/h3&gt;
&lt;p&gt;As you can see from the above examples, I’ve made some breaking changes to the hosting API. These changes were necessary, so I could add both logging and incorporate the WebAPI handler.&lt;/p&gt;

&lt;p&gt;Previously you could only specify whether to use logging, which meant that the host would spit out logging entries to the host’s console. This is in many cases not a great solution. And since version 0.4.0, were scriptcs.rebus.hosting introduced, you would use the &lt;code class=&quot;highlighter-rouge&quot;&gt;.WithAScriptFile()&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;.WithAScript()&lt;/code&gt; to send a scriptfile or script to a host. This is now changed, so there is now an extension point for future specific handlers.&lt;/p&gt;

&lt;h3 id=&quot;bug-fixes&quot;&gt;Bug Fixes&lt;/h3&gt;
&lt;p&gt;This release of scriptcs.rebus also contains the usual number of bug fixes. There is a bunch of minor fixes that I’m not going to mention here, but focus on the larger and rather more important fixes.&lt;/p&gt;

&lt;h4 id=&quot;rebus-patterns&quot;&gt;Rebus Patterns&lt;/h4&gt;
&lt;p&gt;Rebus is designed with a number of messaging patterns. You can read more on these &lt;a href=&quot;https://github.com/rebus-org/Rebus/wiki/Different-bus-modes&quot;&gt;here&lt;/a&gt;. So far, I’ve relied on the &lt;a href=&quot;https://github.com/rebus-org/Rebus/wiki/Different-bus-modes#server&quot;&gt;Server&lt;/a&gt; pattern, but in the context of scripting this pattern has some unfortunate side-effects like the sender handling its own messages etc. This has sort of changed in 0.6.0. For simple messaging, it has changed to &lt;a href=&quot;https://github.com/rebus-org/Rebus/wiki/Different-bus-modes#one-way-client-mode&quot;&gt;One-way Client Mode&lt;/a&gt;, but when specifying to use logging, we still use Server. This makes it possible to to provide a return address for the host to reply with log entries.&lt;/p&gt;

&lt;p&gt;In short, no more weird behavior, were messages disappear due to bad messaging design.&lt;/p&gt;

&lt;h4 id=&quot;multiple-handlers&quot;&gt;Multiple Handlers&lt;/h4&gt;
&lt;p&gt;The idea of having multiple handlers is great, but it seemed rather buggy. It turned out that it was only the last added handler that was actually registered. This is now fixed, so that all handlers registered are actually active.&lt;/p&gt;

&lt;h3 id=&quot;azure-service-bus-and-rabbitmq-as-script-packs&quot;&gt;Azure Service Bus and RabbitMQ as Script Packs&lt;/h3&gt;
&lt;p&gt;A rather annoying thing about using the Azure Service Bus or RabbitMQ extensions for scriptcs.rebus, has been the necessity of adding a using statement. This is now fixed by turning the extension projects into pure script packs. This means that the necessary namespaces are specified inside the script pack, and it should not be necessary to add the using statement to your script anymore.&lt;/p&gt;

&lt;h3 id=&quot;latest-dependencies&quot;&gt;Latest Dependencies&lt;/h3&gt;
&lt;p&gt;Last but not least, I’ve updated scriptcs.rebus to the latest versions of scriptcs and rebus.&lt;/p&gt;

&lt;p&gt;Should you have any questions regarding any of the above, don’t hesitate contacting me. I’m available on &lt;a href=&quot;https://twitter.com/madstt&quot;&gt;Twitter&lt;/a&gt;, but also on &lt;a href=&quot;https://gitter.im/scriptcs-contrib/scriptcs-rebus&quot;&gt;Gitter&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Azure IIS Logs in ElasticSearch</title>
   <link href="http://madstt.dk/iis-logs-in-elasticsearch/"/>
   <updated>2015-03-09T00:00:00+00:00</updated>
   <id>http://madstt.dk/iis-logs-in-elasticsearch</id>
   <content type="html">&lt;p&gt;In a work context we have been working on creating an internal logging framework. This framework should be use by all projects, and provide both developers and the support team a nice status of all running applications. We currently have support for &lt;a href=&quot;http://serilog.net/&quot;&gt;Serilog&lt;/a&gt;, which is using the latest durable &lt;a href=&quot;http://www.elasticsearch.org/&quot;&gt;ElasticSearch&lt;/a&gt; sink.&lt;/p&gt;

&lt;p&gt;Other types of logs supported are IIS logs and Azure IIS logs. In this post I’ll describe how we send Azure IIS logs from several Azure Websites to ElasticSearch.&lt;/p&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;
&lt;p&gt;We wanted to create a small logging framework, which would enable fellow colleagues to easily send their logging statements to an Azure hosted ElasticSearch server. This would enable the projects, and our support staff, to supervise several projects using &lt;a href=&quot;http://www.elasticsearch.org/overview/kibana/&quot;&gt;Kibana&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We did some extensive experimenting using the &lt;a href=&quot;https://github.com/LogFlow/LogFlow&quot;&gt;LogFlow&lt;/a&gt; log agent. LogFlow log agent watches a specific folder and forwards logs to ElasticSearch. Actually, it can be configured to apply for several applications, which I’ll describe later in this post. Serilog has an ElasticSearch sink, which can forward log statements immediately to ElasticSearch, but we were looking for a more durable option. Therefore it seemed obvious to use LogFlow, which can forward logs already written to disk. LogFlow is an executable looking through the current folder to find any assemblies with an implementation of the &lt;a href=&quot;https://github.com/LogFlow/LogFlow#flow&quot;&gt;Flow&lt;/a&gt; class. We did have a hard time making this setup work in our context. So, we wrote a custom Serilog sink, which is &lt;a href=&quot;https://github.com/serilog/serilog/pull/391&quot;&gt;durable and ElasticSearch capable&lt;/a&gt;. We wrapped the configuration of Serilog and the sink, in a small NuGet package and made it available in our internal NuGet repository.&lt;/p&gt;

&lt;p&gt;Now, so much for application specific log statements, it would also be a nice addition to get the IIS logs from on-premise servers and from Azure Websites in ElasticSearch as well. This would provide great insights into server health, and maybe help foresee future server issues by surveying response times and status codes.&lt;/p&gt;

&lt;h2 id=&quot;azure-website-logs-to-azure-storage&quot;&gt;Azure Website Logs to Azure Storage&lt;/h2&gt;
&lt;p&gt;There is a rather neat feature in Azure Websites, which might not be known by the majority of Azure users. It is actually possible to get access to Azure IIS logs. A simple option on Configure tab for the website on the Azure Portal that you would like to get the logs from:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://madstt.dk//..//images//azureserver_logging.PNG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you click the Storage button and followed by a click on the Manage button, you’ll be presented with this dialog:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://madstt.dk//..//images//azureserver_storage.PNG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now in this dialog you should select which storage account to push your IIS logs. The storage accounts available is the accounts that is created in the same region and under the same subscription as the website. This is important. So, if you cannot find your desired storage account, it might be because it is created in a different region or under another subscription. You also specify the name of the container in this dialog.&lt;/p&gt;

&lt;p&gt;When this is done, you can move over to the storage account and see the content of the specified container. It will only forward new log entries, so you should maybe do some dancing on you website before any log entries ends up in the storage container as blobs.&lt;/p&gt;

&lt;h2 id=&quot;azure-storage-to-elasticsearch&quot;&gt;Azure Storage to ElasticSearch&lt;/h2&gt;
&lt;p&gt;Now that our log entries are safe inside Azure Storage, we need to index them for super search capabilities. This is done in ElasticSearch.&lt;/p&gt;

&lt;p&gt;For the client package we discarded LogFlow as log agent, but in this scenario, LogFlow is at its prime. When using LogFlow you create a class that inherit from &lt;code class=&quot;highlighter-rouge&quot;&gt;Flow&lt;/code&gt;. When the &lt;code class=&quot;highlighter-rouge&quot;&gt;LogFlow.exe&lt;/code&gt; is started it will look for any assemblies with implementations of &lt;code class=&quot;highlighter-rouge&quot;&gt;Flow&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;code class=&quot;highlighter-rouge&quot;&gt;Flow&lt;/code&gt; implementation contains a call to &lt;code class=&quot;highlighter-rouge&quot;&gt;CreateProcess()&lt;/code&gt;, which is found in &lt;code class=&quot;highlighter-rouge&quot;&gt;Flow&lt;/code&gt; base class. The &lt;code class=&quot;highlighter-rouge&quot;&gt;CreateProcess()&lt;/code&gt; call initiates a fluent configuration style, which contains three overall steps, &lt;code class=&quot;highlighter-rouge&quot;&gt;FromInput()&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;Then()&lt;/code&gt;, and &lt;code class=&quot;highlighter-rouge&quot;&gt;ToOutput()&lt;/code&gt;. The &lt;code class=&quot;highlighter-rouge&quot;&gt;FromInput()&lt;/code&gt; step handles in input source and how the log entries gets picked up and put into the LogFlow flow. The &lt;code class=&quot;highlighter-rouge&quot;&gt;Then()&lt;/code&gt; step does some processing of the log entries and, finally, the &lt;code class=&quot;highlighter-rouge&quot;&gt;ToOutput()&lt;/code&gt; step forwards the processed result.&lt;/p&gt;

&lt;h3 id=&quot;frominput&quot;&gt;FromInput()&lt;/h3&gt;
&lt;p&gt;LogFlow contains two build-in input processors, the &lt;code class=&quot;highlighter-rouge&quot;&gt;ConsoleInput&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;FileInput&lt;/code&gt;. The former reads the log entries from a console and the latter from any files, using a file watcher. In our case we need an input processor that can read from Azure Storage blobs. We therefore created the &lt;code class=&quot;highlighter-rouge&quot;&gt;StorageInput&lt;/code&gt;, an implementation of the &lt;code class=&quot;highlighter-rouge&quot;&gt;LogInput&lt;/code&gt; class:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using LogFlow;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Newtonsoft.Json.Linq;

namespace AzureLogForwarder
{
    public class StorageInput : LogInput
	{
		private readonly List&amp;lt;CloudStorageAccount&amp;gt; _storageAccounts;
		private readonly int _readBatchSize;
		private readonly int _checkIntervalMiliseconds;
		private ConcurrentDictionary&amp;lt;Uri, CloudBlockBlob&amp;gt; _blobs = new ConcurrentDictionary&amp;lt;Uri, CloudBlockBlob&amp;gt;();
		private ConcurrentDictionary&amp;lt;Uri, BlobMetaData&amp;gt; _metaDatas = new ConcurrentDictionary&amp;lt;Uri, BlobMetaData&amp;gt;();
		private ConcurrentQueue&amp;lt;Result&amp;gt; _unprocessed = new ConcurrentQueue&amp;lt;Result&amp;gt;();
		private readonly IDictionary&amp;lt;string, long&amp;gt; _positionCache = new Dictionary&amp;lt;string, long&amp;gt;();

		public StorageInput(List&amp;lt;CloudStorageAccount&amp;gt; storageAccounts, int readBatchSize = 100, int checkIntervalMiliseconds = 30000)
		{
			if (storageAccounts == null)
				throw new ArgumentNullException(&quot;storageAccounts&quot;);

			_storageAccounts = storageAccounts;
			_readBatchSize = readBatchSize;
			_checkIntervalMiliseconds = checkIntervalMiliseconds;

		}

		private void GetCurrentBlobs()
		{
			foreach (var account in _storageAccounts)
			{
				var client = account.CreateCloudBlobClient();

				var containers = client.ListContainers(detailsIncluded: ContainerListingDetails.Metadata);

				foreach (var container in containers)
				{
					if (!container.Metadata.Any() || (container.Metadata[&quot;app&quot;] == string.Empty || container.Metadata[&quot;env&quot;] == string.Empty))
					{
						// invalid container metadata, container rejected for further processing...
						break;
					}

					var listBlobItems = container.ListBlobs(null, true, blobListingDetails: BlobListingDetails.Metadata);
					foreach (var someBlob in listBlobItems)
					{
						var blockBlob = someBlob as CloudBlockBlob;
						if (blockBlob != null)
						{
							var blob = blockBlob;
							_metaDatas.AddOrUpdate(blob.Uri,
								new BlobMetaData
								{
									ApplicationName = container.Metadata[&quot;app&quot;],
									EnvironmentName = container.Metadata[&quot;env&quot;]
								},
								(key, value) =&amp;gt; value);
							blob.Metadata.Add(&quot;app&quot;, container.Metadata[&quot;app&quot;]);
							_blobs.AddOrUpdate(blob.Uri, blob, (key, value) =&amp;gt; value);
						}
					}
				}
				
			}
			return;
		}

		public override Result GetLine()
		{
			while (true)
			{
				Result result;
				if (_unprocessed.TryDequeue(out result))
				{
					var fields = new JObject();
					fields[&quot;app&quot;] = result.MetaData[&quot;app&quot;];
					fields[&quot;env&quot;] = result.MetaData[&quot;env&quot;];
					result.Json[&quot;fields&quot;] = fields;

					return result;
				}

				while (_blobs.Count == 0)
				{
					Thread.Sleep(_checkIntervalMiliseconds);

					GetCurrentBlobs();
				}

				var blobs = _blobs.ToList();
				for (int i = 0; i &amp;lt; blobs.Count; i++)
				{
					ReadLinesFromBlob(blobs[i].Key);
				}

				if (_unprocessed.Count == 0)
				{
					Thread.Sleep(_checkIntervalMiliseconds);
				}

			}
		}

		private void ReadLinesFromBlob(Uri key)
		{
			var cloudBlockBlob = _blobs[key];

			using (var stream = cloudBlockBlob.OpenRead())
			{
				using (var reader = new StreamReader(stream))
				{
					var originalPosition = GetPosition(cloudBlockBlob.Uri.AbsoluteUri);
					reader.BaseStream.Seek(originalPosition, SeekOrigin.Begin);

					while (!reader.EndOfStream)
					{
						var result = new Result(LogContext) { Line = reader.ReadLine() };
						result.MetaData[MetaDataKeys.FilePath] = cloudBlockBlob.Uri.AbsoluteUri;
						result.MetaData.Add(&quot;env&quot;, _metaDatas[cloudBlockBlob.Uri].EnvironmentName);
						result.MetaData.Add(&quot;app&quot;, _metaDatas[cloudBlockBlob.Uri].ApplicationName);
						result.Position = reader.GetLogicalPosition();

						if (reader.EndOfStream)
						{
							result.MetaData.Add(&quot;processed&quot;, &quot;true&quot;);
							result.MetaData.Add(&quot;etag&quot;, cloudBlockBlob.Properties.ETag);
						}

						_unprocessed.Enqueue(result);
					}
				}
			}
		}

		private long GetPosition(string blobUri)
		{
			var key = &quot;position_&quot; + blobUri;

			long position;
			if (!_positionCache.TryGetValue(key, out position))
			{
				return LogContext.Storage.Get&amp;lt;long&amp;gt;(key);
			}
			return position;
		}

		public void SavePosition(string blobUri, long pos, bool persist)
		{
			var key = &quot;position_&quot; + blobUri;
			_positionCache[key] = pos;

			if (persist)
			{
				LogContext.Storage.Insert(key, pos);
			}
		}

		public override void LineIsProcessed(Result result)
		{
			SavePosition(result.MetaData[MetaDataKeys.FilePath], result.Position, result.Position &amp;gt; 0);

			if (result.MetaData.Any() &amp;amp;&amp;amp; result.MetaData.ContainsKey(&quot;processed&quot;))
			{
				CloudBlockBlob removedBlob;
				_blobs.TryRemove(new Uri(result.MetaData[MetaDataKeys.FilePath]), out removedBlob);
				SavePosition(result.MetaData[MetaDataKeys.FilePath], 0, true);

				try
				{
					removedBlob.DeleteIfExists(accessCondition: AccessCondition.GenerateIfMatchCondition(result.MetaData[&quot;etag&quot;]));
				}
				catch (Exception e)
				{
					Console.WriteLine(e);
				}
			}
		}
	}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;With a default check interval of 30 seconds, all Azure storage accounts are iterated. Each blob found is attached an application name and environment name, found in the metadata of the container. If these are not specified on the container, the container is rejected for further processing. Then each line in the blob is read, and stored in a queue of unprocessed lines. When the overridden &lt;code class=&quot;highlighter-rouge&quot;&gt;GetLine()&lt;/code&gt; is called, we pick the oldest in the queue and attaches application name and environment name to the JSON before returning. When a line is processed we persist the position, and check whether we have reached the end of the blob. If this is the case, we delete the blob and resets the position to 0. The latter is due to issues, where Azure re-creates a deleted blob for further processing. We can only delete the blob, if Azure hasn’t added more content in-between we detected end-of-blob and we try to delete it.&lt;/p&gt;

&lt;p&gt;This implementation is pretty robust. It saves its position after reading a line and handles a possible race condition, so we don’t delete any blobs which has unprocessed lines.&lt;/p&gt;

&lt;p&gt;One thing is to make a custom implementation of the &lt;code class=&quot;highlighter-rouge&quot;&gt;LogInput&lt;/code&gt; class, another one is how to make these pieces run on Azure. We came up with the idea to run this as an &lt;a href=&quot;http://www.hanselman.com/blog/IntroducingWindowsAzureWebJobs.aspx&quot;&gt;Azure WebJob&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What we did was to create a free Azure Website, turn Always On, and add the output of your build as a .zip-file as a WebJob. The WebJob should be configured to run continuously. The Azure Website will unpack and start the &lt;code class=&quot;highlighter-rouge&quot;&gt;LogFlow.exe&lt;/code&gt;, which will find the assembly containing our flow.&lt;/p&gt;

&lt;h3 id=&quot;then&quot;&gt;Then()&lt;/h3&gt;
&lt;p&gt;In this step we process the lines picked up in the previous step. In our case we can use the builtin &lt;code class=&quot;highlighter-rouge&quot;&gt;IISLogProcessor&lt;/code&gt;. This processor will parse each line and set the correct fields with the correct values.&lt;/p&gt;

&lt;h3 id=&quot;tooutput&quot;&gt;ToOutput()&lt;/h3&gt;
&lt;p&gt;In the final step we use the build-in &lt;code class=&quot;highlighter-rouge&quot;&gt;ElasticSearchOutput&lt;/code&gt; processor. It takes an &lt;code class=&quot;highlighter-rouge&quot;&gt;ElasticSearchConfioguration&lt;/code&gt; as parameter. In this configuration, we set the &lt;code class=&quot;highlighter-rouge&quot;&gt;IndexNameFormat&lt;/code&gt; property and provides a &lt;code class=&quot;highlighter-rouge&quot;&gt;ConnectionSettings&lt;/code&gt; instance as a parameter. Since our ElasticSearch server is using SSL, we provide a &lt;code class=&quot;highlighter-rouge&quot;&gt;Uri&lt;/code&gt; instance with the correct credentials.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;So, in this post I’ve outlined how we managed to get the Azure IIS logs into ElasticSearch. We use the build-in feature of Azure Websites to make them send their logs to Azure Storage. From here we pick them up using a WebJob, running on an Always On Azure Website. This WebJob uses LogFlow to process the log entries, and finally forwarding them to an Azure Virtual Machine which has an ElasticSearch server running.&lt;/p&gt;

&lt;p&gt;If you have any comments, feedback, or what so ever, please feel free to throw us a comment below.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>NCrunch, My New Crush</title>
   <link href="http://madstt.dk/ncrunch-my-new-crush/"/>
   <updated>2015-02-05T00:00:00+00:00</updated>
   <id>http://madstt.dk/ncrunch-my-new-crush</id>
   <content type="html">&lt;p&gt;This blog post is not about falling in love, being in love or love life in general. We fall in love now and then. Some love relations lasts a single night, some last longer, and even some lasts a lifetime. We fall in love, split up, find each other again, split up again, find someone else, and it all starts over again. You can put your money on multiple horses at once, but it is not recommendable though.&lt;/p&gt;

&lt;p&gt;In the software business you get in touch with a large number of tools and technologies. Some gets dumped immediately, some stick around for a while and some even makes it into your toolbox. In contrast to your love life, you can have multiple tool and technology love relations at once, each serving their purpose.&lt;/p&gt;

&lt;p&gt;In this post I’ll show off my latest score.&lt;/p&gt;

&lt;h2 id=&quot;my-new-crush&quot;&gt;My New Crush&lt;/h2&gt;

&lt;p&gt;Years back I put my hands on this new continuous testing tool called &lt;a href=&quot;http://www.ncrunch.net/&quot;&gt;NCrunch&lt;/a&gt;. I loved the idea and the perspectives. Unfortunately, I experienced some heavy performance issues, and had to uninstall the trial immediately. I dumped NCrunch. I forgot all about it. I made the conclusion that this was just another one of those tools who promised too much on the outside, and couldn’t live up to that. We have all been there. No big deal.&lt;/p&gt;

&lt;p&gt;Years went by, I saw NCrunch named here and there, but always remembered how it had dragged down Visual Studio to its knees. Not for me.&lt;/p&gt;

&lt;p&gt;Then a couple of months ago, I saw a Tweet by &lt;a href=&quot;https://twitter.com/randompunter&quot;&gt;Damian Hickey&lt;/a&gt; saying that he was using NCrunch. Damian is one of my trusted sources when it comes to tools and technologies, so I thought why not give it another chance. I’d once fall in love with the ideas and concepts, time has passed, so there might have been some improvements.&lt;/p&gt;

&lt;p&gt;And there has. This is not a complete feature full description of NCrunch, but more my personal usage and why I’ve fallen in love with this tool, and why it deserves a place in my toolbox.&lt;/p&gt;

&lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;
&lt;p&gt;You can download a 30-day trial, and get access to all features. I’d recommend this, for both first-timers and old lovers. The first time you start up Visual Studio after installing NCrunch, you’re met with the configuration wizard. This is a brilliant piece of configuration. It lets your configure fine-grained details about how NCrunch should behave inside Visual Studio. Among other details, it lets you configure how to share the number of cores between NCrunch and Visual Studio.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://madstt.dk//..//images//nchrunch_wizard.PNG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is a huge improvement. There are other key performance optimizations you can do with the wizard, like the maximum number of processing threads, parallel test execution, etc.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://madstt.dk//..//images//nchrunch_ignore.PNG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The last configuration you should do, before sending NCrunch loose on your code, is to specify how NCrunch should act upon start. You can choose to either, run all tests, or disable all and then enable them manually. Depending on your application, you might consider going for the latter. Currently, I have NCrunch running on a solution with ~7000 unit tests, so it would stupid to make NCrunch run all tests every time I change a character. My advise is therefore, to optimize performance, disable NCrunch for all test, and then enable / disable depending on the system under test (SUT).&lt;/p&gt;

&lt;h2 id=&quot;lets-go-testing&quot;&gt;Let’s Go Testing&lt;/h2&gt;
&lt;p&gt;Once configured, and enabled (&lt;code class=&quot;highlighter-rouge&quot;&gt;Ctrl+M, D&lt;/code&gt;), you’ll notice dots next to each line in your code. The dots are very important, and gives you immediate feedback about the testing state of each line. A white dot means that this line of code is not covered by any unit tests. Red means there is at least one failing test for that line. And, of course, a green dot indicate that all unit tests covering this line succeeds. A red cross indicates in which line a test is failing.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://madstt.dk//..//images//ncrunch_dots.PNG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As I use this tool, I find myself not doing things I used to. I rarely or never run the application. I never run use the unit test runner. I even rarely compile my code. Well, I do sometimes, but that’s pretty much just old habits. The NCrunch build engine is much faster than the built-in. Tools like NCrunch changes the way you work to the better. This is efficient development.&lt;/p&gt;

&lt;h3 id=&quot;code-coverage&quot;&gt;Code Coverage&lt;/h3&gt;
&lt;p&gt;As you can tell by looking over the code, you will be given an indication of the code coverage of that particular unit of code, i.e. white dots means not coverage and red/green dots means coverage. This is very valuable. It means that you don’t need an extra tool (read license), or extra window, for telling you about the code coverage. Coverage is explicit, right next to your code, not in some percentage in a dialog somewhere. It gives you that immediate feedback that is so valuable. Code coverage in percentages is a management KPI. I want to see which lines that are not covered by any unit tests. Now. Inline in my code window.&lt;/p&gt;

&lt;p&gt;Next to the line where a test is failing, there will be red cross. If you wanna navigate to the corresponding tests, the &lt;code class=&quot;highlighter-rouge&quot;&gt;Ctrl+M, S&lt;/code&gt; shortcut will open a context menu to show you which tests covers that specific line.&lt;/p&gt;

&lt;p&gt;If you wanna see the ‘usual’ full code coverage of your code base, this is possible through the NCrunch Metrics dialog.&lt;/p&gt;

&lt;h3 id=&quot;profiling&quot;&gt;Profiling&lt;/h3&gt;
&lt;p&gt;If we switch over to your unit tests, you’ll see the same dots as in your SUT. You’ll see whether the test is successful and a red cross indicates where in the test it is failing. In contrast to the dots in the SUT, these dots can have varying colors. These dots has a ring, indicating a ‘hot spot’, which means that the test is slow. If you hover your mouse over the dot, you’ll see how much time NCrunch took to execute that specific line. This is also a very useful feature. Instead of investing in an expensive profiling tool, NCrunch will give you this, inline in code.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://madstt.dk//..//images//ncrunch_profiling.PNG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As it can be seen in the above, the code lines 761, 762, and 768 are ‘hot spots’ and have a significant execution time, while the lines 771 and 773, has less significant execution time.&lt;/p&gt;

&lt;h3 id=&quot;risk-and-progress-bar&quot;&gt;Risk And Progress Bar&lt;/h3&gt;
&lt;p&gt;This is one little brilliant feature. The Risk and Progress bar (R&amp;amp;PB) keeps track of the overall status of how your coverage is and how you’re doing overall, in one compact overview.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://madstt.dk//..//images//ncrunch_bar.PNG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The R&amp;amp;PB consists of two components, a numerical indicator and a risk projection. If there is any failing tests, the numerical indicator would show the number. If there isn’t any failing tests, a risk percentage will indicate whether there might be tests that can fail given the current state of the solution. If it is a large solution with many long running tests, the risk percentage can indicate whether or not to make a commit to source control.&lt;/p&gt;

&lt;p&gt;The risk projection serves two purposes, an overall status of the ongoing NCrunch processing, indicated by a progress bar, and a risk curve, indicated by a darker color, which shows the risk percentage at any time during processing.&lt;/p&gt;

&lt;h3 id=&quot;distributed-processing&quot;&gt;Distributed Processing&lt;/h3&gt;
&lt;p&gt;This could become a real time saver. NCrunch can offload build and test processing to servers. For developer teams this is could be an awesome feature. Builds and tests can be processed concurrently on a number of other computers. It is even possible to offload the entire build and test work from the client. All that is required is a TCP connection to where the processing should be offloaded to.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;As I’ve already outlined, I’m in love. NCrunch is not just a crush. NCrunch is love. As outlined in this post, NCrunch has quickly become an essential tool in my toolbox. I can’t imagine me writing any unit tests without anymore. I’d encourage any other unit test practitioner to give NCrunch a spin. I promise you, you’ll thank me afterwards.&lt;/p&gt;

&lt;p&gt;Also as stated there is a 30-day trial, and I admit it, it is a rather expensive license, but it is worth every little penny.&lt;/p&gt;

&lt;p&gt;Throw me comment below and share your experiences using NCrunch.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Migrating to Jekyll</title>
   <link href="http://madstt.dk/migrating-to-jekyll/"/>
   <updated>2015-01-20T00:00:00+00:00</updated>
   <id>http://madstt.dk/migrating-to-jekyll</id>
   <content type="html">&lt;p&gt;For a while I’ve been working on migrating my blog over from Wordpress to &lt;a href=&quot;https://pages.github.com/&quot;&gt;Github Pages&lt;/a&gt; and &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;what&quot;&gt;What&lt;/h2&gt;
&lt;p&gt;So, Jekyll is a static site generator written in Ruby. I uses a template engine called Liquid which supports a number of markdown flavors, as well as HTML. You can therefore write your blog posts in HTML or markdown, and then make Jekyll generate a static HTML page for you.&lt;/p&gt;

&lt;h2 id=&quot;why&quot;&gt;Why&lt;/h2&gt;
&lt;p&gt;A number reasons is behind this decision. I was really never that happy with my Wordpress solution, I had a hard time with the themes. Actually I never found a theme that I really liked. So my reasons to migrate can be outlined in the following bullets.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I really had a hard time working with the Wordpress themes, I couldn’t find one that fitted my needs and I found customizations hard.&lt;/li&gt;
  &lt;li&gt;I’m a markdown lover. It really fits my needs. I feel much more productive writing beautiful posts and notes using markdown. I try to use it everywhere I can. I recently got markdown support in Confluence from Atlassian. We use Confluence for documents at work.&lt;/li&gt;
  &lt;li&gt;I like that I can sit down and write my blog posts in my favorite markdown editor, currently &lt;a href=&quot;http://www.markdownpad.com/&quot;&gt;MarkdownPad&lt;/a&gt;, and just git commit and push it to my blog.&lt;/li&gt;
  &lt;li&gt;One of the things that was really hard for me when using Wordpress, was how code is rendered. I tried different approaches, but neither seemed to fit my needs.&lt;/li&gt;
  &lt;li&gt;All the themes I tried out, did not render nicely on mobile or tablet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So therefore I migrated to GitHub Pages.&lt;/p&gt;

&lt;h2 id=&quot;how&quot;&gt;How&lt;/h2&gt;
&lt;p&gt;Basically I followed &lt;a href=&quot;http://hadihariri.com/2013/12/24/migrating-from-wordpress-to-jekyll/&quot;&gt;Hadi Hariri’s guide&lt;/a&gt;. Although Hadi’s post is based on installing Jekyll on OSX (Linux and Unix is also supported out of the box), and I wanted to install this on Windows, his guide is good starting point.&lt;/p&gt;

&lt;p&gt;To install Jekyll on Windows I followed &lt;a href=&quot;http://jekyll-windows.juthilo.com/&quot;&gt;Julian Thilo’s guide&lt;/a&gt;. Once you’re done with Hadi’s and Julian’s guides, you have all your blog posts in the &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; folder as HTML.&lt;/p&gt;

&lt;p&gt;I then spend some time finding a &lt;a href=&quot;http://jekyllthemes.org/&quot;&gt;Jekyll theme&lt;/a&gt; that would cover most of my needs. At this point I could start tweaking the &lt;code class=&quot;highlighter-rouge&quot;&gt;_config.yml&lt;/code&gt; and the templates in &lt;code class=&quot;highlighter-rouge&quot;&gt;_layout&lt;/code&gt;. You can use your HTML and CSS skills to modify and tweak your blog to look exactly as you would like.&lt;/p&gt;

&lt;p&gt;I write my blog posts in markdown, and the Liquid templates takes care of how it is rendered.&lt;/p&gt;

&lt;h2 id=&quot;done&quot;&gt;Done?&lt;/h2&gt;
&lt;p&gt;No. I’m still not completely satisfied with the looks of the blog. I’m still in the progress of changing bits and pieces. One of the things I would really like, is an archive feature, to where I can reference for specific categories. I also need to change the landing page. I don’t like the current ‘list’ view. There are other more or less advanced changes that is would like to apply.&lt;/p&gt;

&lt;p&gt;Throw me a comment of what you think about the new layout of my blog.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>So, Campus Days 2014...</title>
   <link href="http://madstt.dk/so-campus-days-2014/"/>
   <updated>2014-12-03T00:00:00+00:00</updated>
   <id>http://madstt.dk/so-campus-days-2014</id>
   <content type="html">&lt;p&gt;Last week I had the opportunity to attend Campus Days 2014 in Copenhagen. A Microsoft hosted conference. In this post I’ll give my feedback on the conference and, in particular, the content.&lt;/p&gt;

&lt;p&gt;It was my first Campus Days conference, since Campus Days until this year had been focusing more on the DevOps/IT Pro facets. It now turns out that Danish Developer Conference has merged with Campus Days. This makes the conference a much better choice for developers.&lt;/p&gt;

&lt;p&gt;Since august I had been in contact with one of the organizers, Technical Evangelist &lt;a href=&quot;https://twitter.com/AndersLybecker&quot;&gt;Anders Lybecker&lt;/a&gt;, whether I should be giving a talk on &lt;a href=&quot;http://scriptcs.net&quot;&gt;scriptcs&lt;/a&gt;. Unfortunately, I didn’t make the cut, but was giving a user group talk at &lt;a href=&quot;http://www.meetup.com/Copenhagen-Net-User-Group/events/211915142/&quot;&gt;CNUG&lt;/a&gt; on Tuesday night instead.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/B3Td_4TIgAArxwc.jpg:medium&quot; alt=&quot;Self&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;sessions&quot;&gt;Sessions&lt;/h3&gt;

&lt;p&gt;Campus Days 2014 had 11 tracks(!), but in essence there two-three tracks that would be relevant for .Net developers. These tracks were App Development, Microsoft Azure &amp;amp; Web Development, and Visual Studio &amp;amp; Team Foundation Server. So in these three tracks I found my sessions.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://twitter.com/maryjofoley&quot;&gt;Mary Jo Foley&lt;/a&gt; from ZDNet gave an inspiring keynote on how she saw Microsoft in the past, today, and tomorrow. This was not the usual keynote, which gave a sort meh-feeling afterwards. With over 900 attendees, a large venue and Microsoft as host, I would expect them to be able to attract a larger speaker name.&lt;/p&gt;

&lt;p&gt;I started out at session called Introduction to Project Roslyn with &lt;a href=&quot;https://twitter.com/dotHenrik&quot;&gt;Henrik Lykke Nielsen&lt;/a&gt;. I think this was my third introduction to Roslyn, and none, this one included, has given me the everyday tool that I was promised. What I really mean by this is, that since I heard about Roslyn back i 2011, I was told that this would revolutionize the .Net developer’s toolbox. I still miss this point. Henrik gave a good baseline introduction to Roslyn, and then, like the other ‘introduction to’ sessions I’ve attended, showed of how to make analysis and diagnostic tools for Visual Studio. This is a great feature, no doubt, but who would argue that this is a feature that the everyday .Net developer would use? I might not be too objective, but I think that what &lt;a href=&quot;http://scriptcs.net&quot;&gt;scriptcs&lt;/a&gt; does is were I see power of Roslyn unleashed - powerful and instant compilation of C# code.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/B3R1nD5IEAAsXw5.jpg:medium&quot; alt=&quot;Henrik Lykke Nielsen&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://twitter.com/AndersLybecker&quot;&gt;Anders Lybecker&lt;/a&gt; gave a nice session on &lt;a href=&quot;http://azure.microsoft.com/en-us/documentation/services/search/&quot;&gt;Azure Search&lt;/a&gt; full-text searching. Having experience with &lt;a href=&quot;http://www.elasticsearch.org/&quot;&gt;Elastic Search&lt;/a&gt; I think Azure’s ‘we’ll do the configuration for you’-approach is something that might trigger a lot of newcomers into using these search engines. It is very straightforward to install and configure Elastic Search, but if you are new to full-text searching the Azure Search approach is very appealing.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://twitter.com/mookid8000&quot;&gt;Mogens Heller Grabe&lt;/a&gt; held his famous talk on CQRS and event sourcing. I’ve heard the talk before, but Mogens did some very neat things using &lt;a href=&quot;http://azure.microsoft.com/en-us/documentation/articles/service-bus-dotnet-how-to-use-relay/&quot;&gt;Azure Service Bus Relay Service&lt;/a&gt;, which I’ve never seen before. With the relay service you can create hybrid applications that can run both on-promise and in the cloud, and still use the same infrastructure. The relay service makes it possible to by-pass firewall restrictions.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/B3SwNZoIQAEMLnQ.jpg:medium&quot; alt=&quot;Mogens Heller Grabe&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On the second day, I went to see &lt;a href=&quot;https://twitter.com/sitereactor&quot;&gt;Morten Christensen&lt;/a&gt; do a session on &lt;a href=&quot;http://www.bradygaster.com/post/getting-started-with-the-windows-azure-management-libraries&quot;&gt;Azure Management Libraries&lt;/a&gt;. In essence the Azure Management Libraries is bunch of CLI tools for automating everything around managing your Azure instances. Being a CLI and automation fan-boy I found these tools very appealing, and something that I need to have in my toolbox. Morten did somehow mistime his talk, and did the session in 30 minutes, despite it being a 75 minutes slot. My own experience is that it is very difficult to hit the exact time, but a 45 minutes off is way too much. 30 minutes into a session slot, doesn’t give the attendees a chance to find different session, since it’s difficult catch up for missing 30 minutes.&lt;/p&gt;

&lt;p&gt;In the next slot, I attended &lt;a href=&quot;https://twitter.com/chr_horsdal&quot;&gt;Christian Horsdal&lt;/a&gt; doing a talk on modulary web applications using OWIN/Katana. I’ve used &lt;a href=&quot;http://owin.org/&quot;&gt;OWIN&lt;/a&gt; for &lt;a href=&quot;http://oauth.net/&quot;&gt;OAuth2&lt;/a&gt; before, but Christian showed off some nice Func-of-Func examples, that really illustrated the OWIN pipeline workflow. Good talk, with a nice flow and good balance between slides and code.&lt;/p&gt;

&lt;p&gt;Later I had the pleasure of enjoying &lt;a href=&quot;https://twitter.com/dalager&quot;&gt;Christian Dalager&lt;/a&gt;’s talk on &lt;a href=&quot;http://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/&quot;&gt;Azure WebJobs&lt;/a&gt;. I’ve never had any scenario for WebJobs, but they are pretty cool. So, basically you can write scripts in your favorite script language, although scriptcs is still missing, and make your Azure Website make use of it to do some background job. Christian demoed a small Twitter-like app for sending emotional tweets, or emotweets. He showed how the site would benefit from the use of WebJobs. I really liked Christian’s presentation, both informative and funny.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/B3Xb-fxCEAAXl1e.jpg:medium&quot; alt=&quot;Christian Dalager&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The last session on the second day of Campus Days, was on web security. &lt;a href=&quot;https://twitter.com/2600dk&quot;&gt;Anders Skovsgaard&lt;/a&gt;, the founder and kingpin behind &lt;a href=&quot;https://www.hackavoid.com/&quot;&gt;Hackavoid&lt;/a&gt;, did a really awesome session on and about web security. Probably the best of the conference, so much take-away. He did a combine theory and practice session, where he show some of the most utilized web site hacker methods, both with examples of how to use them and how to prevent them. This is a very smart and bright guy, who has a lot experience in this field. He has done security work for both Google and Twitter.&lt;/p&gt;

&lt;p&gt;On the third day, I stopped by &lt;a href=&quot;https://twitter.com/dotnetnerd&quot;&gt;Christian Holm Diget&lt;/a&gt;’s talk on patterns in single-page applications. I probably had other expectations to that talk, than what Christian really wanted to show. From the title and the abstract, I would have expected a talk on general patterns in single-page applications, but Christian showed us how AngularJS and other frameworks are composed, and that they share similarities. One of points, Christian emphasized was that, you, as a developer, should not be too religious about choice of framework, but rather focus on design principles and the domain. That’s true. I would therefore have expected, a clean talk without any, or maybe very little, mentions of libraries and frameworks. As a former colleague, I can tell that Christian is a great developer, both on .Net and web, and can give us all a lesson on single-page applications, but I just had the wrong expectations to this talk.&lt;/p&gt;

&lt;p&gt;In my second session on the third day, I attended &lt;a href=&quot;https://twitter.com/azureteamlasse&quot;&gt;Lasse Skytte Knudsen&lt;/a&gt; in his talk about migrating from Azure Federation to Azure Elastic Scale. This talk really didn’t get. I was probably not the target audience. It was one of those sessions slots, where it was difficult to pick a session.&lt;/p&gt;

&lt;p&gt;The ASP.NET vNext has really been buzzed and hyped recently, so it really made good sense to attend a talk about this topic. &lt;a href=&quot;https://twitter.com/stigip&quot;&gt;Stig Irming-Pedersen&lt;/a&gt; gave us a great introduction by showing off some of the most important aspects. This talk was indeed one of the highlights of the conference. I’m not going to use this post on explaining details about ASP.NET vNext, this can be read elsewhere, but I would use this space to credit Stig for a great talk.&lt;/p&gt;

&lt;p&gt;My last session of Campus Days 2014, was about coded UI tests and cloud-based load tests. I’ve previously used coded UI tests, and was rather pleased to see how much has progressed since then. &lt;a href=&quot;https://twitter.com/peterlindbergdk&quot;&gt;Peter Lindberg&lt;/a&gt; gave a brief introduction to the latest in coded UI test with Visual Studio. Showed a nice demo with manually recording test scenarios, progressed and showed how to automate them. Finally, maybe a bit overdue, but nonetheless very relevant, cloud-based load tests were used to load test the application with the same test scenario. These cloud-based load tests has very promising aspects. You can assign a number of virtual users, depending on your subscription, and make them use your application. Very clever.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/B3c9PQLCQAASPKr.jpg:medium&quot; alt=&quot;Peter Lindberg&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;venue&quot;&gt;Venue&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;http://cinemaxx.dk/koebenhavn/&quot;&gt;Cinemaxx&lt;/a&gt; movie theater is a great venue for hosting a conference. Great audio, great seats and awesome displays. But, and there is usually a but. Why does a movie theater with 14 screens on three floors, only have toilets on the lower floor. The staffing was adequate and kind. All in all, the positives by far outnumbers the negatives with regard to the venue.&lt;/p&gt;

&lt;h3 id=&quot;catering&quot;&gt;Catering&lt;/h3&gt;
&lt;p&gt;Catering covers all kinds of food, beverages and snacks provided by the host or sponsors. And this is by far, my most critical point, it was bad. Compared to other Microsoft hosted conferences I’ve attended, the catering of Campus Days 2014 was particularly bad. On the first day, my session got delayed due to some technical issues, so all there was left was this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/B3SPi8CCQAAENXo.jpg:medium&quot; alt=&quot;Turtle?&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I’ve got a lot of replies on Twitter, asking what this is. And no, it is not a dead or squashed turtle. It should be something Paleo-thingy, with Portobello mushrooms acting as bread around some veggies and meat. I didn’t taste it, so I’m willing to take the punches. But Microsoft, this is an IT conference, throw us some delicious sandwiches, and use the Paleo stuff in your own canteen.&lt;/p&gt;

&lt;p&gt;On the second day, there were sandwiches, and great sandwiches. But, on the third day, we were back to the experimental kitchen. I ended up getting two rolls in ricepaper with a tiny piece of salmon, and a proportionally large amount of salad. They were very dry and tasteless. An alternative was wraps with pulled pork. I was thrilled, but again, so terribly disappointed. The tortilla wrap was replaced with cabbage leaves. Now that is blasphemy. Again, were did the good sandwiches from day 2 go? Some times the good alternatives were lacking in stock.&lt;/p&gt;

&lt;p&gt;Breakfast was served in brown bags. Brown bags with a tiny piece of bread with a hard crust, some cheese, chocolate spread, and jam. The bread was nice and fresh, but why only a single piece. I got two bags, ending up with too much cheese and stuff, generating food-spill. And all garbage these brown bags generate was enormous.&lt;/p&gt;

&lt;p&gt;Also at the social event on Wednesday night, a 1920s themed event with jazz and poker tables. It was well themed, loved the jazz, the entertainment, and drinks, but again the food failed. We had Budweiser, bad beer, and badly timed according to the 1920s theme, but ok, I could live with that. There were other options like a variety of craft beers, wine and drinks. The food was steaks and burgers. Unfortunately, the steaks was very rare, and served only with a fork. Although chopped, but in very large chunks, it just made the experience so bad. The burgers was ok, to the extend that they were difficult to handle and very juice. One thing to note about the Campus Days conference, is that there was not enough seats for everyone, so many meals is eaten standing.&lt;/p&gt;

&lt;h3 id=&quot;round-up&quot;&gt;Round Up&lt;/h3&gt;
&lt;p&gt;This really turned out to be a large blog post, but I think the speakers, of which sessions I attended, deserves some feedback. I know they’ve spend hours preparing their talks. And also Microsoft for hosting the conference, might need some feedback from the trenches.&lt;/p&gt;

&lt;p&gt;All in all a great event. The assembled group of speakers was great, although I could have wished for bigger speaker names which could have given the conference some international attendees as well.&lt;/p&gt;

&lt;p&gt;An advise on the catering, find different supplier that knows their audience and were supplies last.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>scriptcs.rebus 0.5.0</title>
   <link href="http://madstt.dk/scriptcs-rebus-0-5-0/"/>
   <updated>2014-11-13T04:37:15+00:00</updated>
   <id>http://madstt.dk/scriptcs-rebus-0-5-0</id>
   <content type="html">&lt;p&gt;This release is coming very soon after the 0.4.0. It doesn't mean that I'm going to increase my release cycle, it's just that I have some new features that I'd like to share with you and there were things in the 0.4.0 that I wasn't satisfied with.&lt;/p&gt;
&lt;h2&gt;What's New&lt;/h2&gt;
&lt;p&gt;The following subsections describe the new features of scriptcs.rebus 0.5.0.&lt;/p&gt;
&lt;h3&gt;New API for scriptcs.rebus.hosting&lt;/h3&gt;
&lt;p&gt;In 0.4.0 I introduced the hosting feature in scriptcs.rebus. With this feature you can extend any standard .Net application with new functionality using scriptcs. You would send a custom script to a host application, which would then be able to compile the script and execute this inside the host process. Now, in 0.4.0 you would send the script like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .SendAScriptFile(&quot;start.csx&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This would send the script inside the &lt;code&gt;start.csx&lt;/code&gt; to a host for execution. And, if you would need to download and reference a NuGet package, you would do it like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .SendAScriptFile(&quot;start.csx&quot;, &quot;mongocsharpdriver&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This would download and reference the Mongo C# driver and execute the &lt;code&gt;start.csx&lt;/code&gt; script inside the host application. This was my initial and, admitted, pretty naive implementation. So, when I wanted to introduce the use of the Mono compiler inside the hosted application, I ran into some issues. You can read all about my endeavours with scriptcs.hosting &lt;a href=&quot;http://madstt.dk/endeavours-with-scriptcs-hosting/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, in 0.5.0 I've changed the API, so now if you want to send a script you go like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .WithAScript(&quot;Console.WriteLine(\&quot;Hello everyone!\&quot;)&quot;)
    .Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And a script file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .WithAScriptFile(&quot;start.csx&quot;)
    .Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is all just semantics, so why the change? Well, I wanted to add a bunch of additional options, so therefore I needed a fluent api for this. In the following sections I'll shortly describe them.&lt;/p&gt;
&lt;h3&gt;Add a Local Reference to Host Executed Script&lt;/h3&gt;
&lt;p&gt;If you want to reference a local assembly to be used in your script, this could be an assembly that is part of the host application, you can add the following option:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .WithAScriptFile(&quot;start.csx&quot;)
        .AddLocal(&quot;someLocal.dll&quot;)
    .Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, you can reference more local assemblies, just add another &lt;code&gt;AddLocal()&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;Download and Reference a NuGet Package for Host Executed Script&lt;/h3&gt;
&lt;p&gt;So if your script needs a NuGet package to extend the host, you can specify these using the &lt;code&gt;AddFromNuGet()&lt;/code&gt; like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .WithAScriptFile(&quot;start.csx&quot;)
        .AddFromNuGet(&quot;mongocsharpdriver&quot;)
    .Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Again, you can add multiple &lt;code&gt;AddFromNuGet()&lt;/code&gt; to the configuration.&lt;/p&gt;
&lt;h3&gt;Importing a Namespace for a Host Executed Script&lt;/h3&gt;
&lt;p&gt;So, imagine we now have downloaded a NuGet package or referenced a local assembly, then to make it available for the script, you need to specify in which namespace to find the type you wanna use:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .WithAScriptFile(&quot;start.csx&quot;)
        .AddFromNuGet(&quot;mongocsharpdriver&quot;)
        .ImportNamespace(&quot;MongoDB.Bson&quot;)
    .Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This would download and reference the Mongo C# driver and make the MongoDB.Bson namespace available to the script for execution.&lt;/p&gt;
&lt;h3&gt;Using the Mono Compiler on the Host&lt;/h3&gt;
&lt;p&gt;Since the current release of Roslyn, does not support things like the &lt;code&gt;dynamic&lt;/code&gt; keyword or &lt;code&gt;async/await&lt;/code&gt;, it might be handy to be able to use the Mono compiler on the host:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .WithScriptFile(&quot;start.csx&quot;)
        .UseMono()
    .Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the Mono compiler is set as execution engine, the script will be compiled. A scenario like this could also be relevant when doing cross-platform development.&lt;/p&gt;
&lt;h3&gt;Logging Inside the Host&lt;/h3&gt;
&lt;p&gt;In some cases it might be great to see some debugging output in the host console.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;myOwnBus&quot;)
    .WithScriptFile(&quot;start.csx&quot;)
        .UseLogging()
    .Send()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This sets the loglevel to Debug, instead of Info which is default. This feature is only relevant in a limited number of cases where the host is a console application.&lt;/p&gt;
&lt;h3&gt;Using Script Packs Inside a Host&lt;/h3&gt;
&lt;p&gt;Script packs are really just NuGet packages used for hiding boilerplate code of common frameworks. Therefore, if you download and reference a script pack, it will be made available to the script without any further.&lt;/p&gt;
&lt;p&gt;That's all there is to 0.5.0. So throw me comment, either below or on &lt;a href=&quot;https://twitter.com/madstt&quot;&gt;Twitter&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Endeavours With scriptcs.hosting</title>
   <link href="http://madstt.dk/endeavours-with-scriptcs-hosting/"/>
   <updated>2014-11-05T04:16:09+00:00</updated>
   <id>http://madstt.dk/endeavours-with-scriptcs-hosting</id>
   <content type="html">&lt;p&gt;One of the most promising perspectives in scriptcs, in my opinion, is hosting. Basically hosting is the complete package of scriptcs, just put inside your own application. It can be pretty mind blowing to think about this. Hosting makes it possible execute C# scripts inside of any standard .Net application.&lt;/p&gt;
&lt;p&gt;With my scriptcs.rebus project, I wanted to add a feature, which would use scriptcs.hosting for executing scripts inside of a host. The script was supposed to be send over either MSMQ, RabbitMQ, or Azure Service Bus. When the host received the script it would be executed. It should also be possible to added NuGet references, local dependencies, and import namespaces to be used by the script.&lt;/p&gt;
&lt;p&gt;I had read the excellent blog post by Filip Wojcieszyn on &lt;a href=&quot;http://www.strathweb.com/2013/10/extend-glimpse-fly-scriptcs-code-execution-tab-glimpse/&quot;&gt;extending Glimpse using scriptcs&lt;/a&gt;. This blog post gives a small hint on the perspectives for scriptcs hosting. When I came up the idea of combining scriptcs hosting with messaging, I had a &lt;a href=&quot;https://jabbr.net/#/rooms/scriptcs&quot;&gt;Jabbr&lt;/a&gt; session with &lt;a href=&quot;http://twitter.com/gblock&quot;&gt;Glenn Block&lt;/a&gt;, who guided me in the right direction.&lt;/p&gt;
&lt;p&gt;The end of the session with Glenn, was that all I needed to do was reference &lt;code&gt;scriptcs.hosting&lt;/code&gt;, and I should be given all the dependencies needed.&lt;/p&gt;
&lt;h2&gt;Initial Attempt&lt;/h2&gt;
&lt;p&gt;I started looking into how the internals of scriptcs is working, and how hosting in particular is working. I soon realized that there is a number of different dependencies at work, and quickly came up with idea of using &lt;a href=&quot;http://autofac.org/&quot;&gt;AutoFac&lt;/a&gt;, which is also used inside of scriptcs hosting. I wrote a rather nice script module, on which I registered all my dependencies from &lt;code&gt;scriptcs.hosting&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This script module would be registered in my &lt;code&gt;ScriptHandler&lt;/code&gt;. The ScriptHandler subscribes to messages of type &lt;code&gt;Script&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class ScriptHandler : IHandleMessages&amp;lt;Script&amp;gt;
{
    public void Handle(Script message)
    {
        var builder = new ContainerBuilder();

        builder.RegisterModule(new ScriptModule());

        using (var container = builder.Build())
        {
            using (var scope = container.BeginLifetimeScope())
            {
                var logger = scope.Resolve&amp;lt;ILog&amp;gt;();
                var executor = scope.Resolve&amp;lt;ScriptExecutor&amp;gt;();
                scope.Resolve&amp;lt;IInstallationProvider&amp;gt;().Initialize();

                try
                {
                    executor.Execute(message.ScriptContent, message.Dependencies);
                }
                catch (Exception ex)
                {
                    logger.Error(ex);
                    throw;
                }
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So upon receiving a script, the script module is registered, and I can resolve the logger and &lt;code&gt;ScriptExecutor&lt;/code&gt;. I thought this was a pretty cool setup.&lt;/p&gt;
&lt;p&gt;For completeness my &lt;code&gt;ScriptExecutor&lt;/code&gt; would look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; public class ScriptExecutor
 {
    private readonly ILog _logger;
    private readonly IFileSystem _fileSystem;
    private readonly IPackageAssemblyResolver _packageAssemblyResolver;
    private readonly IPackageInstaller _packageInstaller;
    private readonly IScriptPackResolver _scriptPackResolver;
    private readonly IScriptExecutor _scriptExecutor;

    public ScriptExecutor(ILog logger, IFileSystem fileSystem,
                        IPackageAssemblyResolver packageAssemblyResolver,
                        IPackageInstaller packageInstaller, IScriptPackResolver scriptPackResolver,
                        IScriptExecutor scriptExecutor)
    {
        _logger = logger;
        _fileSystem = fileSystem;
        _packageAssemblyResolver = packageAssemblyResolver;
        _packageInstaller = packageInstaller;
        _scriptPackResolver = scriptPackResolver;
        _scriptExecutor = scriptExecutor;
    }

    public void Execute(string script, string[] dependencies)
    {
        // set current dicrectory, import for NuGet.
        Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;

        // prepare NuGet dependencies, download them if required
        var nuGetReferences = PreparePackages(_fileSystem, _packageAssemblyResolver,
                                        _packageInstaller, PrepareAdditionalPackages(dependencies));

        // get script packs: not fully tested yet        
        var scriptPacks = _scriptPackResolver.GetPacks();

        // execute script from file
        _scriptExecutor.Initialize(nuGetReferences, scriptPacks);
        var scriptResult = _scriptExecutor.ExecuteScript(script);
        if (scriptResult != null)
            if (scriptResult.CompileExceptionInfo != null)
                if (scriptResult.CompileExceptionInfo.SourceException != null)
                    _logger.Debug(scriptResult.CompileExceptionInfo.SourceException.Message);
    }

    private IEnumerable&amp;lt;IPackageReference&amp;gt; PrepareAdditionalPackages(string[] dependencies)
    {
        return from dep in dependencies
            select new PackageReference(dep, new FrameworkName(&quot;.NETFramework,Version=v4.0&quot;), string.Empty);
    }

    // prepare NuGet dependencies, download them if required
    private static IEnumerable&amp;lt;string&amp;gt; PreparePackages(IFileSystem fileSystem, IPackageAssemblyResolver packageAssemblyResolver,
                            IPackageInstaller packageInstaller, IEnumerable&amp;lt;IPackageReference&amp;gt; additionalReferences)
    {
        var workingDirectory = Environment.CurrentDirectory;

        var packages = packageAssemblyResolver.GetPackages(workingDirectory);
        packages = packages.Concat(additionalReferences);

        packageInstaller.InstallPackages(
                            packages,
                            allowPreRelease: true);

        return packageAssemblyResolver.GetAssemblyNames(workingDirectory);
    }

}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;Execute()&lt;/code&gt; method will take the script to be executed and a number NuGet dependencies. Setting the &lt;code&gt;Environment.CurrentDirectory&lt;/code&gt; is required for NuGet to be able to determine which packages are already installed, and where to download and install the new ones. The &lt;code&gt;PreparePacakages()&lt;/code&gt; method will download and install NuGet packages, if they are not already installed. If there is any script packs installed, they'll be referenced, using the &lt;code&gt;ScriptPackResolver&lt;/code&gt;. The &lt;code&gt;ScriptExecutor&lt;/code&gt; is initialized with the NuGet references and the script packs. &lt;code&gt;ExecuteScript()&lt;/code&gt; is called on the &lt;code&gt;ScriptExecutor&lt;/code&gt;. The result is verified and logged if relevant.&lt;/p&gt;
&lt;p&gt;This is solution that I released in version &lt;a href=&quot;https://github.com/scriptcs-contrib/scriptcs-rebus/releases/tag/0.4.0&quot;&gt;0&amp;#46;4.0&lt;/a&gt;. Despite missing a few essential scriptcs.hosting features, like importing namespaces and reference local dependencies, I decided to release it anyway.&lt;/p&gt;
&lt;p&gt;On of the key features of the upcoming 0.5.0 release is Mono support. I'd like to add the options to use the Mono compiler inside of the hosting pieces. During this work I ran into an issue with the way I wired up my dependencies. It was rather trivial to set an option for using the Mono compiler, and then replace it with the dependency to Roslyn. It worked so far that I could compile plain C#, just like the Roslyn compiler, but if I wanted to compile C# with some features that is not supported by Roslyn yet, like &lt;code&gt;dynamic&lt;/code&gt; or &lt;code&gt;async/await&lt;/code&gt;, the Mono compiler would throw me an error. At first I was convinced that this must be a scriptcs bug, and there called out for help in the scriptcs community. Once again, I got in contact with Glenn Block. So, one morning, we toke a one-to-one on Skype, were I showed Glenn my code and put him into my mindset of what I'd like to achieve. Glenn is a nice guy, so he said, this cool, but you're doing it wrong. So with Glenn looking me over my shoulder, I re-implemented the &lt;code&gt;Execute()&lt;/code&gt; of my &lt;code&gt;ScriptExecutor&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Actual Approach&lt;/h2&gt;
&lt;p&gt;Glenn told me that all my wiring using AutoFac wasn't necessary, there is already a built-in helper class for that. It's called &lt;code&gt;ScriptServicesBuilder&lt;/code&gt;. What ScriptServicesBuilder does is wire up the dependencies for you. It then serves you a &lt;code&gt;ScriptServices&lt;/code&gt; instance, which makes it trivial to override the dependencies.&lt;/p&gt;
&lt;p&gt;I therefore added a small method to my &lt;code&gt;ScriptExecutor&lt;/code&gt; class, which I borrowed some pieces from &lt;strong&gt;here&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;private ScriptServices CreateScriptServices(bool useMono, bool useLogging)
{
    var console = new ScriptConsole();
    var configurator = new LoggerConfigurator(useLogging ? LogLevel.Debug : LogLevel.Info);
    configurator.Configure(console);
    var logger = configurator.GetLogger();
    var builder = new ScriptServicesBuilder(console, logger);

    if (useMono)
    {
        builder.ScriptEngine&amp;lt;MonoScriptEngine&amp;gt;();
    }
    else
    {
        builder.ScriptEngine&amp;lt;RoslynScriptEngine&amp;gt;();
    }

    builder.FileSystem&amp;lt;ScriptFileSystem&amp;gt;();
    return builder.Build();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I do some configuration of the console and the logger. The log level is set depending on whether the user would like some debugging output. Whether the user would like to use the Mono compiler, I override the &lt;code&gt;ScriptEngine&lt;/code&gt;. Finally, I override the logical file system, which scriptcs uses as its environment. I override it with this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/// &amp;lt;summary&amp;gt;
/// By default, the scriptcs.hosting inspects the bin folder for references.
/// &amp;lt;/summary&amp;gt;
public class ScriptFileSystem : FileSystem
{
    public override string BinFolder
    {
        get { return AppDomain.CurrentDomain.BaseDirectory; }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All this customization does is that it tells scriptcs that my dependencies are located in the same folder as the script is executed. Otherwise, I'd have to copy all my dependencies over to a &lt;code&gt;\bin&lt;/code&gt; folder.&lt;/p&gt;
&lt;p&gt;So after some iterations my &lt;code&gt;Execute()&lt;/code&gt; method, ended up like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public void Execute(Script script)
{
    // set current dicrectory, import for NuGet.
    Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;

    var services = CreateScriptServices(script.UseMono, script.UseLogging);
    var scriptExecutor = services.Executor;
    var scriptPackResolver = services.ScriptPackResolver;
    services.InstallationProvider.Initialize();

    // prepare NuGet dependencies, download them if required
    var assemblyPaths = PreparePackages(services.PackageAssemblyResolver,
        services.PackageInstaller, PrepareAdditionalPackages(script.NuGetDependencies), script.LocalDependencies, services.Logger);

    scriptExecutor.Initialize(assemblyPaths, scriptPackResolver.GetPacks());
    scriptExecutor.ImportNamespaces(script.Namespaces);
    scriptExecutor.AddReferences(script.LocalDependencies);

    var scriptResult = scriptExecutor.ExecuteScript(script.ScriptContent, string.Empty);

    if (script.UseLogging &amp;amp;&amp;amp; scriptResult != null)
        if (scriptResult.CompileExceptionInfo != null)
            if (scriptResult.CompileExceptionInfo.SourceException != null)
                services.Logger.Debug(scriptResult.CompileExceptionInfo.SourceException.Message);
    scriptExecutor.Terminate();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I get the scriptcs dependencies wired up and served with &lt;code&gt;CreateScriptServices()&lt;/code&gt;. I pull out the &lt;code&gt;ScriptExecutor&lt;/code&gt; and the &lt;code&gt;ScriptPackResolver&lt;/code&gt;. One, important step, is to initialize the &lt;code&gt;InstallationProvider&lt;/code&gt;. In my case, the &lt;code&gt;InstallationProvider&lt;/code&gt; is a &lt;code&gt;NuGetInstallationProvider&lt;/code&gt;. If you forget to initialize you are given a &lt;code&gt;ArgumentNullException&lt;/code&gt; if you try to download a NuGet package with the &lt;code&gt;PackageInstaller&lt;/code&gt;. I still have my &lt;code&gt;PreparePackages()&lt;/code&gt; which looks like &lt;strong&gt;this&lt;/strong&gt;. The functionality is the same, I just added some more logging and error handling.&lt;/p&gt;
&lt;p&gt;I then initialize the &lt;code&gt;ScriptExecutor&lt;/code&gt; with the path to the assemblies, and the resolved script packs. I import additional namespaces and adds a reference to some local assemblies if necessary.&lt;/p&gt;
&lt;p&gt;Finally, I call &lt;code&gt;ExecuteScript()&lt;/code&gt; on the &lt;code&gt;ScriptExecutor&lt;/code&gt;. If we're using logging, the result, errors or exceptions are sent to the console.&lt;/p&gt;
&lt;p&gt;My &lt;code&gt;Execute()&lt;/code&gt; method now holds a lot more code, than in my initial attempt, but on the other hand I can save a bunch of code and complexity with this solution.&lt;/p&gt;
&lt;p&gt;This, final solution, is how it is implemented in the upcoming scriptcs.rebus 0.5.0.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>scriptcs in Sublime Text and Atom</title>
   <link href="http://madstt.dk/scriptcs-in-sublime-text-and-atom/"/>
   <updated>2014-10-20T02:38:37+00:00</updated>
   <id>http://madstt.dk/scriptcs-in-sublime-text-and-atom</id>
   <content type="html">&lt;p&gt;I really love the REPL in &lt;a href=&quot;http://scriptcs.net&quot;&gt;scriptcs&lt;/a&gt;, and feel comfortable using it. But sometimes, when writing larger scripts its just not a suitable tool. Then it is good that there are other, still lightweight, options out there.&lt;/p&gt;
&lt;p&gt;In this post I'll show you how to setup &lt;a href=&quot;https://sublimetext.com/&quot;&gt;Sublime Text&lt;/a&gt; and &lt;a href=&quot;https://atom.io/&quot;&gt;Atom&lt;/a&gt; to use scriptcs for script execution.&lt;/p&gt;
&lt;h2&gt;Sublime Text&lt;/h2&gt;
&lt;p&gt;Sublime Text has been my favorite text editor for a while, and I use every occasion I get to give it a shout, and hopefully I can convince more people to use it.&lt;/p&gt;
&lt;p&gt;To setup using scriptcs in Sublime Text, you need to install the scriptcs plugin. This is done using the great Sublime Package Manager. The Sublime Package Manager is in it self an addon. So open the Sublime Text console, using &lt;code&gt;Ctrl+´&lt;/code&gt;, and run &lt;a href=&quot;https://sublime.wbond.net/installation&quot;&gt;this Powershell script&lt;/a&gt;. When you have installed the Sublime Package Manager, open it by using the &lt;code&gt;Ctrl+Shift+P&lt;/code&gt;, type &lt;code&gt;install&lt;/code&gt; and choose &lt;code&gt;Package Control: Install Package&lt;/code&gt;. Now the repositories will be refreshed. Once ready, a dialog will list all available packages. Then type &lt;code&gt;scriptcs&lt;/code&gt;, and press &lt;code&gt;enter&lt;/code&gt;. The scriptcs package will now be installed.&lt;/p&gt;
&lt;p&gt;When installed, all &lt;code&gt;.csx&lt;/code&gt;-files will now have text highlighting and you can execute your scripts by pressing &lt;code&gt;Ctrl+B&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;SublimeREPL&lt;/h3&gt;
&lt;p&gt;I neat feature that Sublime Text has and which, not to my knowledge, Atom does not have is &lt;a href=&quot;https://github.com/wuub/SublimeREPL&quot;&gt;SublimeRepl&lt;/a&gt; or rather an alternative. SublimeREPL is a Sublime Text package which adds a REPL inside Sublime. This REPL is highly configurable, and can run an interpreter inside Sublime, including scriptcs. Again, open the Sublime Package Manager, using &lt;code&gt;Ctrl+Shift+P&lt;/code&gt;, type &lt;code&gt;install&lt;/code&gt; and chose &lt;code&gt;Package Control: Install Package&lt;/code&gt;. Find &lt;code&gt;SublimeREPL&lt;/code&gt; in the list and install it.&lt;/p&gt;
&lt;p&gt;When installation is done, you can find the scriptcs REPL in &lt;code&gt;Tools -&amp;gt; SublimeREPL -&amp;gt; ScriptCS&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Atom&lt;/h2&gt;
&lt;p&gt;The new kid on the block. It is a bit more cumbersome to get scriptcs set up in Atom. Firstly, you need to install the Atom Runner. You would either go through the Atom Package Manager GUI, which is found in the Settings tab (&lt;code&gt;Ctrl-,&lt;/code&gt;) or take it from the command line like this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apm install atom-runner
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To get C# highlighting in your scripts you'd also have to add an additional package&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apm install language-csharp
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we need to associate Atom with the &lt;code&gt;.csx&lt;/code&gt; file extension. Open you local config file&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Ctrl+Shift+P
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This open the config file. Add the following to the config file&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;'runner':  
    'extensions':
        'csx': 'scriptcs'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Save the file using &lt;code&gt;Ctrl+S&lt;/code&gt;. Now you can write your scripts, save them with the &lt;code&gt;.csx&lt;/code&gt; file extension and run them using the Atom Runner&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Ctrl+Shift+P
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Press 'R' and select &lt;code&gt;Runner: Run&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I hope this can help someone getting started using scriptcs. Throw a comment, or give me a shout on &lt;a href=&quot;https://twitter.com/madstt&quot;&gt;Twitter&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ScriptCs.Rebus Moving to scriptcs-contrib</title>
   <link href="http://madstt.dk/scriptcs-rebus-moving-to-scriptcs-contrib/"/>
   <updated>2014-10-15T10:04:30+00:00</updated>
   <id>http://madstt.dk/scriptcs-rebus-moving-to-scriptcs-contrib</id>
   <content type="html">&lt;p&gt;I've worked on ScriptCs.Rebus since the spring, and had a lot of fun. I have not received any feedback from users actually using it, so I'm basically coding in the dark. It's completely true, I've managed to sneak it in in some integration testing scenarios. During development of 0.4.0, I got in contact with Glenn Block, who guided me with the implementation of the hosting pieces. He also encourage me to move my GitHub repository to the &lt;a href=&quot;https://github.com/scriptcs-contrib&quot;&gt;scriptcs-contrib&lt;/a&gt; organization. If found this appealing, although it would mean that I would have to move it away from my own user. Guess it feels a bit like one of your kids moving away from home. It would certainly give the repository more attention, and potentially more users adn feedback. I would still have administrator rights and in full control, so why not.&lt;/p&gt;
&lt;p&gt;I did some considering and after releasing 0.4.0, I decided to move it over. So its new home is &lt;a href=&quot;https://github.com/scriptcs-contrib/scriptcs-rebus&quot;&gt;here&lt;/a&gt;. I've renamed the project to align with the other projects in scriptcs-contrib.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ScriptCs.Rebus 0.4.0</title>
   <link href="http://madstt.dk/scriptcs-rebus-0-4-0/"/>
   <updated>2014-10-13T02:59:09+00:00</updated>
   <id>http://madstt.dk/scriptcs-rebus-0-4-0</id>
   <content type="html">&lt;p&gt;The last month or so I've been busy on putting the pieces together for the latest release of ScriptCs.Rebus. I'm very proud of what I managed to put into this release.&lt;/p&gt;
&lt;p&gt;This is the fourth release of my little scripting tool, and this post will focus on what's new in version 0.4.0, so if your new to ScriptCs.Rebus, I urge you to read my other &lt;a href=&quot;http://madstt.dk/category/scriptcs/scriptcs-rebus/&quot;&gt;posts&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;What's New&lt;/h2&gt;
&lt;p&gt;Some minor bug fixes, the major features of this release is support for Azure Service Bus and scripted host execution.&lt;/p&gt;
&lt;p&gt;One other major change in this release is that I've split ScriptCs.Rebus into separate dependencies. This will be a breaking change for existing users, and you have my apologies for that. When adding Azure Service Bus, it occurred to me that it didn't make sense to distribute ScriptCs.Rebus with dependencies for all transport options, when you're only using a single one. So therefore from version 0.4.0 ScriptCs.Rebus spans the following NuGet packages:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;- ScriptCs.Rebus
- ScriptCs.Rebus.RabbitMQ
- ScriptCs.Rebus.AzureServiceBus
- ScriptCs.Rebus.Hosting
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Support for Azure Service Bus&lt;/h3&gt;
&lt;p&gt;To get started using Azure Service Bus, you need to install the script pack:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;scriptcs -install ScriptCs.Rebus.AzureServiceBus
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And you would also need to create a service bus on Azure.&lt;/p&gt;
&lt;p&gt;As the addition of RabbitMQ in version 0.3.0, I've continued the original design for configuration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureAzureBus(&quot;MyMessageQueue&quot;, &quot;Endpoint=sb://someConnectionString&quot;)
    .Send&amp;lt;string&amp;gt;(&quot;Hello from Azure Service Bus&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A message containing a string is now sent to the Azure service bus specified in the connection string, and added to the queue given in the first parameter. The connectionstring must be the connectionstring of the service bus, and not the actual queue. Receiving a message follows the design of the MSMQ and RabbitMQ:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureAzureBus(&quot;MyMessageQueue&quot;, &quot;Endpoint=sb://someConnectionString&quot;)
    .Receive&amp;lt;string&amp;gt;(x =&amp;gt; Console.WriteLine(x))
    .Start()
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Hosting&lt;/h3&gt;
&lt;p&gt;Now this a feature I'm really proud of. Hosting is a vital, yet powerful feature in &lt;code&gt;ScriptCs&lt;/code&gt;. The idea is that you can host &lt;code&gt;ScriptCs&lt;/code&gt; inside any standard .Net application and that way execute code inside the host. This gave me the idea to create a &lt;code&gt;ScriptCs.Rebus&lt;/code&gt; hosting feature for executing scripts received over any of the support buses. I have been playing around with &lt;code&gt;ScriptCs.Hosting&lt;/code&gt; before, but was pretty unsure were to start. I therefore got in contact with Glenn Block, with whom I had some discussions over the idea. The result is &lt;code&gt;ScriptCs.Rebus.Hosting&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;First of you need to reference the NuGet package from your application. Go to the package manager console:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; install-package ScriptCs.Rebus.Hosting
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will provide with a number of dependencies, but in essence it is the complete ScriptCs that you now have a reference to and can use to execute C# code. The pieces that ScriptCs.Rebus.Hosting delivers is a message handler capable of executing a script. It can even download and reference extra NuGet packages required by your script. I now this sounds strange and complex, but I believe I've developed a rather simple and powerful implementation.&lt;/p&gt;
&lt;p&gt;There are two options to go for when you wanna execute scripts, received over any supported bus technology using Rebus, in your application.&lt;/p&gt;
&lt;h4&gt;Existing Rebus Infrastructure&lt;/h4&gt;
&lt;p&gt;If your application is already using one of the supported bus technologies with Rebus, just hook in the supplied message handler. How this is done, depends on how you have configured Rebus. But the &lt;code&gt;ScriptHandler&lt;/code&gt; class implements the standard &lt;code&gt;IHandleMessages&amp;lt;T&amp;gt;&lt;/code&gt; interface in Rebus. So all you need to do is register the message handler to the DI container you have configured for Rebus in your application.&lt;/p&gt;
&lt;h4&gt;No Rebus Infrastructure&lt;/h4&gt;
&lt;p&gt;If your application does not use any bus infrastructure and you would like to extend its functionality using scripts, you can get going using the following simple configuration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var bus = new MsmqBus(&quot;MyMessageQueue&quot;);
bus.Container.Register(() =&amp;gt; new ScriptHandler());
bus.Start();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That's it! Your application is now ready to receive scripts send over MSMQ. It is advisable to configure the bus in a bootstrapper or application entry point. The &lt;code&gt;Start()&lt;/code&gt; can be deferred to other parts of the application.&lt;/p&gt;
&lt;p&gt;Should you wanna go for RabbitMQ or Azure Service Bus, just change the first line. See the &lt;a href=&quot;https://github.com/madstt/ScriptCs.Rebus&quot;&gt;README&lt;/a&gt;. When using RabbitMQ or Azure Service Bus, you would need to reference either the &lt;code&gt;ScriptCs.Rebus.RabbitMQ&lt;/code&gt; or &lt;code&gt;ScriptCs.Rebus.AzureServiceBus&lt;/code&gt; script packs as well.&lt;/p&gt;
&lt;h4&gt;Sending A Script&lt;/h4&gt;
&lt;p&gt;Now that you have a script-aware application, lets start sending some scripts. You can send scripts from the source of your choice. You can go simple and send it from the &lt;code&gt;ScriptCs&lt;/code&gt; REPL:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;MyMessageQueue&quot;)
    .SendAScript(&quot;Console.WriteLine(\&quot;Hello from the REPL!\&quot;)&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This would send this simple script to the host, which would then execute this. If the bus is not started in the hosting application, the script will wait in the queue, and be executed when the bus is started. Standard messaging stuff. You can also send a script from another application:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var bus = new MsmqBus(&quot;MyMessageQueue&quot;)
bus.SendAScript(&quot;Console.WriteLine(\&quot;Hello from other application!\&quot;)&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sometimes you just don't wanna write your scripts in the REPL or inline in the sending application. You can therefore create a script file, in your favorite editor, and send it for execution in the host. From the REPL this would look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;MyMessageQueue&quot;)
    .SendAScriptFile(&quot;someScriptFile.csx&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The script file will now be send over the bus and executed in the hosting application. You can do the same from another application.&lt;/p&gt;
&lt;h4&gt;Additional NuGet Packages&lt;/h4&gt;
&lt;p&gt;If executing C# scripts inside a host application cannot make your day, how about downloading and referencing additional NuGet packages inside your host application, and executing a script using them.&lt;/p&gt;
&lt;p&gt;If your script is going to require additional NuGet packages, which is not already referenced by the host, you can supply them when sending the script:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.SendAScriptFile(&quot;someScriptFile.csx&quot;, &quot;LiteGuard&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the &lt;code&gt;LiteGuard&lt;/code&gt; Nuget package is not already downloaded and referenced in the hosting application, &lt;code&gt;ScriptCs.Rebus.Hosting&lt;/code&gt; will download and reference it, so you can use it your script. Using &lt;code&gt;LiteGuard&lt;/code&gt; is just an example.&lt;/p&gt;
&lt;p&gt;Please feel free to either give me a shout on &lt;a href=&quot;https://twitter.com/madstt&quot;&gt;Twitter&lt;/a&gt; or on &lt;a href=&quot;https://github.com/madstt/ScriptCs.Rebus&quot;&gt;GitHub&lt;/a&gt; with feedback.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Upcoming Software Architecture Open Space 2014</title>
   <link href="http://madstt.dk/upcoming-software-architecture-open-space-2014/"/>
   <updated>2014-09-29T04:42:36+00:00</updated>
   <id>http://madstt.dk/upcoming-software-architecture-open-space-2014</id>
   <content type="html">&lt;p&gt;This week I have the pleasure of attending the Software Architecture Open Space (SAOS14) conference. I attended this conference in 2012, when it was still located in Århus. At that time it was a two day open space session intensive conference, which was free to attend. And I &lt;a href=&quot;http://madstt.dk/aaosconf-2012-the-retrospective/&quot;&gt;loved it&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Last year the conference shifted gear and turned into a payed event in Copenhagen. The remained the same, open space intensive sessions. Although now in more professional settings. In 2012 there were a number of attendees who didn't show up. This must have been related to that being a free event. So this year I expect everyone registered to show up.&lt;/p&gt;
&lt;p&gt;This year I've been so fortunate to be able to participate in this great event. In 2012 this conference format exceeded my expectations, so I'm looking forward to some great discussions with other professionals sharing their experiences.&lt;/p&gt;
&lt;p&gt;At the time of writing we're 53 registered for this event. I think this is way too low. I can recon a number of attendees who also participated in 2012, I'll argue that if you've once done this open space format, you'll return over and over again. You won't find any conference formats where you'll get so much take-away. If you're willing to. One of the very key characteristics of the attendees should be their willingness to share their experiences and, not least, be willing to listen to other attendees sharing their experiences.&lt;/p&gt;
&lt;p&gt;This year there will be some more formal conference elements, such as a keynote. I'm exited about this, and looking forward to see if such an initiative should affect the open space discussions.&lt;/p&gt;
&lt;p&gt;There are still some slots available, so if you have the time, and is in Copenhagen, you shouldn't miss this awesome event.&lt;/p&gt;
&lt;p&gt;Register yourself &lt;a href=&quot;https://billetto.dk/software-architecture-open-space-2014&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ScriptCs.Rebus 0.3.0</title>
   <link href="http://madstt.dk/scriptcs-rebus-0-3-0/"/>
   <updated>2014-06-13T02:27:00+00:00</updated>
   <id>http://madstt.dk/scriptcs-rebus-0-3-0</id>
   <content type="html">&lt;p&gt;Currently,&amp;#160; &lt;a href=&quot;https://github.com/madstt/ScriptCs.Rebus&quot;&gt;ScriptCS.Rebus&lt;/a&gt; uses MSMQ as transport mechanism. In the latest release of ScriptCs.Rebus, I’ve included support for &lt;a href=&quot;http://www.rabbitmq.com/&quot;&gt;RabbitMQ&lt;/a&gt; and console logging. &lt;/p&gt;
&lt;p&gt;RabbitMQ is a widely used and rock-solid messaging framework. In my original &lt;a href=&quot;http://madstt.dk/introducing-scriptcs-rebus/&quot;&gt;post&lt;/a&gt;, I outlined how to get started using ScriptCs and ScriptCs.Rebus in particular, I’ll therefore urge the reader to read that post prior to this one. &lt;/p&gt;
&lt;h2&gt;&lt;/h2&gt;
&lt;h2&gt;What’s New&lt;/h2&gt;
&lt;p&gt;Besides major refactorings and code clean-up, the two main features of 0.3.0 is support for RabbitMQ and console logging.&lt;/p&gt;
&lt;h3&gt;Support for RabbitMQ&lt;/h3&gt;
&lt;p&gt;I’ve been very trying to be very consistent with the original design, and therefore configuring ScriptCs.Rebus for RabbitMQ is very straightforward:&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureRabbitBus(&amp;quot;MyMessageQueue&amp;quot;)
	.Send&amp;lt;string&amp;gt;(&amp;quot;Foo&amp;quot;)&lt;font face=&quot;Calibri&quot;&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;This will configure the bus to use the default RabbitMQ port, amqp://localhost:5672, which requires a local server. This configuration is equivalent to using ScriptCs.Rebus with MSMQ, with additional RabbitMQ features. Usually, a remote server is used, and to supply a connectionstring, use the following configuration:&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureRabbitBus(&amp;quot;MyMessageQueue&amp;quot;, &amp;quot;amqp://remoteserver&amp;quot;)
	.Send&amp;lt;string&amp;gt;(&amp;quot;Foo&amp;quot;)&lt;font face=&quot;Calibri&quot;&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;With this configuration the message of type String will be sent to the remote server. Likewise when you to need receive messages from the remote server, configuration follow the same setup as of the one from MSMQ:&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureRabbitBus(&amp;quot;MyMessageQueue&amp;quot;, &amp;quot;ampq://remoteserver&amp;quot;)
	.Receive&amp;lt;string&amp;gt;(x =&amp;gt; Console.WriteLine(x))
	.Start()&lt;/pre&gt;
&lt;p&gt;
&lt;h3&gt;Console Logging&lt;/h3&gt;
&lt;p&gt;Working with message busses can often be very complex and a blackbox. Since &lt;a href=&quot;https://github.com/rebus-org/Rebus&quot;&gt;Rebus&lt;/a&gt; has a nice and very useful console logging, it makes so much sense to support this as an option for script authors. Console logging is available for both MSMQ and RabbitMQ busses. By default console logging is disabled. To enable console logging, just add UseLogging() to your configuration:&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
	.ConfigureBus(&amp;quot;MyMessageQueue&amp;quot;)
	.UseLogging()
	.Send&amp;lt;string&amp;gt;(&amp;quot;Foo&amp;quot;)&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;Now console logging is enabled and will output some nice logging like this:&lt;/p&gt;
&lt;div style=&quot;-ms-overflow-x: auto;&quot;&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Rebus.Configuration.RebusConfigurer DEBUG (): Defaulting to 'throwing endpoint mapper' - i.e. the bus will throw an exception when you send a message that is not explicitly routed
Rebus.Configuration.RebusConfigurer DEBUG (): Defaulting to in-memory saga persister (should probably not be used for real)
Rebus.Configuration.RebusConfigurer DEBUG (): Defaulting to in-memory subscription storage (should probably not be used for real)
Rebus.Bus.RebusBus INFO (): Rebus bus 1 created
Rebus.Bus.RebusBus INFO (): Using external timeout manager with input queue 'rebus.timeout'
Rebus.Bus.RebusBus INFO (): Initializing bus with 1 workers
Rebus.Bus.Worker INFO (): Worker Rebus 1 worker 1 created and inner thread started
Rebus.Bus.Worker INFO (): Starting worker thread Rebus 1 worker 1
Rebus.Bus.RebusBus INFO (): Bus started
Sending message of type String...
Rebus.Logging.MessageLogger DEBUG (): Sending Foo to MyMessageQueue
... message sent.&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;That’s it for 0.3.0, get it, use it, and let me know what you think of it.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Introducing ScriptCs.Rebus</title>
   <link href="http://madstt.dk/introducing-scriptcs-rebus/"/>
   <updated>2014-05-26T11:45:50+00:00</updated>
   <id>http://madstt.dk/introducing-scriptcs-rebus</id>
   <content type="html">&lt;p&gt;In a recent &lt;a href=&quot;http://http://madstt.dk/the-scriptcs-101/&quot;&gt;blog post&lt;/a&gt; I introduced the reader to the world of scripting with C# using &lt;a href=&quot;http://scriptcs.net&quot;&gt;ScriptCs&lt;/a&gt;.  I really love the idea of encapsulating boiler-plate code into a script pack, and be able to consume larger frameworks from simple scripts. One of my favorite frameworks is &lt;a href=&quot;https://github.com/rebus-org/Rebus&quot;&gt;Rebus&lt;/a&gt;. Rebus is this lean and very simple service bus. It is founded and coordinated by my good friend &lt;a href=&quot;https://twitter.com/mookid8000&quot;&gt;Mogens Heller Grabe&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Why?&lt;/h2&gt;
&lt;p&gt;Well, why not? Rebus is a simple, yet powerful framework for messaging, it is obvious for me to make Rebus &lt;em&gt;the&lt;/em&gt; messaging engine for ScriptCs. On the current work project we use Rebus extensively, and to provide some sample messages and for testing purposes, we’ve so far used small console applications. It is my intend to switch over and use ScriptCs.Rebus from now on. With scripting possibilities for messaging I can imagine larger test scenarios, and stress-testing.&lt;/p&gt;
&lt;h2&gt;Basic Usage from REPL&lt;/h2&gt;
&lt;p&gt;I’d refer to the readme on &lt;a href=&quot;https://github.com/madstt/ScriptCs.Rebus&quot;&gt;GitHub&lt;/a&gt; for installation guidelines.&lt;/p&gt;
&lt;p&gt;To enter the REPL, run &lt;code&gt;scriptcs&lt;/code&gt;. Send a message of type string to MyMessageQueue:&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 0; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;MyMessageQueue&quot;)
    .Send&amp;lt;string&amp;gt;(&quot;My first scripted message!&quot;)&lt;/pre&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 0; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;&amp;#160; &lt;/pre&gt;
&lt;p&gt;Now open another command prompt or use the same, and enter the following to receive the message of type string from MyMessageQueue:&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 0; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;MyMessageQueue&quot;)
    .Receive&amp;lt;string&amp;gt;(x =&amp;gt; Console.WriteLine(x))
    .Start()&lt;/pre&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 0; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;The command prompt should output the following:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;From MyMessageQueue &amp;gt; My first scripted message!&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;Basic Usage from Script&lt;/h2&gt;
&lt;p&gt;The examples from above apply to scripts. Put the send and receive code into two &lt;code&gt;.csx&lt;/code&gt; files, lets call them &lt;code&gt;send.csx&lt;/code&gt; and &lt;code&gt;receive.csx&lt;/code&gt;, and execute them by typing the following from a command prompt:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;scriptcs send.csx&lt;/code&gt; and&lt;/p&gt;
&lt;p&gt;&lt;code&gt;scriptcs receive.csx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In the &lt;a href=&quot;https://github.com/madstt/ScriptCs.Rebus/tree/master/samples&quot;&gt;&lt;code&gt;\samples&lt;/code&gt;&lt;/a&gt; folder there is some samples to get you started.&lt;/p&gt;
&lt;h2&gt;Advanced Usage&lt;/h2&gt;
&lt;p&gt;At this point you should be able to apply these more advanced usages to both the REPL and from scripts.&lt;/p&gt;
&lt;h3&gt;&lt;a href=&quot;https://github.com/madstt/ScriptCs.Rebus#custom-types&quot; name=&quot;user-content-custom-types&quot;&gt;&lt;/a&gt;Custom Types&lt;/h3&gt;
&lt;p&gt;It is possible to use custom types in your messages. Consider the following class:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;public class Message { public string Content { get; set; } }&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You enter this class definition in the REPL or create a &lt;code&gt;message.csx&lt;/code&gt; script file. If defined in a script file, load this class definition into your script by using &lt;code&gt;#load&lt;/code&gt; keyword,&lt;/p&gt;
&lt;p&gt;&lt;code&gt;#load &quot;message.csx&quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now you can send and receive messages of this type by using the following syntax:&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 0; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;MyMessageQueue&quot;)
    .Send&amp;lt;Message&amp;gt;(new Message {Content = &quot;Hello from custom type!&quot;})&lt;/pre&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 0; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;MyMessageQueue&quot;)
    .Receive&amp;lt;Messge&amp;gt;(x =&amp;gt; Console.WriteLine(x.Content))
    .Start()&lt;/pre&gt;
&lt;p&gt;``&lt;/p&gt;
&lt;p&gt;This should output &lt;code&gt;From MyMessageQueue &amp;gt; Hello from custom type&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;&lt;a href=&quot;https://github.com/madstt/ScriptCs.Rebus#multiple-handlers&quot; name=&quot;user-content-multiple-handlers&quot;&gt;&lt;/a&gt;Multiple Handlers&lt;/h3&gt;
&lt;p&gt;In some cases you might be expecting to handle different kinds of messages. This can be achieved by adding multiple receive commands fluently:&lt;/p&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;Require&amp;lt;RebusScriptBus&amp;gt;()
    .ConfigureBus(&quot;MyMessageQueue&quot;)
    .Receive&amp;lt;string&amp;gt;(x =&amp;gt; Console.WriteLine(x))
    .Receive&amp;lt;Message&amp;gt;(x =&amp;gt; Console.WriteLine(x.Content))
    .Start() &lt;/pre&gt;
&lt;pre class=&quot;brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;&quot;&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Applying multiple handlers of the same type, will give the possibility to handle message of the same type in different ways.&lt;/p&gt;
&lt;h2&gt;Future Directions&lt;/h2&gt;
&lt;p&gt;This is only the first revision of ScriptCs.Rebus, I’ll continue to explore new possibilities with building messaging infrastructure using scripts. I’ve got &lt;a href=&quot;http://www.rabbitmq.com/&quot;&gt;RabbitMQ&lt;/a&gt; and &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ee732537.aspx&quot;&gt;Azure Service Bus&lt;/a&gt; aligned in the pipeline.&lt;/p&gt;
&lt;p&gt;Get out there and try it out, throw me a comment or a pull request on &lt;a href=&quot;https://github.com/madstt/ScriptCs.Rebus&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Danish Developer Conference 2014 - Aftermath</title>
   <link href="http://madstt.dk/danish-developer-conference-2014-aftermath/"/>
   <updated>2014-05-01T03:13:00+00:00</updated>
   <id>http://madstt.dk/danish-developer-conference-2014-aftermath</id>
   <content type="html">&lt;p&gt;Yesterday I had the pleasure of attending the annual Danish Developer Conference. And it was actually a pleasure, I’m no just being polite here.&lt;/p&gt;
&lt;p&gt;When you attend a conference like this, you put down an &lt;a href=&quot;http://madstt.dk/danish-developer-conference-2014/&quot;&gt;agenda of expected sessions&lt;/a&gt;. You set certain expectations to these sessions. Some times these sessions fulfill, even exceeds, your expectations and other times they barely hit an acceptable level. Generally&amp;#160; I think that Microsoft should be more ambitious and make it an international conference, where well-known international speakers could suggest sessions and make it last a couple of days. The Microsoft event organizers know how to put together a well-organized conference, the drinks and food was great. The venue this year was in Aarhus, the past two years have been in Horsens. I think the venue in Aarhus is way better than in Horsens. I do also think that Microsoft had hired a company to help-out with the wiring and microphones, it work well and had a professional touch. Although the screen went out during the keynote. So, all in all an overall nice conference, although I would recommend opening for abstracts and make it international.&lt;/p&gt;
&lt;p&gt;It was a very inspirational keynote by Preben Mejer. He gave praise(!) to Microsoft for choosing a new CEO with the right attitude, and backed by Bill Gates. He told about the great potential on which Microsoft sits, and continued his keynote into an outlining of future trends in computing. This keynote made my expectations to a speaker like Preben Mejer. &lt;/p&gt;
&lt;p&gt;The session speakers was a mix of Microsoft interns, and external developers and consultants. My first session was with &lt;a href=&quot;https://twitter.com/thomento&quot;&gt;Thomas Jespersen&lt;/a&gt; about &lt;a href=&quot;www.spiir.dk&quot;&gt;Spiir&lt;/a&gt;'s experiences with the Azure cloud platform. There were several take-aways from this session, that could be useful in future projects deployed on Azure. Later I saw Christian Holm Nielsen, make a session about how AngularJS and ASP.NET can fit nicely together. Unfortunately it was a very PowerPoint heavy presentation, I could have wished for some more demos using AngularJS together with Web API. It seemed like Christian, was trying to cover far more topics, than time allowed, so each topic was briefly touched. When this is said, I got some nice hints and leads on AngularJS.&lt;/p&gt;
&lt;p&gt;During lunch, &lt;a href=&quot;telerik.com&quot;&gt;Telerik&lt;/a&gt; gave a short presentation of their &lt;a href=&quot;http://www.telerik.com/platform&quot;&gt;Telerik Platform&lt;/a&gt;, and specifically &lt;a href=&quot;http://www.telerik.com/appbuilder&quot;&gt;AppBuilder&lt;/a&gt;. AppBuilder is using KendoUI Mobile for developing cross-platform applications. This is not the native way as Xamarin does, but the HTML5 approach. I have some experience using KendoUI for web development, and AppBuilder really just wraps these into deployable apps for either Android or iOS. AppBuilder has a number of nice testing and emulator features. I had a short chat with &lt;a href=&quot;https://twitter.com/sebawita&quot;&gt;Sebastian Witalec&lt;/a&gt; from Telerik about KendoUI and AppBuilder. He gave me a 6 month license for AppBuilder, so I might end up using it. I didn't plan on going to any lunch sessions, but it sounded like a relevant topic, and it turned out to be really fruitful.&amp;#160; After lunch, I went to hear about the latest news from the Azure team. &lt;a href=&quot;https://twitter.com/henrikwh&quot;&gt;Henrik Westergaard Hansen&lt;/a&gt; gave a short and brief overview of the latest features. He showed of some great demos. For me the two biggest news was remote debugging of a website and live streaming of logging information from a production site.&lt;/p&gt;
&lt;p&gt;I had some high expectations to &lt;a href=&quot;https://twitter.com/christianhelle&quot;&gt;Christian Helle&lt;/a&gt;’s session cross-platform development using Xamarin. And Christian did not let me down. He gave a nice and clean session, where all the business and sales stuff was cut out. It was a&amp;#160; cool presentation, developer to developer, honest about pros and cons using Xamarin for cross-platform development. This session was the highlight of the day. He inspired me to once again start using Xamarin. In the last session of the day I had planned on seeing Mads Kristensen, doing a presentation on building Visual Studio extensions. After some consideration, I changed plans and went to see &lt;a href=&quot;https://twitter.com/ErikEJ&quot;&gt;Erik Ejlskov Jensen&lt;/a&gt;’s session on &lt;a href=&quot;https://entityframework.codeplex.com/&quot;&gt;Entity Framework&lt;/a&gt; 6.x (EF). I’ve used EF some years back, and I recently read a great blog post by &lt;a href=&quot;http://lostechies.com/jimmybogard/2014/04/22/migrating-from-nhibernate-to-entity-framework/&quot;&gt;Jimmy Bogard&lt;/a&gt;, on why considers EF6 a better option than NHibernate, so I thought I might get a brush-up on the latest EF news. It was a nice session, with almost too many slides, but Erik managed to lift the session with concise and simple demos. &lt;/p&gt;
&lt;p&gt;All in all, it was a pleasure to attend DDC this year, although I think they should be more ambitious.&lt;/p&gt;
&lt;p&gt;Did you attend DDC14? Throw me a comment and let me know what you think.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Danish Developer Conference 2014</title>
   <link href="http://madstt.dk/danish-developer-conference-2014/"/>
   <updated>2014-04-22T03:40:55+00:00</updated>
   <id>http://madstt.dk/danish-developer-conference-2014</id>
   <content type="html">&lt;p&gt;Once again Microsoft has arranged the yearly &lt;a href=&quot;http://www.danishdevconf.com/&quot;&gt;Danish Developer Conference&lt;/a&gt; (DDC). Previous years the venue has been Horsens, but this year they moved the conference to Aarhus. The past two years&amp;#160; they have also had a venue in Copenhagen, to attract the capitals developer force, but this year they seem to focus on the mainland developers(!). One of things that strike me about this conference is that it is a purely Danish conference, even the website is Danish only. I really don’t get this, it seems like Microsoft feels obligated to arrange this local conference, but does not do much more than absolutely necessary. I get the point of focusing on and promoting the Danish developer scene, but to me it seems limiting that this conference lacks international inspiration. On another note, it seems weird to me that there is not an official call for papers (CFP). All speakers are hand-picked by the Microsoft conference committee. I get the commercial stuff, but why not let the masses propose sessions? There are tons of hobby projects in the Danish community, promoting and facilitating Microsoft tools, that would provide DDC with some dedicated flavor. And that really deserves some public attention.&lt;/p&gt;
&lt;p&gt;Again this year, I’ll attend the conference, and again my employer is sponsoring the event. This post will focus on my expectations.&lt;/p&gt;
&lt;p&gt;At this years &lt;a href=&quot;http://www.buildwindows.com/&quot;&gt;Build&lt;/a&gt; conference, Microsoft as a company revealed a number of new initiatives. In his &lt;a href=&quot;http://www.danishdevconf.com/#Det-nye-Microsoft&quot;&gt;keynote&lt;/a&gt;, Preben Meijer will enlighten us with details of Microsoft's new strategy. The first session to attend is a tough call, either hear &lt;a href=&quot;https://twitter.com/mkristensen&quot;&gt;Mads Kristensen&lt;/a&gt; on modern web development with Visual Studio or hear &lt;a href=&quot;https://twitter.com/thomento&quot;&gt;Thomas Jespersen&lt;/a&gt;’s talk on &lt;a href=&quot;http://www.spiir.dk/&quot;&gt;Spiir&lt;/a&gt;’s Azure experiences. At the time of writing I tend to attend Thomas’ talk, since Mads’ is available on &lt;a href=&quot;http://channel9.msdn.com/Events/Build/2014/3-604&quot;&gt;Channel 9&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://eisenbergeffect.bluespire.com/angular-and-durandal-converge/&quot;&gt;Lately&lt;/a&gt; it was announced that my preferred SPA framework, &lt;a href=&quot;http://durandaljs.com/&quot;&gt;DurandalJS&lt;/a&gt;, is going to be merged with AngalurJS. So to me it seems that AngularJS is the de-facto standard for SPA frameworks, I’ll therefore attend my former colleague &lt;a href=&quot;https://twitter.com/dotnetnerd&quot;&gt;Christian Holm Nielsen&lt;/a&gt;’s talk on AngularJS and ASP.NET. After the lunch break I’ll attend &lt;a href=&quot;https://twitter.com/henrikwh&quot;&gt;Henrik Westergaard Hansen&lt;/a&gt;’s talk on new features in Azure. The Azure team has a very rapid development cycle, so there is always some new features to catch up with. Should be a great session. The following session slot is again a tough call, either the SignalR session or the cross-platform talk with Xamarin and Visual Studio. This is two great technologies, and I would prefer to attend them both. Currently, I tend to attend the Xamarin talk, since I really need a kick to get started with Xamarin. I have the intentions and did some spiking, but this session might get me in the right direction. I have done some SignalR development before, so I do not need an introduction, but it would be great to get some tips and tricks. I'll stick to the Xamarin session for now.&lt;/p&gt;
&lt;p&gt;The last session slot of this one-day conference is, in my opinion, the one with the least attractive sessions. I'll either attend the Entity Framework session or Mads Kristensen's session on developing Visual Studio extensions. I have no experience in extensibility, and so-far no intentions of writing any extensions to Visual Studio, but Mads might inspire me. I have previously been using Entity Framework, so it might be great to get brush-up on the latest. I guess I'll make a decision on the day.&lt;/p&gt;
&lt;p&gt;This is my DDC 14 schedule as of writing. My experience is that I might change my mind on the day.&lt;/p&gt;
&lt;p&gt;If you plan to attend DDC 14, don’t hesitate to say hi, much of attending a conference is to network.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The ScriptCs 101</title>
   <link href="http://madstt.dk/the-scriptcs-101/"/>
   <updated>2014-04-08T03:54:00+00:00</updated>
   <id>http://madstt.dk/the-scriptcs-101</id>
   <content type="html">&lt;p&gt;C# is an awesome language. In this post I’ll write about C# and scripting. To get you into the right context, I’ll kick-off with my personal language journey, just to set the scene, and then I’ll introduce ScriptCs.&lt;/p&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;I initially came on to C# back in 2005, when C# 2.0 was the latest. Many features that we take for granted in C# 5, was not included, such as generics, static classes, private setters, iterators, etc. I came from Java, so the syntax seemed straightforward. At the same time, we used some Ruby scripts for building assemblies to different hardware platforms. In 2008 I switched court and started doing some C++ on an embedded Linux platform. Some developers did their development in Vim, but the majority used the Eclipse IDE, including me. It seemed natural coming from Visual Studio. To build the assemblies we used a home-grown build system written in Python. Since 2010, I came back to C#, and it is still my language of choice, although I’m experimenting with JavaScript.&lt;/p&gt;
&lt;h2&gt;Heavy Development Experience&lt;/h2&gt;
&lt;p&gt;Over the years it has seemed to me that even the most simple development task feels so heavy with C#. And its not the language, it’s the complete development experience. It kind of feels sad. Even for the simplest console app, we have to open Visual Studio, create a project, select project type, etc. Click, click, click. We really just want to play around with some new feature, or we might have crafted some brilliant idea and want to make a small spike. We get tired before we ever had the chance to write a line of code. Many automation tasks are solved with a small console app. We could use another editor and utilize the CSC compiler, but you’ll soon find out that it is only for basic stuff, there is some difficulties referencing dlls and such. &lt;/p&gt;
&lt;p&gt;In other scripting languages such as Ruby, Python or NodeJS, there is more lightweight options available. You can pick you favorite editor, and you’re productive. Of course, these are interpreted language, you would argue. But taste that development experience. Many of the development environments have a &lt;a href=&quot;http://https://en.wikipedia.org/wiki/Read-eval-print_loop&quot;&gt;REPL&lt;/a&gt; (read-evaluate-print-loop). A REPL is a small, interactive programming environment. Just run a console and issue commands. The NodeJS development experience there is no IDE required, no project, a minimum install and everything else is packages. In NodeJS there is &lt;a href=&quot;https://www.npmjs.org/&quot;&gt;NPM&lt;/a&gt;. The Node Package Modules provides all the modules for easing the development experience.&lt;/p&gt;
&lt;h2&gt;So how about C#?&lt;/h2&gt;
&lt;p&gt;There is an excellent package manager for.Net and&amp;#160; C#, its called &lt;a href=&quot;https://en.wikipedia.org/wiki/NuGet&quot;&gt;Nuget&lt;/a&gt;. It kind of works the same way as in NodeJS, since it does not need to be installed in a global directory, but to specific projects. So Nuget gets us part of way, how about authoring C#? I’d like to be able to use my favorite text editor. On the .Net platform we have &lt;a href=&quot;http://msdn.microsoft.com/en-us/vstudio/roslyn.aspx&quot;&gt;Roslyn&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Roslyn&lt;/h3&gt;
&lt;p&gt;This is not a post on Roslyn, so if you can skip this section, if you know what I’m talking about. Roslyn is a compiler-as-a-service. It was recently released under less-restrictive &lt;a href=&quot;https://roslyn.codeplex.com/license&quot;&gt;Apache License&lt;/a&gt;. So it is possible to use Roslyn in any project you find it useful. It is shipped as a library on Nuget, and there is no requirement to use Visual Studio. Any application can use Roslyn to compile C#. You can add reference using the r# keyword. There is no notion of namespaces, so its kind of a loose script. Everything is compiled into a wrapper class. Also, Roslyn does not support multiple files, everything goes into a single file. Roslyn has no notion of packages, so we’re missing a link between Nuget and Roslyn. This is where ScriptCs comes in, it brings the last mile of what Roslyn brings to the table&lt;/p&gt;
&lt;h1&gt;ScriptCs&lt;/h1&gt;
&lt;p&gt;So what is this ScriptCs?&amp;#160; ScriptCs is pure C# code, without IDE requirement, without a project, without classes, without designer files, without dlls, and without compiling. It has the power of C# and Nuget. &lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;Releases and nightly builds should be installed using &lt;a href=&quot;https://chocolatey.org/&quot;&gt;Chocolatey&lt;/a&gt;. If you, for some reason, haven’t heard of Chocolatey before, you’re in for a treat. Chocolatey is like Nuget for applications. If you’re familiar with apt-get on Linux, you know what I’m talking about. To install Chocolatey run the following command in a command prompt:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;C:\&amp;gt;&lt;/span&gt; @powershell -NoProfile -ExecutionPolicy unrestricted -Command &amp;quot;iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))&amp;quot; &amp;amp;&amp;amp; SET PATH=%PATH%;%systemdrive%\chocolatey\bin&lt;/code&gt; &lt;/p&gt;
&lt;p&gt;Once Chocolatey is installed, the latest and stable version is installed from command prompt:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;cinst scriptcs&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Chocolatey will update your PATH environment variable. To update at a later point in time, just:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;cup scriptcs&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;Writing Scripts&lt;/h2&gt;
&lt;p&gt;Now we’re ready to write some C# scripts. You can use an editor of choice, my preferred editor at the moment is Sublime Text. To write the traditional Hello World, we create a file in Sublime called ‘start.csx’, inside we write a single line:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/../images/scriptcs_image1.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border: 0px currentcolor; border-image: none; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;../images/scriptcs_image1.png&quot; width=&quot;641&quot; height=&quot;59&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now save the file and open a command prompt. Execute the following command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;scriptcs start.csx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The command prompt should write, ‘Hello from ScriptCs!’. This is much like NodeJS or Ruby, this very loose scripting experience. Now lets wrap this into a method and call the method:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/../images/scriptcs_image2.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border: 0px currentcolor; border-image: none; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;../images/scriptcs_image2.png&quot; width=&quot;658&quot; height=&quot;74&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Notice that order doesn’t matter in these loose scripts, and we still haven’t defined any class. Executing this script should output the same as before. Also, please notice the text-highlighting, there is a ScriptCs plugin for Sublime Text.&lt;/p&gt;
&lt;p&gt;Now let’s define a class:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/../images/scriptcs_image3.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border: 0px currentcolor; border-image: none; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;../images/scriptcs_image3.png&quot; width=&quot;659&quot; height=&quot;135&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We still get the same output. Notice how fast it is compiled and executed, really powerful stuff. When an error should occur in the script, you’ll get the same error as in Visual Studio. If you want to reference other any .dll, you can use the ‘#r’ keyword, like this:&lt;/p&gt;
&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://madstt.dk/../images/scriptcs_image4.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border: 0px currentcolor; border-image: none; display: inline; background-image: none;&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;../images/scriptcs_image4.png&quot; width=&quot;650&quot; height=&quot;60&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This assumes that the assembly is in the GAC, or in a bin folder next to your script. In many console applications we often want to receive arguments from the console, this can be handle by inspecting the Env.ScriptArgs collection like this:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/../images/scriptcs_image5.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border: 0px currentcolor; border-image: none; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;../images/scriptcs_image5.png&quot; width=&quot;656&quot; height=&quot;134&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;From the script command line you pass in your arguments like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;scriptcs start.csx -- &amp;quot;Hello from ScriptCs!&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Your scripts might start to grow, and you want to reuse some script parts. This can be achieved using the ‘#load’ keyword. Reference the scripts you want to include in script like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;#load &amp;quot;messenger.csx&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Referencing other scripts is recursive, other scripts can have other scripts and so forth. If multiple scripts references the same script, it will reconcile and make sure it only points to the same script once.&lt;/p&gt;
&lt;h2&gt;The REPL&lt;/h2&gt;
&lt;p&gt;Like NodeJS, ScriptCs also features a REPL. From the command line you start the REPL by just typing ‘scriptcs’ without any arguments. In REPL you can write the same code as we did above using script files. You can reference other assemblies using the ‘#r’ keyword and reference script files using the ‘#load’ keyword. It is possible to write multi-line statements, where symbols like ‘{’ makes it possible to add more lines until the statement is closed by a pairing ‘}’.&lt;/p&gt;
&lt;p&gt;The REPL is very useful for quickly experimenting with some C# code, without any IDE or script file. This is probably the shortest path to a C# scratch pad you’ll see around. &lt;/p&gt;
&lt;h2&gt;Debugging&lt;/h2&gt;
&lt;p&gt;Scripts are cool, but when apps get sophisticated debugging is essential. It is possible to debug your scripts, but currently quite cumbersome. IT requires you to install the Visual Studio 2012 SDK and the Roslyn. See this &lt;a href=&quot;https://github.com/scriptcs/scriptcs/wiki/Debugging-a-script&quot;&gt;guide&lt;/a&gt; on debugging.&lt;/p&gt;
&lt;h2&gt;Packages&lt;/h2&gt;
&lt;p&gt;As stated above, ScriptCs it meant as a tool to close the gap between Roslyn and Nuget, how is the achieved. By using the ‘install’ command, we can utilize the Nuget api. Nuget has its own Nuget packages, these can be used to call out to the Nuget api. In the example below, we use the ‘install’ command to retrieve MongoDb from Nuget:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;scriptcs -install mongodb      &lt;br /&gt;INFO: Installing packages...       &lt;br /&gt;INFO: Installed: mongodb       &lt;br /&gt;INFO: Installation completed successfully.       &lt;br /&gt;INFO: Saving packages in packages.config...       &lt;br /&gt;INFO: Createing packages.config       &lt;br /&gt;INFO: Added Mongodb (v.1.7.1.4791, .NET 4.0) to packages.config       &lt;br /&gt;INFO: Successfully updated packages.config. &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This is just an example, you can retrieve any package available on Nuget using the ‘install’ command. Packages are stored in the Packages folder, such as if it had been a regular Nuget download, and if Packages.config does not exist it will be created. If you distribute you scripts, you can restore all packages using the ‘install’ command, all you need is the Packages.config.&lt;/p&gt;
&lt;p&gt;Often when using the Nuget package as-is, requires a lot of boilerplate coding, which is rather cumbersome in scripts. This is great if you have Visual Studio, but in any other editor or in the REPL, it can be hard to remember namespaces, parameters, methods, etc. Such issues has also been taken care of in the ScriptCs environment. Your friend is called script packs.&lt;/p&gt;
&lt;h2&gt;Script Packs&lt;/h2&gt;
&lt;p&gt;In NodeJS you can require a module, this gives you an object, with functions attached that leads you wherever you need to go. You don’t need to remember namespaces or new up objects. All you have to do is make a ‘require’. Script packs is one of the great pieces inherited from NodeJS. Script packs makes APIs much easier to consume from a script. They wrap existing frameworks and provide nicer interaction. Script packs can facilitate injecting using statements and/or provide you with an object to work with.&lt;/p&gt;
&lt;p&gt;One very brilliant example of a script pack is the scriptcs.nancy script pack. Its created by &lt;a href=&quot;https://twitter.com/adamralph&quot;&gt;Adam Ralph&lt;/a&gt;, member of the ScriptCs core team. It’s a script pack to make it easier to use the Nancy web framework from a script file. Script packs are installed as packages using the ‘install’ command. Since a script pack is itself a package it specifies all its requirements. So it might need to retrieve other Nuget packages. Lets install the scriptcs.nancy script pack:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;scriptcs -install scriptcs.nancy&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Thats it. Now we can start using the Nancy web framework from script, like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Require&amp;lt;NancyPack&amp;gt;&lt;nancypack&gt;().Get(&amp;quot;/&amp;quot;, _ =&amp;gt; &amp;quot;Hello world&amp;quot;).Host();&lt;/nancypack&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Save the script, and execute. Now go to your favorite browser, and hit &lt;a href=&quot;http://localhost:8888&quot;&gt;http://localhost:8888&lt;/a&gt;. It should write out ‘Hello world’. The Require&amp;lt;&amp;gt; keyword is ScriptCs specific, and not part of Roslyn. Script packs gives you time to focus on the code you really like to write, and not all the boilerplate and setup. &lt;/p&gt;
&lt;p&gt;There is a master list of script packs on the ScriptCs &lt;a href=&quot;https://github.com/scriptcs/scriptcs/wiki/Script-Packs-master-list&quot;&gt;GitHub wiki&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Hosting&lt;/h2&gt;
&lt;p&gt;One last topic I’d like to touch in this post is hosting. ScriptCs has a very powerful hosting layer. This allows you to execute scripts in different environments. Now the examples of hosting is pretty complex, and there is some very great blog posts on these matters out there already. A great example of hosting a script inside &lt;a href=&quot;http://getglimpse.com/&quot;&gt;Glimpse&lt;/a&gt; is written by &lt;a href=&quot;http://www.strathweb.com/2013/10/extend-glimpse-fly-scriptcs-code-execution-tab-glimpse/&quot;&gt;Filip Wojcieszyn&lt;/a&gt;, one of the founders and coordinators of ScriptCs. Other examples can be found in ScriptCs &lt;a href=&quot;https://github.com/scriptcs/scriptcs-samples&quot;&gt;samples repository&lt;/a&gt; on GitHub. I would recommend the &lt;a href=&quot;https://github.com/scriptcs/scriptcs-samples/tree/master/webapihost&quot;&gt;WebApi&lt;/a&gt; hosting sample.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;With this blog post I hope I was able to inspire you to take a closer look at ScriptCs and find some useful applications. Please throw me some comments of where you could think of using ScriptCs. &lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Warm Crocodile Developer Conference 2015</title>
   <link href="http://madstt.dk/warm-croc-conference-2015/"/>
   <updated>2014-04-01T07:28:00+00:00</updated>
   <id>http://madstt.dk/warm-croc-conference-2015</id>
   <content type="html">&lt;blockquote&gt;
&lt;p&gt;Disclaimer: This is not an Aprils fool.&lt;/p&gt;
&lt;p&gt;Yesterday I had the pleasure of being announced as speaker for the &lt;a href=&quot;http://thewcdc.net/&quot;&gt;Warm Crocodile Developer Conference 2015&lt;/a&gt; in Copenhagen. This will be my first major speaker appearance, and I’m very exited and pleased to be given this opportunity.&lt;/p&gt;
&lt;p&gt;The session will cover some general unit testing approaches, and specifically how AutoFixture can facilitate clean and maintainable unit tests. I will introduce AutoFixture at a beginner’s level, moving toward more advanced applications, which even experienced users might find applicable. The title of the session will be “AutoFixture – From Basics to Nifties”.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hope to see you next year!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Warm Croc Conference – Debriefing</title>
   <link href="http://madstt.dk/warm-croc-conference-debriefing/"/>
   <updated>2014-01-17T11:04:14+00:00</updated>
   <id>http://madstt.dk/warm-croc-conference-debriefing</id>
   <content type="html">&lt;p&gt;So for the last two days, I had the pleasure of being an attendee at Warm Crocodile Developers Conference. It has indeed been two amazing days. There were a lot new impressions and new friends. In my last &lt;a href=&quot;http://madstt.dk/warm-croc-conference-expectations/&quot;&gt;post&lt;/a&gt; I outlined my expectations to the conference. In this blog post I’ll provide an overview of my take-aways and general impression of the conference.&lt;/p&gt;
&lt;p&gt;I believe that I had set myself some pretty high expectations to the conference, with a program like the one this year. It did indeed fulfill my expectations. We were 9 in total going to the conference from &lt;a href=&quot;http://www.d60.dk&quot;&gt;d60&lt;/a&gt;. We had a really great time, both during, and in evenings. It was great to socialize with your co-workers under different circumstances. Besides having to hang out your co-workers, I also spend many hours talking to a number of the speakers from the conference. It is such a great attitude in our industry, that no matter who or where you are, gurus from around the world take time to talk with you. On the first night I was hanging out with &lt;a href=&quot;http://blog.maartenballiauw.be/&quot;&gt;Maarten Balliauw&lt;/a&gt;, &lt;a href=&quot;https://twitter.com/jbogard&quot;&gt;Jimmy Bogard&lt;/a&gt;, &lt;a href=&quot;https://github.com/jrusbatch&quot;&gt;Justin Rusbatch&lt;/a&gt;, &lt;a href=&quot;https://twitter.com/gregyoung&quot;&gt;Greg Young&lt;/a&gt;, and &lt;a href=&quot;http://www.strathweb.com/&quot;&gt;Filip Wojcieszyn&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, on day 1, I had the pleasure of hearing &lt;a href=&quot;http://blog.ploeh.dk/&quot;&gt;Mark Seemann&lt;/a&gt; give his thoughts on how to stay in flow, meaning that you forget about time and place. He proposed a number of approaches to avoid interruptions and stay in flow. You could wear headphones, most developers already does this, but you’ll not be able to communicate with others.. Use a distributed version control system, like &lt;a href=&quot;https://en.wikipedia.org/wiki/Git_(software)&quot;&gt;Git&lt;/a&gt;, which makes you less dependent on the work of co-workers. Use a smaller screen for development. His argument was that instead of having a ‘wall’ of screens, only using the laptop screen would make you less prone to interruptions. He also pointed out that having a smaller screen, would make write better code, due to the limit width of the screen. Working from home is also a great way to avoid getting interrupted by random questions from co-workers. Reflecting on his experiences with this, I felt that I need to try some of his recommendations. I do wear headphones, use Git and work from home once a week, but I’m guilty of using 3 large LCDs in office. I’m going to try to just use my laptop for development.&lt;/p&gt;
&lt;p&gt;Another highlight from day 1 was &lt;a href=&quot;http://scriptcs.net/&quot;&gt;ScriptCS&lt;/a&gt;. &lt;a href=&quot;http://www.strathweb.com/&quot;&gt;Filip Wojcieszyn&lt;/a&gt; did an awesome session. Starting out pretty simple, and ending with some mind-blowing demos on the capabilities of ScriptCS. The overall idea of releasing C# from Visual Studio, only using plain script files to get things done. Using your C# skills to write scripts like the ones you can with PowerShell, is pretty intriguing. ScriptCS is definitely something I’ll begin to play with soon.&lt;/p&gt;
&lt;p&gt;On the second day, for me the key take-aways was &lt;a href=&quot;http://hanselman.com&quot;&gt;Scott Hanselman&lt;/a&gt;, &lt;a href=&quot;http://paulstack.co.uk/blog&quot;&gt;Paul Stack&lt;/a&gt;, and &lt;a href=&quot;http://codeofrob.com/&quot;&gt;Rob Ashton.&lt;/a&gt; Hanselman gave a great talk on how to use your C# skills on multiple platforms, like iOS and Andoid. By using &lt;a href=&quot;http://xamarin.com&quot;&gt;Xamarin&lt;/a&gt; tools we re-use more than 90% the code. Paul introduced me to a open-source tool called &lt;a href=&quot;vagrantup.com&quot;&gt;Vagrant&lt;/a&gt;. Vagrant is tool a for orchestrating and building development environments. It makes it possible for developers to deploy the exact same environment as in production. Experiment with it and throw it away afterwards. You can also spin an environment up, run your tests and shut it down again.&lt;/p&gt;
&lt;p&gt;Rob Ashton gave the last session for me. It was a very personal session on his endeavors the last 15 months. He quit his job from one day to the other, and wrote a blog post saying that he wanted to work for free if he was given roof over his head. So he sold almost all of his belongings and travelled the world. This has given him trip around the world working in different environments with different languages, always learning something new. In the session he outlined a number take-aways from his endeavors which can be related to software. It was a different kind of session, and very personal. Its not the kind of session you get the chance to hear that often.&lt;/p&gt;
&lt;p&gt;I think that the conference committee had put together a very compact and inspirational program this year. There were slots were I had to choose between several options and other slots where nothing could really excite me. &lt;/p&gt;
&lt;p&gt;A lot of things has to fit together when arranging such a large conference. And there were some small adjustments during the conference which can be improved. Registration was a chaotic experience, there were a long line to get in, and when we finally got in, there were not badges for all, so the majority of the attendees had to write their own badge. Some of us didn’t get the armband or sticker, which should give us access to the conference dinner and party. During lunch on the first day, there were not enough table space for all. This was improved on the second day, where more tables were bought in.&lt;/p&gt;
&lt;p&gt;All-in-all a great conference. I got away with a lot of personal and professional experiences. I managed to get around my network and even expand it. Both the conference dinner and party was held in Nørrebro Bryghus. It was a great venue for arrangements like this. Although, it was kind of disappointing to see the low turn-out at the conference party. It seemed like most attendees had left town already. Big thanks to &lt;a href=&quot;https://twitter.com/Danielovich&quot;&gt;Daniel Frost&lt;/a&gt; for setting up the conference, I had a blast.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Warm Croc Conference – Expectations</title>
   <link href="http://madstt.dk/warm-croc-conference-expectations/"/>
   <updated>2014-01-07T18:29:50+00:00</updated>
   <id>http://madstt.dk/warm-croc-conference-expectations</id>
   <content type="html">&lt;p&gt;I’ve been so fortunate to receive a ticket for the &lt;a href=&quot;http://thewcdc.net/&quot;&gt;Warm Crocodile Developer Conference&lt;/a&gt; in Copenhagen from my employer &lt;a href=&quot;http://d60.dk&quot;&gt;d60&lt;/a&gt;. The conference is set on January 15th and 16th. The conference is probably the most attractive conference on Danish soil, with respect to the line-up of speakers. To name a few, &lt;a href=&quot;http://hanselman.com&quot;&gt;Scott Hanselman&lt;/a&gt;, &lt;a href=&quot;http://udidahan.com&quot;&gt;Udi Dahan&lt;/a&gt;, and &lt;a href=&quot;http://codebetter.com/&quot;&gt;Greg Young&lt;/a&gt;. In this post I’ll outline some of my expectations and session most-goes.&lt;/p&gt;
&lt;p&gt;My employer is partnering with Microsoft on this conference, this means that I’ll be responsible for sharing my thoughts on the company’s Twitter and Facebook account. I did some of this during last years Danish Developer Conference as well. I’m planning on sharing my thoughts on my blog as well. The co-workers of mine who is also participating, either as attendees or speakers, will do sharing a larger hotel condor. We’re planning on setting up some hacking and coding during the late nights of the conference. So I’m expecting a lot of socializing with my colleagues. Besides these late night sessions, the conference will hold both a conference dinner and conference party, were I’ll be socializing with other attendees and speakers. &lt;/p&gt;
&lt;p&gt;The fact that Scott Hanselman is speaking, is major asset of the conference. Since the first time I heard Scott talk, back in 2008 at &lt;a href=&quot;https://en.wikipedia.org/wiki/Professional_Developers_Conference&quot;&gt;PDC&lt;/a&gt;, he keeps giving some awesome talks. No matter the subject, you’ll get away with something. Therefore I’ll prioritize his talks. He’ll be giving two talks and give the opening keynote.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.ploeh.dk/&quot;&gt;Mark Seemann&lt;/a&gt;, a Danish pro developer and architect, known for his thoughts on &lt;a href=&quot;https://en.wikipedia.org/wiki/Test-driven_development&quot;&gt;TDD&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Dependency_injection&quot;&gt;Dependency Injection&lt;/a&gt;. He wrote an award-winning book, &lt;a href=&quot;http://www.manning.com/seemann/&quot;&gt;Dependency Injection in .Net&lt;/a&gt;, which I have recommended several times on this blog. Over the past few years he has improved his speaker skills, and now gives some great talks. He is very passionate about software craftsmanship and &lt;a href=&quot;https://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29&quot;&gt;SOLID&lt;/a&gt; principles, almost religiously. He’ll be giving a productivity talk, which I expects a lot from.&lt;/p&gt;
&lt;p&gt;My first software conference was back in 2006, which was the &lt;a href=&quot;https://en.wikipedia.org/wiki/OOPSLA&quot;&gt;OOPSLA&lt;/a&gt; conference, held in Portland, OR, in 2006. The OOPSLA conference is an annual ACM research conference. Among the abstract talks there was a guy named &lt;a href=&quot;https://en.wikipedia.org/wiki/Erik_Meijer_%28computer_scientist%29&quot;&gt;Erik Meijer&lt;/a&gt; from Microsoft Research. This guy, always wearing a bright and colorful shirt, gave an introduction to &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb397926.aspx&quot;&gt;LINQ&lt;/a&gt;. A great talk, but also very abstract and complex. Today, LINQ is vital tool in every .Net developers toolbox. I’m looking forward meeting Erik again, and hear what he is up to these days. He gives a a keynote on the second of the conference, and some sessions with promising titles.&lt;/p&gt;
&lt;p&gt;JetBrains Evangelist, &lt;a href=&quot;http://blog.maartenballiauw.be/&quot;&gt;Maarten Balliauw&lt;/a&gt;, is a Microsoft Azure MVP and will show-off some promising Azure stuff. Maarten has received praise for his talks, so I’m looking forward.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://msdn.microsoft.com/en-us/vstudio/roslyn.aspx&quot;&gt;Roslyn&lt;/a&gt; project has been ongoing for some time now, a CTP has been released, but I still need to see and grasp the ideas and application of Roslyn. &lt;a href=&quot;https://github.com/jrusbatch&quot;&gt;Justin Rusbatch&lt;/a&gt; is a dedicated OSS developer and heavily involved in the &lt;a href=&quot;http://scriptcs.net/&quot;&gt;ScriptCS&lt;/a&gt; project, so I will therefore attend Justin’s session on Roslyn, which ScriptCS is dependent on. Besides his talk I’m looking forward to have a chat with him. &lt;a href=&quot;http://www.strathweb.com/&quot;&gt;Filip Wojcieszyn&lt;/a&gt;, ASP.NET MVP, known for doing cool stuff with Web API, is also a coordinator on the ScriptCS project. He will give an entire session on ScriptCS, which I look forward to. I puzzle with an idea of introducing ScriptCS on a current project I’m working on.&lt;/p&gt;
&lt;p&gt;Back in 2011 I attended Udi Dahan’s Advanced Distributed Systems Design with SOA course. Which was a great experience. Udi is an extremely talented instructor, and kept focus the entire week of the course. When it comes to messaging infrastructure and loosely-coupled architectures, Udi is great resource. He is always well-prepared for his sessions and comes with a message for the audience.&lt;/p&gt;
&lt;p&gt;There will be several slots during the conference where I will have a hard time to decide which session to attend. These slots are perfect opportunities to hang out with industry experts and former colleagues.&amp;#160; &lt;/p&gt;
&lt;p&gt;Conferences like this is a great chance to meet some of the gurus in the industry. I have a semi-agreement with &lt;a href=&quot;http://blog.maartenballiauw.be/&quot;&gt;Maarten Balliauw&lt;/a&gt;, to bring some of his Belgian home-brew of beer. Oh, and he recently released a &lt;a href=&quot;http://blog.maartenballiauw.be/post/2013/12/30/Introducing-Glimpse-plugins-for-Windows-Azure.aspx&quot;&gt;Glimpse plugin for Azure&lt;/a&gt;, which I hope he can demo for me.&lt;/p&gt;
&lt;p&gt;All social activities during the conference will be held at &lt;a href=&quot;http://www.noerrebrobryghus.dk/&quot;&gt;Nørrebro Bryghus&lt;/a&gt;. This brewery makes great beer, and as a beer lover I anticipate some great hours. &lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Assert.Throws<> Over ExpectedException</title>
   <link href="http://madstt.dk/assert-throws-over-expectedexception/"/>
   <updated>2013-10-09T02:39:36+00:00</updated>
   <id>http://madstt.dk/assert-throws-over-expectedexception</id>
   <content type="html">&lt;p&gt;Writing unit tests that expects a given type of exception under given circumstances is essential for any test suite. Although it is useful to use the correct assertion types when testing for exceptions. In this post I will provide some guidance on why to use Assert.Throws&amp;lt;&amp;gt;() instead of ExpectedException.&lt;/p&gt;
&lt;p&gt;Using the ExpectedException:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:732f249e-7f06-4e8d-b37c-567d5c737d39&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; margin: 0px; display: inline; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #808080;&quot;&gt;///&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #808080;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #008000;&quot;&gt; Testing exception handling&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #808080;&quot;&gt;///&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ExpectedException&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;typeof&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ArgumentNullException&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;))]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; WhateverTestName()&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #008000;&quot;&gt;// Arrange&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; sut = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;SystemUnderTest&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #008000;&quot;&gt;// Act&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #008000;&quot;&gt;// Assert&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;sut.MethodThatThrowsEception();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the above example whenever / wherever an exception of the given type is thrown inside the test, the test is considered passed.&lt;/p&gt;
&lt;p&gt;A refactored example:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3a0c3937-0ef8-4590-9d67-f98ffb6c9ac5&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; margin: 0px; display: inline; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #808080;&quot;&gt;///&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #808080;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #008000;&quot;&gt; Testing exception handling&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #808080;&quot;&gt;///&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; WhateverTestName()&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #008000;&quot;&gt;// Arrange&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; sut = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;SystemUnderTest&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #008000;&quot;&gt;// Act&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #008000;&quot;&gt;// Assert&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Assert&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;.Throws&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ArgumentNullException&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;(() =&amp;gt; sut.MethodThatThrowsEception());&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now, instead of using the ExpectedException, I use Assert.Throws&amp;lt;&amp;gt;(). This provides a number of benefits / advantages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Readability
&lt;ul&gt;
&lt;li&gt;The test is now more readable, the reader is not in doubt of where in the code the exception is expected to be thrown. Furthermore, the ExpectedException attribute is easily overseen, which makes it difficult to understand what the intent of the test is.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Multiple conditions
&lt;ul&gt;
&lt;li&gt;It is possible to test other conditions. Using the ExpectedException you cannot test anything else than the whether the exception is thrown.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Possible false expectation
&lt;ul&gt;
&lt;li&gt;Setting the ExpectedException on a test case, makes it open to be passed whenever an exception of the given type is thrown inside the test. This could lead to some serious and unforeseen side-effects.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>NUnit Support for AutoFixture</title>
   <link href="http://madstt.dk/nunit-support-for-autofixture/"/>
   <updated>2013-10-03T12:28:58+00:00</updated>
   <id>http://madstt.dk/nunit-support-for-autofixture</id>
   <content type="html">&lt;p&gt;For a more general introduction to AutoFixture, see my previous &lt;a href=&quot;http://madstt.dk/customizations-with-autofixture/&quot;&gt;post&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;For a long time it has been an &lt;a href=&quot;https://xunit.codeplex.com/&quot;&gt;xUnit&lt;/a&gt; exclusive to utilize &lt;a href=&quot;http://blog.ploeh.dk/2010/10/08/AutoDataTheorieswithAutoFixture/&quot;&gt;AutoData&lt;/a&gt; in your test suites. The extensibility model of &lt;a href=&quot;http://www.nunit.org/&quot;&gt;NUnit&lt;/a&gt;, made the migration to NUnit cumbersome, to say the least. Recently, &lt;a href=&quot;http://gertjvr.wordpress.com/2013/08/29/my-first-open-source-contribution/&quot;&gt;Gert Jansen van Rensburg&lt;/a&gt;, made the first serious attempt to solve this. Having followed his battles on &lt;a href=&quot;https://github.com/AutoFixture/AutoFixture/pull/158&quot;&gt;GitHub&lt;/a&gt;, he released the first version of the &lt;a href=&quot;https://www.nuget.org/packages/AutoFixture.NUnit2/&quot;&gt;AutoFixture.NUnit2&lt;/a&gt; NuGet package.&amp;#160; &lt;/p&gt;
&lt;p&gt;Although installation and setup is not at smooth as with xUnit, the power of this extension is without question. This post provides a short setup guide on how to install and configure this to work on both local dev machines as well as on &lt;a href=&quot;https://www.jetbrains.com/teamcity/&quot;&gt;TeamCity&lt;/a&gt;. The challenge with the extensibility model of NUnit is the distribution of the Addin, the actual plugin or extension to NUnit. This .dll has to be present in the bin\addins folder of NUnit. This is not preferable in a larger multi dev environment, therefore an alternative approach is &lt;a href=&quot;http://gertjvr.wordpress.com/2013/10/02/howto-get-autofixture-nunit2-working-with-ncrunch/&quot;&gt;proposed&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Go to your NuGet Package Manager, and Install-Package AutoFixture.NUnit2&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;If you have any previous version of AutoFixture installed it will be updated to the latest. &lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;And Install-Package NUnit.Runners&lt;/li&gt;
&lt;li&gt;Make a manual reference to tools\lib\nunit.core.interfaces.dll, which resides in your packages folder under NUnit.Runners.&lt;/li&gt;
&lt;li&gt;The installation of the AutoFixture.NUnit2 package has inserted this line in your AssemblyInfo.cs-file: [assembly: NUnit.Framework.RequiredAddinPloeh.AutoFixture.NUnit2.Addins.Constants.AutoDataExtension)]&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Remove this for now.&lt;/li&gt;
&lt;/ul&gt;
&lt;/ol&gt;
&lt;p&gt;Now everything is installed and ready to go, except that we need to add the NUnit Addin to the test assembly. I know this is cumbersome, and a bitter pill to swallow. As mentioned above, copying the Ploeh.AutoFixture.NUnit2.Addins.dll-file from the packages folder to your unit test runners bin\addins folder:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NUnit: C:\Program Files (x86)\NUnit 2.6.2\bin\addins&lt;/li&gt;
&lt;li&gt;R#: C:\Program Files (x86)\JetBrains\ReSharper\v8.0\Bin\addins&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;As proposed &lt;a href=&quot;http://gertjvr.wordpress.com/2013/10/02/howto-get-autofixture-nunit2-working-with-ncrunch/&quot;&gt;here&lt;/a&gt;, I could also create a new class, which would inherit the Addin, and add this to the test assembly, but in my test setup I found a better spot.&lt;/p&gt;
&lt;h2&gt;Setup&lt;/h2&gt;
&lt;p&gt;Usually I setup my test fixtures using a base class, which among other things holds my AutoFixture configurations, a common setup could look like this:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a6cbefee-94e5-4abe-85b3-a3c0b5f98034&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;TestBase&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;IFixture&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; Fixture;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;GuardClauseAssertion&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; GuardClauseAssertion;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;WritablePropertyAssertion&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; WritablePropertyAssertion;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; Setup()&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;Fixture = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;().Customize(&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;AutoMoqCustomization&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;());&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;GuardClauseAssertion = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;GuardClauseAssertion&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;(Fixture);&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;WritablePropertyAssertion = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;WritablePropertyAssertion&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;(Fixture);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;Now this also makes it a perfect spot for my NUnit Addin class, which I’ll include by inheritance:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0cd93743-cc10-4f58-a11a-739bc7fc435a&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; NUnit.Core.Extensibility;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;NUnitAddin&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;TestBase&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; : Ploeh.AutoFixture.NUnit2.Addins.&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Addin&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;IFixture&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; Fixture;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;GuardClauseAssertion&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; GuardClauseAssertion;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;WritablePropertyAssertion&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; WritablePropertyAssertion;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; Setup()&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;Fixture = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;().Customize(&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;AutoMoqCustomization&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;());&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;GuardClauseAssertion = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;GuardClauseAssertion&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;(Fixture);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;WritablePropertyAssertion = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;WritablePropertyAssertion&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;(Fixture);&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;So adding the NUnitAddin attribute and inheriting the Ploeh.AutoFixture.NUnit2.Addins.Addin class, I don’t have to copy the addin .dll to the approriate bin\addins folder. Please note the using statement. This way it is by far easier to setup and distribute in the large developer environment. Since also works with TeamCity, otherwise you would have to setup your NUnit Test Launcher on TeamCity to locate the addin, not advisable and a poorly documented approach.&lt;/p&gt;
&lt;h2&gt;&lt;/h2&gt;
&lt;h2&gt;Usage&lt;/h2&gt;
&lt;p&gt;With all these efforts behind us, we can now easily auto-generate test data via parameters, such as this:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:638b2534-a56b-41b4-83e7-d6f7c7d68e7d&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;AutoData&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; WhateverTestName(&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; foo, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; baa)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Arrange&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Act&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Assert&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;In this test case foo and baa will be assigned auto-generate values by AutoFixture. Now there is much more in the box. So far, the NUnit TestCase attribute have had a rather sparse set of allowed types, such as ints, strings, bool, etc. With AutoData it is now possible auto-generate types as decimal, and even complex types:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6acf9238-88b6-43f4-8a9d-1ea4445ec39c&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;AutoData&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; WhateverTestName(&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;decimal&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; foo, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;MyClass&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; sut)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Arrange&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Act&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Assert&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;This is all great and awesome, but wait there is some minors that also might come in handy.&lt;/p&gt;
&lt;p&gt;You might have some test scenarios where you would still like to supply your own test data. This will work great along AutoData:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3ffec81d-a7da-4127-9c3e-518ed11da570&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;AutoData&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;TestCase&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;(5, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#a31515&quot;&gt;&amp;quot;Some String&amp;quot;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;)]&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; WhateverTestName(&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; foo, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; baa)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Arrange&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Act&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Assert&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;This will generate two test cases, the first one with auto-generated test data from AutoFixture, and the second one with the test data from the TestCase attribute. Note, that the types must be allowed by the TestCase attribute.&lt;/p&gt;
&lt;p&gt;Lets consider a more advanced scenario. I have previously described how to use AutoFixture as an &lt;a href=&quot;http://madstt.dk/customizations-with-autofixture/&quot;&gt;auto-mocking container&lt;/a&gt;. This is how we would auto-generate and freeze our dependencies using AutoData:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d5a272b8-0034-4bd1-ab01-f94db4d5931a&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;AutoData&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; WhateverTestName([&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Frozen&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;IService1&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;gt; service1Mock, &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Frozen&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;IService2&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;gt; service2Mock, &lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;MyClass&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; sut)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Arrange&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Act&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Assert&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;In this test case we let AutoFixture freeze the dependencies that I would like to setup expectations for, and AutoFixture will the inject them during the creation of the MyClass sut.&lt;/p&gt;
&lt;p&gt;These are some of the great new possibilities of the latest extension to AutoFixture, you can probably come up with other awesome scenarios.&lt;/p&gt;
&lt;p&gt;Finally, I must send all credits for the extension to &lt;a href=&quot;http://gertjvr.wordpress.com/2013/08/29/my-first-open-source-contribution/&quot;&gt;Gert Jansen van Rensburg&lt;/a&gt;. Read his blog and follow him on &lt;a href=&quot;https://twitter.com/gertjvr81&quot;&gt;Twitter&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Easy Property Notification Verification in MVVM</title>
   <link href="http://madstt.dk/easy-property-notification-verification-in-mvvm/"/>
   <updated>2013-09-25T11:09:57+00:00</updated>
   <id>http://madstt.dk/easy-property-notification-verification-in-mvvm</id>
   <content type="html">&lt;p&gt;Currently I’m doing a lot of WPF, we’re profound users of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Model_View_ViewModel&quot;&gt;MVVM&lt;/a&gt; pattern. I therefore often find myself writing a lot of unit tests for viewmodels. A, or maybe &lt;em&gt;the&lt;/em&gt;, key feature of the MVVM pattern is the property binding between the view and the viewmodel. Once assigned a value to a property, the viewmodel notifies the view, who updates the view accordingly. A viewmodel might have a significant amount of properties who can notify the view with updates, therefore I’ve implemented two small extension methods for this purpose:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:aca9eb67-f937-4e75-81cc-3d65df30631f&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;NotifyPropertyChanged&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;NotifyExpectation&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;T&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;ShouldNotifyOn&amp;lt;T, TProperty&amp;gt;(&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; T owner,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Expression&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Func&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;T, TProperty&amp;gt;&amp;gt; propertyPicker)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; T : &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;INotifyPropertyChanged&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; CreateExpectation(owner,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;            &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;propertyPicker, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;NotifyExpectation&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;T&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;ShouldNotNotifyOn&amp;lt;T, TProperty&amp;gt;(&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; T owner,&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Expression&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Func&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;T, TProperty&amp;gt;&amp;gt; propertyPicker)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; T : &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;INotifyPropertyChanged&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; CreateExpectation(owner,&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;            &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;propertyPicker, &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;NotifyExpectation&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;T&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;CreateExpectation&amp;lt;T, TProperty&amp;gt;(T owner,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Expression&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Func&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;T, TProperty&amp;gt;&amp;gt; pickProperty,&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; eventExpected) &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;where&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; T : &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;INotifyPropertyChanged&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; propertyName =&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;            &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;MemberExpression&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;)pickProperty.Body).Member.Name;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;NotifyExpectation&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&amp;lt;T&amp;gt;(owner,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;            &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;propertyName, eventExpected);&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;These extension methods can be used in several verification test contexts. The obvious one would be:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d4a20488-f106-4a1e-b011-4c392b27357c&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; OnPropertyChangedIsCalledForParticularProperty()&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Arrange&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; sut = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;MyClass&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Act&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Assert&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;sut.ShouldNotifyOn(model =&amp;gt; model.Property)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;.When(model =&amp;gt; model.Property = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#a31515&quot;&gt;&amp;quot;new string&amp;quot;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;In this test I verify that the property named Property is raising its PropertyChanged event, when the setter is called with the string value “new string”. Clean and easy verification of properties on view models. These extension methods can participate in more complex test scenarios:&lt;/p&gt;
&lt;p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a46c497d-84d9-4651-9b2f-901e21ff0abb&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto&quot;&gt;
&lt;ol start=&quot;1&quot; style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; OnPropertyChangedIsCalledForParticularProperty()&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Arrange&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; sut = &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#0000ff&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#2b91af&quot;&gt;MyClass&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Act&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background:#ffffff;color:#008000&quot;&gt;// Assert&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;sut.ShouldNotifyOn(model =&amp;gt; model.Property)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3&quot;&gt;        &lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;.When(model =&amp;gt; model.IntProperty = 3);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background:#ffffff;color:#000000&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;In this test I verify that the Property is raising the event, whenever another property setter is called. &lt;/p&gt;
&lt;p&gt;Combining ShouldNotifyOn with combinations of the ShouldNotNotifyOn makes these two small extension methods quite handy when testing and verifying properties on view models. &lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Continuous Integration with GitHub, TeamCity, Azure Websites and IIS7</title>
   <link href="http://madstt.dk/continuous-integration-with-github-teamcity-azure-websites-and-iis7/"/>
   <updated>2013-06-19T04:03:09+00:00</updated>
   <id>http://madstt.dk/continuous-integration-with-github-teamcity-azure-websites-and-iis7</id>
   <content type="html">&lt;p&gt;The CI objective is to continuously and frequently incorporate changes to the codebase into a centralized build process which may include the automated running of tests, analysis of the code and deployment to target environment(s). Pivotal to this is the version control system as this should be the source of truth for the code base. As a result, effective CI is only achieved through effective use of VCS.&lt;/p&gt;
&lt;p&gt;In order for this to work successfully, developers need to apply the good development practices, they’re probably already aware of, but may not have previously had the impetus to adhere to. Committing source code regularly, taking updates from team members as frequently as possible and only putting working code which doesn’t fail tests into VCS are all just common sense and good practice. The difference being that if they don’t do this in the CI world, lots of flashing red lights go off and other people get inconvenienced. Let’s just say they should be a lot more motivated now!&lt;/p&gt;
&lt;h2&gt;Impact on Development Practices&lt;/h2&gt;
&lt;p&gt;Forcing developers to only release code – even to a development or test server – via a continuous integration and deployment process can be a fundamental change of working for some people. It means moving away from casual VCS and release practices and having to take a much more structured approach to work.&lt;/p&gt;
&lt;p&gt;This is a good thing, and if someone tells you otherwise it’s probably because they’re following less than ideal practices to begin with. This really forces you to modularize work into smaller, more atomic units than you might have done in the past. If you don’t commit code atomically, for example by submitting the code behind but not the ASPX with controls it references, your build breaks and now &lt;em&gt;nobody&lt;/em&gt; can push it through to the development server until it’s fixed.&lt;/p&gt;
&lt;p&gt;Likewise if you go long periods without committing to source control you start to dramatically increase the risk of conflicts with others. Plus you also increase the duration between releases to a server environment which consequently increases your risk of features not working outside your own PC. Everyone’s familiar with this, I assume.&lt;/p&gt;
&lt;p&gt;So in summary, release early and release often. Yes, even if you’re not practicing CI!&lt;/p&gt;
&lt;h2&gt;Choosing A Build Server&lt;/h2&gt;
&lt;p&gt;This concept is equally applicable to a whole range of build server products that support the principals of CI. Within the .NET space the products most commonly seen include (but are not limited to) &lt;a href=&quot;http://en.wikipedia.org/wiki/CruiseControl.NET&quot;&gt;CruiseControl.NET&lt;/a&gt;(CC.NET), Microsoft’s own &lt;a href=&quot;http://en.wikipedia.org/wiki/Team_Foundation_Server&quot;&gt;Team Foundation Server&lt;/a&gt; (TFS) and the topic of today’s discussion, &lt;a href=&quot;http://en.wikipedia.org/wiki/TeamCity&quot;&gt;TeamCity&lt;/a&gt; from JetBrains (the good folks who bring us ReSharper).&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/search?q=teamcity+cruisecontrol+tfs&quot;&gt;Much discussion&lt;/a&gt; about the various merits of each is available on the web but there are a few key and decisive factors in favor of TeamCity. Firstly, the &lt;a href=&quot;http://www.jetbrains.com/teamcity/buy/index.jsp&quot;&gt;Professional Edition is free&lt;/a&gt; and more than capable of providing sufficient features to get very intimate with how it runs before needing the scale of the Enterprise Edition which even then, is only a couple of thousand dollars.&lt;/p&gt;
&lt;p&gt;Since abandoning TFS for &lt;a href=&quot;https://en.wikipedia.org/wiki/Git_(software)&quot;&gt;Git&lt;/a&gt; and &lt;a href=&quot;http://www.github.com&quot;&gt;GitHub&lt;/a&gt;, due to a job change, I’ve been looking for some kind of CI workflow. Actually, I think TFS is a very impressive product. What it’s done with the whole application lifecycle management (ALM) and particularly the testing and lab environment is mighty impressive. &lt;/p&gt;
&lt;p&gt;Finally, I just like JetBrains! ReSharper is a raging success (&lt;a href=&quot;https://twitter.com/gorohoroh/statuses/347083057242701824&quot;&gt;over 250,000 licenses sold&lt;/a&gt;) and every interaction I’ve had with them both professionally and via medium like Twitter has been profoundly positive. They give me a high degree of confidence that they understand the development process and the tools software developers need to be successful.&lt;/p&gt;
&lt;h2&gt;Project Background&lt;/h2&gt;
&lt;p&gt;I was recently transferred to a new project. It’s a project which currently has a Silverlight CRUD client to some &lt;a href=&quot;https://en.wikipedia.org/wiki/Business_intelligence&quot;&gt;business intelligence&lt;/a&gt; (BI) warehouse, which is responsible for creating weekly reports to customers. The task was to migrate the current Silverlight client to a web client deployed as an Azure Website. &lt;/p&gt;
&lt;p&gt;At my current workplace, we’re profound fans of Git as version control system, and use GitHub, as hosting service. On some of our projects we use &lt;a href=&quot;https://www.jetbrains.com/teamcity/&quot;&gt;TeamCity&lt;/a&gt; server for continuous integration. &lt;/p&gt;
&lt;h2&gt;Setting Up Continuous Integration with TeamCity&lt;/h2&gt;
&lt;p&gt;We need to setup a build configuration that is triggered by a VCS check-in. First, of is some general settings for the build configuration. Important notice is to remember the artifact path. This path describes which parts of the VCS repository is included in this build. The ‘**’ is a wildcard to include everything.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb.png&quot; width=&quot;649&quot; height=&quot;223&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The next step is to setup source control. This is done in two steps. We need to attach Git as our VCS for this build configuration:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image1.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb1.png&quot; width=&quot;649&quot; height=&quot;271&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;As highlighted, this build configuration is fetching from the master branch from Github. It is also possible to supply different filters for fetching other branches. It also makes it possible to have other build configuration for other primary branches, such as test, staging, release,… Then we need to setup how VCS checkout is done and where to checkout:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image2.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb2.png&quot; width=&quot;649&quot; height=&quot;205&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;An important notice is to set the checkout mode as ‘Automatically on agent’. Default is on server.&lt;/p&gt;
&lt;p&gt;So now we have setup VCS, we then move on to setup how the codebase is build and tested. This is done in two seperate steps:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image3.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb3.png&quot; width=&quot;649&quot; height=&quot;266&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;As highlighted I’m using the build-in MSBuild to perform the actual build of the codebase. A number of options are available. The second, dependent on a successful build, is the testing step:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image4.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb4.png&quot; width=&quot;649&quot; height=&quot;271&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;As highlighted, I use NUnit, but there is support for MSTest. I’m not sure about xUnit. Also highlighted is the assembly list. I usually have a number of test assemblies, unit tests, acceptance tests, and integration tests. Supplying a wildcard, all test assemblies will be run.&lt;/p&gt;
&lt;p&gt;We then need to supply a build trigger. A build can be run manually, but by setting up a build trigger we can execute the build on a VCS check-in:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image5.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb5.png&quot; width=&quot;649&quot; height=&quot;128&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;You can trigger builds based on a number of variety of different events such as on a schedule (i.e. nightly) or on the success of another build.&lt;/p&gt;
&lt;p&gt;That’s it, whenever we make a Git push on our master branch, a build is triggered. There is a ton of other options available in TeamCity. I have also a build configuration for my test branch and one for my release branch. This setup does not avoid developers from checking in a revision which does not build or have failing tests, but it highlights issues, and makes the team aware of issues on the latest check-in. By making the steps dependent on each other, we can make assure that we don’t deploy a revision with failing tests. In the next section, I’ll setup a deployment step, where TeamCity deploys the, now building and fully-tested codebase, to an Azure Website.&lt;/p&gt;
&lt;h2&gt;Setting Up Deployment to Azure Websites using TeamCity&lt;/h2&gt;
&lt;p&gt;We start by creating a new build configuration for deploying to a Azure Website:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image6.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb6.png&quot; width=&quot;649&quot; height=&quot;102&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;In the source control settings, we attach the same VCS root as for building and testing the master branch, shown in the previous section. In the build step section, I’ll setup a command line build step. &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image7.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb7.png&quot; width=&quot;649&quot; height=&quot;263&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;/p&gt;
&lt;p&gt;It is actually pretty trivial. From command line, we make a Git push to a Azure Website specific URL, on the master branch. This URL can be found on your Azure Website on the Configure tab:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image8.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb8.png&quot; width=&quot;649&quot; height=&quot;237&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Copy the Deployment Trigger Url to your TeamCity build configuration. The branch needs to be the same on both Azure and in the Git push URL. As shown in the previous section, we can use different branches in different builds, and therefore deploy to different environments. In this project, I have a development environment, which is deployed using the master branch, a test environment using the test branch, and finally a production environment using the release branch. I then have completely separate environments, controlled by Girt branches.&lt;/p&gt;
&lt;p&gt;To trigger the Azure deployment, a build trigger is specified:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image9.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb9.png&quot; width=&quot;649&quot; height=&quot;134&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This triggers the deployment to Azure on a successful build step, shown in the previous section. Basically, this guards any deployment of faulty revisions. &lt;/p&gt;
&lt;p&gt;There are two additional settings that we need before we have automated Azure Website deployment. We need to setup two dependencies for the build:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image10.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb10.png&quot; width=&quot;649&quot; height=&quot;313&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I need a snapshot dependency and an artifact dependency. The snapshot dependency, is a indicating that this build will use the latest successful Build &amp;amp; Test Master build. By doing this we can avoid, that another team member makes a check-in, just after the previous check-in, and thereby invalidates the first check-in. This makes sure that build and revision is in line. The artifact dependency, has the same meaning as the snapshot dependency, but at at artifact level. Making sure that none of the artifact is invalidated by a successive check-in.&lt;/p&gt;
&lt;p&gt;This is all that it takes to make your Github repo, being build, tested and deployed to an Azure Website. In the current project, I have also created another build for IIS deployment. &lt;/p&gt;
&lt;h2&gt;Setting Up Deployment to IIS7 using TeamCity&lt;/h2&gt;
&lt;p&gt;This is done by using pushing a &lt;a href=&quot;http://www.iis.net/downloads/microsoft/web-deploy&quot;&gt;Web Deploy&lt;/a&gt; package to the IIS. A Web Deploy package contains everything that is needed for a deployment. On the server, running the IIS, we need to make sure that the Web Deployment Agent Service is running and always will (automatic startup). On the General Settings page, make sure to provide the correct artifact path:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image11.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb11.png&quot; width=&quot;649&quot; height=&quot;107&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This indicates where the Web Deploy package is located, dependent on the build configuration used.&lt;/p&gt;
&lt;p&gt;Then I’ve setup a MSBuild command line build step:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2013/06/image12.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb12.png&quot; width=&quot;649&quot; height=&quot;390&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;/p&gt;
&lt;p&gt;The important part is the command line parameters. These parameters tells MSBuild that it should build, package, and deploy using Web Deploy. As with the Azure deployment, this build is triggered after a successful Build &amp;amp; Test Master build. I’ve provided two build parameters, %env.Configuration% and %env.TargetServer%, these are provided at the Build Parameters page.&lt;/p&gt;
&lt;p&gt;That’s all. Now when a team member makes a Git push to master, the master branch is build, tested, and the client is deployed to an Azure Website and the backend is deployed to an IIS7.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Verify Your Guards With AutoFixture</title>
   <link href="http://madstt.dk/verify-your-guards-with-autofixture/"/>
   <updated>2013-05-13T16:56:14+00:00</updated>
   <id>http://madstt.dk/verify-your-guards-with-autofixture</id>
   <content type="html">&lt;p&gt;An important tool in leveraging loosely-coupled components is using &lt;a href=&quot;https://en.wikipedia.org/wiki/Dependency_injection&quot;&gt;dependency injection (DI)&lt;/a&gt;. A common and wide-spread approach to DI is using constructor injection. Basically, when using constructor injection, all dependencies are injected as parameters through your constructors. This allows strong-typed dependency declarations. It is good practice to follow the &lt;a href=&quot;http://xunitpatterns.com/Guard%20Assertion.html&quot;&gt;Guard Assertion pattern&lt;/a&gt; or Guard Clause pattern, like this:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:907ca5c8-bbfa-438e-a0e6-a4485f0728b3&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; Service(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; service1, &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; service2)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; (service1 == &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ArgumentNullException&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #a31515;&quot;&gt;&quot;service1&quot;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; (service2 == &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;        &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ArgumentNullException&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #a31515;&quot;&gt;&quot;service2&quot;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;These guard clauses makes sure that the injected dependencies are in a useful state.&lt;/p&gt;
&lt;p&gt;For a long time I have been testing all my guard clauses through my unit tests. I’ve been having discussions with co-workers and associates about the necessity of testing guard clauses. Their argument is that by definition the CLR will throw the ArgumentNullException, it is part of the framework. My argument is that we cannot foresee how this code will be used or refactored in the future. So, to avoid a future situation where the injected dependencies are not verified, I’ll keep testing my guard clauses. Up until now I have done this like this:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f4df29ca-869e-44bb-9b6b-fb46fa7c6863&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; Service1IsNullThrowsException()&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Assert&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;.Throws&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ArgumentNullException&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;(() =&amp;gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;        &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;, _service2Mock));&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Test&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;]&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; Service2IsNullThrowsException()&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Assert&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;.Throws&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ArgumentNullException&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;(() =&amp;gt; &lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;        &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(_service1Mock, &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;));&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For each of our constructors and each of their parameters I used to verify whether my guard clauses are in place. This is a very tedious and trivial task. Another pain of having these tests is that they are very brittle and &lt;em&gt;will &lt;/em&gt;lead to a maintenance hell. I therefore had a chat with &lt;a href=&quot;http://blog.ploeh.dk/about.html&quot;&gt;Mark Seemann&lt;/a&gt; at Danish Developers Conference 2013. He made an excellent session on writing maintainable unit tests. I asked him whether he was testing his guard clauses, and how he did that. His answer was that he was testing them, but got tired of writing tests for all permutations of these scenarios. He therefore implemented this functionality into &lt;a href=&quot;https://github.com/AutoFixture&quot;&gt;AutoFixture&lt;/a&gt;, or more like into an extension. AutoFixture is an important, if not the most important, tool in my TDD toolbox. It keeps surprising me with new features, and new  ways to optimize my TDD endeavors. Check out my &lt;a href=&quot;http://madstt.dk/customizations-with-autofixture/&quot;&gt;recent post&lt;/a&gt; on AutoFixture.&lt;/p&gt;
&lt;p&gt;AutoFixture has this very cool and, maybe, a little overseen extension called &lt;a href=&quot;https://nuget.org/packages/AutoFixture.Idioms&quot;&gt;Idioms&lt;/a&gt;. It is an extension for idiomatic unit tests, that would be unit tests that keep using common templates. I have just realized this extension, and my first discovery is the GuardClauseAssertion class. This class can be used to test all constructors and all its parameters, to verify whether there is missing a guard clause in any of these. This is how my previous test methods would be replaced using the GuardClauseAssertion class:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:57ae44e2-4982-44a4-8c45-49a6a97c67a8&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; assertion = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;GuardClauseAssertion&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(fixture);&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;assertion.Verify(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;typeof&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;).GetConstructors());&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Using reflection all constructors and all their parameters are verified to make sure that guard clauses are in place. See, my maintenance hell just vanished. Awesome!&lt;/p&gt;
&lt;p&gt;On a side-note, the Verify method will provide you with a quite detailed exception message if any constructor argument in any constructor is lacking a guard clause, like this:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: 'Courier New';&quot;&gt;Ploeh.AutoFixture.Idioms.GuardClauseException : An attempt was made to assign the value null to the parameter &quot;service1&quot; of the method &quot;.ctor&quot;, and no Guard Clause prevented this. Are you missing a Guard Clause?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So, no more excuses not to set up guard clauses for your dependencies.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Danish Developer Conference 2013</title>
   <link href="http://madstt.dk/danish-developer-conference-2013/"/>
   <updated>2013-03-20T21:03:40+00:00</updated>
   <id>http://madstt.dk/danish-developer-conference-2013</id>
   <content type="html">&lt;p&gt;The upcoming &lt;a href=&quot;http://ddc2013.azurewebsites.net/&quot;&gt;Danish Developer Conference 2013&lt;/a&gt; (DDC) is my first conference this year. I attended DDC last year, which was the first time that Microsoft Denmark arranged. I thought it was a great success, and delighted to see that Microsoft will setup another round of DDC.&lt;/p&gt;
&lt;p&gt;This year my employer, &lt;a href=&quot;http://www.d60.dk&quot;&gt;d60&lt;/a&gt;, will be coffee sponsor and will have a coffee bar with a barista. Sponsored coffee cups and flyers are ready. I’ve been given the great honor of managing the d60 Twitter account, &lt;a href=&quot;https://twitter.com/d60dk&quot;&gt;@60dk&lt;/a&gt;. So, tune in and follow &lt;a href=&quot;https://twitter.com/d60dk&quot;&gt;@d60dk&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As with other conferences these days, Windows 8 is a primary focus area. At the moment I can’t see myself developing any Windows 8 specific applications, therefore I’ll keep my focus elsewhere for now. Fortunately DDC also has great content for attendees like me.&lt;/p&gt;
&lt;p&gt;First of is the keynote. Last year it was &lt;a href=&quot;https://twitter.com/johnsheehan&quot;&gt;John Sheehan&lt;/a&gt; who held the keynote on Windows 8 and Visual Studio 2011 (2012). This years keynote is held by &lt;a href=&quot;https://twitter.com/jongalloway&quot;&gt;Jon Galloway&lt;/a&gt;, who will talk over the topic of “The Development Landscape Is Moving Extremely! Here’s How To Move Faster”. Exiting headline, looking forward.&lt;/p&gt;
&lt;p&gt;In the first session &lt;a href=&quot;https://twitter.com/mkristensen&quot;&gt;Mads Kristensen&lt;/a&gt;, whom I met at last years &lt;a href=&quot;http://www.devconnections.com/&quot;&gt;DevConnections&lt;/a&gt;, will provide a session on Visual Studio 2012 vNext. Mads is a cool guy and a great speaker. His work on Web Essentials has been of great benefit to all web developers.&lt;/p&gt;
&lt;p&gt;After lunch I’ll head over to hear &lt;a href=&quot;https://twitter.com/gudmundurh&quot;&gt;Gudmundur Hreidarson&lt;/a&gt;, giving a talk on single page apps. A topic that I’ve only glanced shortly, so perhaps Gudmundur can reignite my interest in SPAs.&lt;/p&gt;
&lt;p&gt;In the third session, &lt;a href=&quot;https://twitter.com/kasperholdum&quot;&gt;Kasper Holdum&lt;/a&gt;, will give a talk about async and reactive extensions (Rx). We’re using reactive extensions on the project that I’m currently assigned. It’s just amazing to see the possibilities of Rx, and how it can change the way we code async. This is a session that I’m particularly looking forward for.&lt;/p&gt;
&lt;p&gt;In the fourth, and last session, before the closing keynote, &lt;a href=&quot;https://twitter.com/ploeh&quot;&gt;Marc Seemann&lt;/a&gt; will give an advanced unit testing talk. Marc wrote a great book on &lt;a href=&quot;http://www.amazon.com/Dependency-Injection-NET-Mark-Seemann/dp/1935182501&quot;&gt;Dependency Injection in .Net&lt;/a&gt;, which I encourage all serious developers to read, the sooner the better. But Marc also lately published some nice Pluralsight couses on Inside-Out TDD. Faithful readers of this blog knows that I’m a profound TDD practitioner, so hopefully Marc can add additional aspects to my TDD toolbox.&lt;/p&gt;
&lt;p&gt;I’m looking forward for the sessions, but also to some of my fellow developers for networking.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Customizations with AutoFixture</title>
   <link href="http://madstt.dk/customizations-with-autofixture/"/>
   <updated>2013-02-25T18:17:50+00:00</updated>
   <id>http://madstt.dk/customizations-with-autofixture</id>
   <content type="html">&lt;blockquote&gt;I’m profound advocate for &lt;a href=&quot;http://https://en.wikipedia.org/wiki/Test-driven_development&quot;&gt;Test-Driven Development&lt;/a&gt; (TDD). I don’t regard myself as a TDD expert, but I’m getting more and more used to the TDD “lifecycle”:&lt;/p&gt;
&lt;p align=&quot;center&quot;&gt;&lt;img src=&quot;assets/9k=&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;There are several advantages to adopting this approach and its beyond the scope of this blog post in particular, I will definitely write an entire blog post on TDD at some point.&lt;/p&gt;
&lt;p&gt;When I apply the TDD “lifecycle”, I use a number of tools, which support and ease the lifecycle. I mainly use the &lt;a href=&quot;http://www.nunit.org/&quot;&gt;NUnit&lt;/a&gt; test framework, I have spiked in &lt;a href=&quot;https://xunit.codeplex.com/&quot;&gt;xUnit&lt;/a&gt;, but still stick to NUnit as my primary test framework. An indispensable tool when unit testing is a mocking framework, I have used &lt;a href=&quot;https://code.google.com/p/moq/&quot;&gt;Moq&lt;/a&gt; for a couple years, after leaving &lt;a href=&quot;http://www.hibernatingrhinos.com/oss/rhino-mocks&quot;&gt;Rhino Mocks&lt;/a&gt;. They are both great dynamic mocking frameworks, and a must. The last, but not least, primary tool in my TDD toolbox is &lt;a href=&quot;https://github.com/AutoFixture&quot;&gt;AutoFixture&lt;/a&gt;. Its one of my favorite frameworks, and I almost can’t TDD without it. For those of you not familiar with AutoFixture, I’ll give you short intro.&lt;/p&gt;
&lt;p&gt;AutoFixture creates dummy data for your unit tests, so it can be a real time saver. A simple string can be created like this:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:59dd9b41-8ac3-4d82-872a-fce583fc183f&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyString = fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The result would be a string with a value like this: “a3cb054d-dbb3-4d97-85be-b11e06784f97&quot;.&lt;/p&gt;
&lt;p&gt;Likewise you can generate integers. You can generate a finite number of strings:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:99880beb-3688-4091-9b9e-0eb11d5573cf&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyString = fixture.CreateMany&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This would create the as many strings as the fixture.RepeatCount is set to, by default it is set to three. You can also modify the count inline:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c8278fbe-5863-43bd-af1f-fef51603d7b7&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyString = fixture.CreateMany&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;(5);&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This would create five dummy strings. If you need to add dummy data to a list:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:be0ce79e-8e81-467a-b2ca-433ff511c5b4&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; strings = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;fixture.AddManyTo(strings, 5);&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This would add five dummy strings to the ‘strings’ list. The power of AutoFixture is that it can also generate dummy objects from your complex classes:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c099b916-bda0-4dd3-8f0d-4e8c62454641&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyMyClass = fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So if my complex class had any public properties like strings, these would be assigned a dummy value. Sometimes it might also be great to set a known value for a property:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d82a613a-6787-4a2a-8eb3-1e514069f0d0&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyMyClass = fixture.Build&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;().With(myClass =&amp;gt; myClass.Name, &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #a31515;&quot;&gt;&quot;Mads&quot;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There are many more nifty stuff that AutoFixture can help you with, but I’m going to drag you all the way around. For the remaining part of this blog post I’ll focus on how to customize the generation of dummy test data.&lt;/p&gt;
&lt;p&gt;There are multiple ways to customize how AutoFixture generates its values. A simple approach to customize the string generation:&lt;/p&gt;&lt;/blockquote&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:280044ef-b09b-4f78-a9bd-afdab4b36dfa&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; seededString = fixture.Build&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;().FromSeed(s =&amp;gt; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #a31515;&quot;&gt;&quot;foo&quot;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;).CreateAnonymous();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One piece of dummy data that always takes time is lists. As we learned above we can generate a dummy list in AutoFixture like this:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:272dfed1-8db3-42de-b506-e35673528956&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyList = fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;AutoFixture generates the list for you, but the list is empty. We would have preferred a list of MyClass instances, therefore a small customization is needed:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e4bdbdd2-5d06-4fd6-aaa4-75e5fbc49a0a&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;().Customize(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MultipleCustomization&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;());&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyList = fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Adding an instance of the MultipleCustomization (line 1), would generate a list of 3 MyClass objects, with a dummy Name string. Remember, three is the default number for AutoFixture. Assume that you have a child class inside your parent class:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ba1eb5db-9596-4e26-8556-a23571168732&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyParentClass&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; ParentName { &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; }&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyChildClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; Child { &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyChildClass&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; ChildName { &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; }&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Generating a list of MyParentClass:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1afd8eee-2246-413d-86cc-a378496ef232&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;().Customize(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MultipleCustomization&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;());&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyList = fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyParentClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Would give me a list of 3 MyParentClass, with dummy string ParentName and a dummy MyChildClass, with a dummy string ChildName.&lt;/p&gt;
&lt;p&gt;One more thing before jumping into handling abstractions, lets assume that we would like to a list of MyChildClass inside MyParentClass (line 4):&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8942472a-672f-4f49-8b28-226f048c78e9&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyParentClass&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; ParentName { &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; }&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyChildClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt; Children { &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyChildClass&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; ChildName { &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; }&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This gives me a list of 3 MyParentClass where each has a list of three MyChildClass objects. Remember we can change the number of list items by changing the RepeatCount on the Fixture instance. In some scenarios it might be necessary to change only one of the counts. This is done by using the Register method:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:061803e2-9268-44a8-b2e1-f1caf2688bad&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;().Customize(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MultipleCustomization&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;());&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;fixture.Register(() =&amp;gt; fixture.CreateMany&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyChildClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;(5));&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyList = fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyParentClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now we have a list of three MyParentClass where each has a list of five MyChildClass. This means that every time the fixture needs to generate a list of MyChildClass, it would use the anonymous method in line 2.&lt;/p&gt;
&lt;p&gt;So, abstractions. By default you can’t do something like this:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:09a1a9c4-38d8-4e1f-8ca1-3d022322efbc&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyAbstraction = fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService1&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;AutoFixture would throw an exception at you. AutoFixture is not able to create an instance of this interface without a constructor. So you can provide a fake instance, all it requires is that it implements the IService1 interface and then register it to the Fixture:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0d9e3aec-0cdd-491d-9ed0-572f815256d6&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;fixture.Register&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService1&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;(() =&amp;gt; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;FakeService&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;());&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyService = fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService1&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now AutoFixture is able to create a dummy version of your FakeService.&lt;/p&gt;
&lt;p&gt;I’m a big fan of dependency injection and make heavily use of &lt;a href=&quot;https://en.wikipedia.org/wiki/Inversion_of_control&quot;&gt;IoC&lt;/a&gt; containers. See my previous post on &lt;a href=&quot;http://madstt.dk/dependency-injection-and-me/&quot;&gt;dependency injection&lt;/a&gt; and me. Especially constructor injection is used everywhere.&lt;/p&gt;
&lt;p&gt;This often forces me to write a lot of mocking data for all my dependencies, which can be a real time killer:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c30f9c05-0444-4f27-ba03-14cb0bec97b2&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; sut = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ServiceToTest&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService1&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;().Object, &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService2&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;().Object, &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService3&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;().Object)&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is just a simple example, sometimes there a many more dependencies. The usual approach with Moq is to set expectations like this:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9327d12c-59ea-42a9-b23b-c9599796a1a7&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; mock = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService2&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;mock.Setup(service2 =&amp;gt; service2.DoStuff()).Returns(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #a31515;&quot;&gt;&quot;foo&quot;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; sut = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ServiceToTest&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService1&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;().Object, mock.Object,&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;                            &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService3&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;().Object);&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This approach is completely fine, but it can be a time killer with a lot of “empty” mocks. Therefore I recently discovered that AutoFixture has an &lt;a href=&quot;http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx&quot;&gt;extension using Moq&lt;/a&gt;. The way it works is that it uses Moq as a fallback mechanism, by relaying request for creating an abstraction to Moq. I can then refactor the above to the following:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:106b101f-0e38-4ceb-bd26-b17f4f10ef14&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;().Customize(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;AutoMoqCustomization&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;());&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; mock = _fixture.Freeze&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Mock&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IService2&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;mock.Setup(service2 =&amp;gt; service2.DoStuff()).Returns(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #a31515;&quot;&gt;&quot;foo&quot;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;);&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; sut = _fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;ServiceToTest&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cool, right? In line 1, a new customization is added. This extension is part of AutoMoq extension, available via a &lt;a href=&quot;https://nuget.org/packages/AutoMoq/&quot;&gt;Nuget&lt;/a&gt;. As usual, AutoFixture creates an instance of the ServiceToTest, bet ServiceToTest takes three dependencies through constructor injection. AutoFixture cannot figure out to create instances of these, they are relayed to Moq. Since I need to set expectations on IService2, I can freeze a variable in the AutoFixture framework, and bypass default behavior for creating instances.&lt;/p&gt;
&lt;p&gt;This is a great extension to AutoFixture. combining the mocking features of Moq for supporting auto mocking is great. Since Moq was added, a number of other mocking frameworks has been, &lt;a href=&quot;https://nuget.org/packages/AutoFixture.AutoFakeItEasy&quot;&gt;AutoFakeItEasy&lt;/a&gt;, &lt;a href=&quot;https://nuget.org/packages/AutoFixture.AutoRhinoMocks&quot;&gt;AutoRhinoMocks&lt;/a&gt;, and &lt;a href=&quot;https://nuget.org/packages/AutoFixture.AutoNSubstitute&quot;&gt;AutoNSubstitute&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Oh, one more thing. Consider the following class:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ddee8d69-e2a6-4937-8a01-95afdfddbd3b&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyParentClass&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; ParentName { &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; }&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;    &lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IMyChildClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt; Children { &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;; }&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;interface&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;IMyChildClass&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;{&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;}&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Okay, I described such class above, the difference is that it is now a list of interfaces. Remember, lists of concrete instances can be created by using the MultipleCustomizations, and interfaces can be created by using the AutoMoqCustomization, so we need to combine the two. This is done by CompositeCustomization:&lt;/p&gt;
&lt;div id=&quot;scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:41d1f041-955f-49fd-974c-daed50969147&quot; class=&quot;wlWriterEditableSmartContent&quot; style=&quot;margin: 0px; display: inline; float: none; padding: 0px;&quot;&gt;
&lt;div style=&quot;border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;background: #ddd; max-height: 300px; overflow: auto;&quot;&gt;
&lt;ol style=&quot;background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;&quot; start=&quot;1&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; fixture = &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;Fixture&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;().Customize(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;CompositeCustomization&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MultipleCustomization&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;(), &lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;AutoMoqCustomization&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;()));&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;background: #f3f3f3;&quot;&gt;&lt;span style=&quot;background: #ffffff; color: #0000ff;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt; dummyClass = _fixture.CreateAnonymous&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #2b91af;&quot;&gt;MyChildClass&lt;/span&gt;&lt;span style=&quot;background: #ffffff; color: #000000;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This customization combines the two, and creates an instance of MyParentClass, with a list of three MyChildClass instances. Sooo, neat.&lt;/p&gt;
&lt;p&gt;That’s it for now. Throw a comment at me, and tell me your AutoFixture niftiest.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Living with a Kindle</title>
   <link href="http://madstt.dk/living-with-a-kindle/"/>
   <updated>2013-01-21T18:53:34+00:00</updated>
   <id>http://madstt.dk/living-with-a-kindle</id>
   <content type="html">&lt;p&gt;In a previous &lt;a href=&quot;http://madstt.dk/buying-a-kindle/&quot;&gt;post&lt;/a&gt; I described the process and my considerations when buying a Kindle. In this post I’ll provide some you with some of my experiences with my Kindle.&lt;/p&gt;
&lt;p&gt;I’ve had my Kindle since mid-October 2012, and I cant imagine living without. It has indeed increased my everyday professional productivity. I carry my Kindle everywhere. Every time I find a second, a minute or two, I read in my Kindle. Whenever I’m waiting for the remaining participants of a meeting to arrive, waiting in waiting´-room at the dentist, or on the bus or train. I’ve always felt that I needed some hours every day, to be able to catch up on all the new stuff evolving in the software industry. Having multiple sources right at my hand, basically everywhere I go, suits perfectly into my professional productivity.&lt;/p&gt;
&lt;p&gt;So, what do I read on my Kindle? I like to read on different sources in parallel. So I have both fiction books, tech books, blog posts, and magazines. I can therefore pick whatever suits the situation. Easy read sources such as magazines and blog posts are read when time and noise is an issue. Books are used when there is time to focus and really get in-depth.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The books I read are bought from &lt;a href=&quot;http://www.amazon.co.uk/Kindle-eBooks/b/ref=sa_menu_kbo3?ie=UTF8&amp;amp;node=341689031&quot;&gt;Amazon&lt;/a&gt;, &lt;a href=&quot;http://www.manning.com/&quot;&gt;Manning&lt;/a&gt;, and &lt;a href=&quot;https://da.riidr.com/&quot;&gt;Riidr&lt;/a&gt; (a site with mainly Danish ebooks). Some of these sites support sending the books directly to your Kindle through Amazon’s &lt;a href=&quot;http://www.amazon.com/gp/help/customer/display.html/ref=hp_pdoc_main_short_us?nodeId=200767340&quot;&gt;Personal Document Service&lt;/a&gt;. This is a service provided by Amazon to prevent spam from reaching your Kindle. On your Amazon account, there is a Personal Document Settings page, where you supply Amazon with approved email addresses of the sites you want to receive books from. After providing Amazon with approved email address, you provide the book store with your unique Kindle email address. Then the books you’ve bought is seamlessly sent to your Kindle. All you have to do is turn on WiFi on your Kindle, and it downloads your purchased content. This is a great feature. I use it for almost everything. Let me provide some examples. Books bought from Amazon is sent to you this way, so after completing the your purchase on the website, you can turn on WiFi, and there is your book, just a few seconds after you bought it. You don’t have to consider shipping, customs, etc. The first time you use this feature, you’re just amazed of the simplicity. Amazon keeps a record of all your purchases, so you’ll be able to download them again. Also, other personal documents sent to your Kindle is stored at Amazon. So, this includes books from Manning and Riidr.&lt;/p&gt;
&lt;p&gt;I have also approved my Gmail address, so I can send larger emails that I don’t have time to read during the day.&lt;/p&gt;
&lt;p&gt;And &lt;a href=&quot;http://www.instapaper.com&quot;&gt;Instapaper&lt;/a&gt;. I’m a huge fan of Instapaper. Instapaper provides a great service for collecting and sending content to Kindles. All you have to do is create an Instapaper account and use a bookmarklet for your favorite browser. Whenever you see a blog post, or larger article, that you don’t have time to read, you click the bookmarklet, and the content is stripped for images, videos, so that only written content is stored at your Instapaper account. When I come across some interesting stuff on Twitter, I click the Read Later bookmarklet. On your Instapaper account settings page you supply your Kindle email address, and as described above, you provide your unique Instapaper email address to the Amazon site. Then you setup when Instapaper should sent you the latest content. I’ve setup mine to send the latest content to my Kindle everyday at 4 PM. Scott Hanselman also wrote a &lt;a href=&quot;http://www.hanselman.com/blog/InstapaperDeliveredToYourKindleChangesHowYouConsumeWebContentPlusIFTTTBlogsAndMore.aspx&quot;&gt;blog post&lt;/a&gt; on this setup. Instapaper is also a great tool if you’re Google Reader fan.&lt;/p&gt;
&lt;p&gt;So when I get home and have the time, I turn on WiFi, and bang there is my content, from all my sources. The Instapaper content is formatted into newspaper like format, and easy to navigate.&lt;/p&gt;
&lt;p&gt;The reading experience on the Kindle is phenomenal. This e-ink technology is brilliant. It’s a pleasure looking at a screen that is not backlit, if you, as I do, sit in front of an LCD all day long. I bought the regular Kindle, so the 6&quot; screen is perfect in weight and size for reading everywhere. The navigation is great, although I would have appreciated a better browser experience, but on the other hand its not an iPad, its a Kindle, made for reading ebooks. Battery lifetime is great. A full recharge keeps battery for approximately a month, with daily usage and with WiFi disabled. It then takes a couple of hours of recharge, and its fully recharged.&lt;/p&gt;
&lt;p&gt;Sometimes you might have PDFs from other sources, that don’t support the wireless ecosystem. I then use a nice application called &lt;a href=&quot;http://calibre-ebook.com/&quot;&gt;Calibre&lt;/a&gt;. Calibre is an ebook management tool. Its able to connect to several ebook readers, and is able to convert from PDF to .mobi, which is the format for ebooks on the Kindle. The Kindle is able to read PDFs, but it lacks several great features, such as a navigational TOC and chapters bookmarks.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I’m a happy Kindle user. It fits into my personal productivity setup. So far I don’t regret that I bought the Kindle, and I can only recommend others to do the same.Throw my a comment on your experiences with the Kindle.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Is MEF a DI Container?</title>
   <link href="http://madstt.dk/is-mef-a-di-container/"/>
   <updated>2012-12-04T06:21:19+00:00</updated>
   <id>http://madstt.dk/is-mef-a-di-container</id>
   <content type="html">&lt;p&gt;A couple of weeks ago I read this &lt;a href=&quot;http://code-magazine.com/Article.aspx?quickid=1210031&quot;&gt;article&lt;/a&gt; in Code Magazine about dependency injection (DI), and they mentioned the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd460648.aspx&quot;&gt;Managed Extensibility Framework&lt;/a&gt; (MEF) as a DI container. I never thought of MEF as DI container, so I thought, let’s take it for a spin.&lt;/p&gt;
&lt;h2&gt;Managed Extensibility Framework&lt;/h2&gt;
&lt;p&gt;So Microsoft coins MEF as a library for creating lightweight, extensible applications. It provides developers the tools for discovering and using extensions with no configuration required. Developers creating extensions are given tools for easily encapsulating code and avoiding hard fragile dependencies. &lt;/p&gt;
&lt;p&gt;MEF is providing support for components to discover other components implicitly, via composition. A MEF component, called a &lt;em&gt;part&lt;/em&gt;, declaratively defines its &lt;em&gt;imports &lt;/em&gt;and &lt;em&gt;exports. &lt;/em&gt;The imports are its dependencies, while the exports are its capabilities that the components makes available. When a part is created the MEF composition engine will resolve its imports, with what is available from other parts. Doing this declaratively makes them discoverable at runtime, this avoids hard-coded references and fragile configuration files.&amp;nbsp; By adding metadata MEF allows tagging of extensions for querying and filtering. Since there is no hard dependency on a particular assembly, extensions can be used across multiple assemblies.&lt;/p&gt;
&lt;p&gt;So lets take a look at simple example. I’ve created a simple calculator to display the basics of MEF. You can find the source code at &lt;a href=&quot;https://github.com/madstt/FunWithMEF&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The Program class holds an ICalculator property:&lt;/p&gt;
&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; [Import(&lt;span style=&quot;color: #0000ff&quot;&gt;typeof&lt;/span&gt; (ICalculator))] &lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;private&lt;/span&gt; ICalculator Calculator;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This means that the Program class requires one, exactly one, implementation of ICalculator. Every import has a contract, which determines what exports it will be matched with. In this case I have specified it explicitly with a string.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The calculator class is declared with the Export attribute with type of ICalculator, saying that this class offers an implementation of the ICalculator interface:&lt;/p&gt;
&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; [Export(&lt;span style=&quot;color: #0000ff&quot;&gt;typeof&lt;/span&gt;(ICalculator))]&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;class&lt;/span&gt; Calculator : ICalculator&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;p&gt;.csharpcode, .csharpcode pre&lt;br /&gt;
{&lt;br /&gt;
	font-size: small;&lt;br /&gt;
	color: black;&lt;br /&gt;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;
	background-color: #ffffff;&lt;br /&gt;
	/*white-space: pre;*/&lt;br /&gt;
}&lt;br /&gt;
.csharpcode pre { margin: 0em; }&lt;br /&gt;
.csharpcode .rem { color: #008000; }&lt;br /&gt;
.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;
.csharpcode .str { color: #006080; }&lt;br /&gt;
.csharpcode .op { color: #0000c0; }&lt;br /&gt;
.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;
.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;
.csharpcode .html { color: #800000; }&lt;br /&gt;
.csharpcode .attr { color: #ff0000; }&lt;br /&gt;
.csharpcode .alt&lt;br /&gt;
{&lt;br /&gt;
	background-color: #f4f4f4;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	margin: 0em;&lt;br /&gt;
}&lt;br /&gt;
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;div class=&quot;csharpcode&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;p&gt;In order for Calculator to be extensible, it needs to import a list of operations. An ordinary &lt;font color=&quot;#000000&quot;&gt;Import&lt;/font&gt; attribute is filled by one and only one &lt;font color=&quot;#000000&quot;&gt;Export&lt;/font&gt; attribute. If more than one is available, the composition engine produces an error. To create an import that can be filled by any number of exports, you can use the &lt;font color=&quot;#000000&quot;&gt;ImportMany&lt;/font&gt; attribute:&lt;/p&gt;
&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; [ImportMany]&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; IEnumerable&amp;lt;Lazy&amp;lt;IOperation, IOperationData&amp;gt;&amp;gt; operations;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Lazy&amp;lt;T, TMetadata&amp;gt; is a type provided by MEF to hold indirect references to exports. Here, in addition to the exported object itself, you also get export metadata, or information that describes the exported object. Each Lazy&amp;lt;T, TMetadata&amp;gt; contains an IOperation object, representing an actual operation, and an IOperationData object, representing its metadata.&lt;/p&gt;
&lt;p&gt;So lets implement the first operation:&lt;/p&gt;
&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; [Export(&lt;span style=&quot;color: #0000ff&quot;&gt;typeof&lt;/span&gt;(IOperation))]&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; [ExportMetadata(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Symbol&quot;&lt;/span&gt;, &lt;span style=&quot;color: #006080&quot;&gt;'+'&lt;/span&gt;)]&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;class&lt;/span&gt; Add : IOperation&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt; {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; Operate(&lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; left, &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; right)&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt;         &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; left + right;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum9&quot;&gt;   9:&lt;/span&gt; }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Again, the Add class exports an implementation of the IOperation interface. Additionally I’ve added the ExportMetadata attribute. This attribute will attach metadata, in the form of a name-value pair, to this export.&lt;/p&gt;
&lt;p&gt;Finally, a small piece of calculator logic:&lt;/p&gt;
&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;string&lt;/span&gt; Calculate(&lt;span style=&quot;color: #0000ff&quot;&gt;string&lt;/span&gt; input)&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; left;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; right;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt;     var fn = FindFirstNonDigit(input);&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (fn &amp;lt; 0)&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt;     {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum9&quot;&gt;   9:&lt;/span&gt;         &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #006080&quot;&gt;&quot;Could not parse command.&quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum10&quot;&gt;  10:&lt;/span&gt;     }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum11&quot;&gt;  11:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum12&quot;&gt;  12:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;try&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum13&quot;&gt;  13:&lt;/span&gt;     {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum14&quot;&gt;  14:&lt;/span&gt;         left = &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt;.Parse(input.Substring(0, fn));&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum15&quot;&gt;  15:&lt;/span&gt;         right = &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt;.Parse(input.Substring(fn + 1));&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum16&quot;&gt;  16:&lt;/span&gt;     }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum17&quot;&gt;  17:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;catch&lt;/span&gt; (Exception)&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum18&quot;&gt;  18:&lt;/span&gt;     {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum19&quot;&gt;  19:&lt;/span&gt;         &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #006080&quot;&gt;&quot;Could not parse command.&quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum20&quot;&gt;  20:&lt;/span&gt;     }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum21&quot;&gt;  21:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum22&quot;&gt;  22:&lt;/span&gt;     var operation = input[fn];&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum23&quot;&gt;  23:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum24&quot;&gt;  24:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;foreach&lt;/span&gt; (var i &lt;span style=&quot;color: #0000ff&quot;&gt;in&lt;/span&gt; operations.Where(i =&amp;gt; i.Metadata.Symbol.Equals(operation)))&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum25&quot;&gt;  25:&lt;/span&gt;     {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum26&quot;&gt;  26:&lt;/span&gt;         &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; i.Value.Operate(left, right).ToString(CultureInfo.InvariantCulture);&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum27&quot;&gt;  27:&lt;/span&gt;     }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum28&quot;&gt;  28:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum29&quot;&gt;  29:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #006080&quot;&gt;&quot;Operation Not Found!&quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum30&quot;&gt;  30:&lt;/span&gt; }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To wire things up MEF uses a CompositionContainer:&lt;/p&gt;
&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;private&lt;/span&gt; CompositionContainer container;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;p&gt;.csharpcode, .csharpcode pre&lt;br /&gt;
{&lt;br /&gt;
	font-size: small;&lt;br /&gt;
	color: black;&lt;br /&gt;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;
	background-color: #ffffff;&lt;br /&gt;
	/*white-space: pre;*/&lt;br /&gt;
}&lt;br /&gt;
.csharpcode pre { margin: 0em; }&lt;br /&gt;
.csharpcode .rem { color: #008000; }&lt;br /&gt;
.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;
.csharpcode .str { color: #006080; }&lt;br /&gt;
.csharpcode .op { color: #0000c0; }&lt;br /&gt;
.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;
.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;
.csharpcode .html { color: #800000; }&lt;br /&gt;
.csharpcode .attr { color: #ff0000; }&lt;br /&gt;
.csharpcode .alt&lt;br /&gt;
{&lt;br /&gt;
	background-color: #f4f4f4;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	margin: 0em;&lt;br /&gt;
}&lt;br /&gt;
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;To register the necessary types, you need to create a catalogue of types. This is usually done at the assembly level using the AggregateCatalog:&lt;/p&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;p&gt;.csharpcode, .csharpcode pre&lt;br /&gt;
{&lt;br /&gt;
	font-size: small;&lt;br /&gt;
	color: black;&lt;br /&gt;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;
	background-color: #ffffff;&lt;br /&gt;
	/*white-space: pre;*/&lt;br /&gt;
}&lt;br /&gt;
.csharpcode pre { margin: 0em; }&lt;br /&gt;
.csharpcode .rem { color: #008000; }&lt;br /&gt;
.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;
.csharpcode .str { color: #006080; }&lt;br /&gt;
.csharpcode .op { color: #0000c0; }&lt;br /&gt;
.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;
.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;
.csharpcode .html { color: #800000; }&lt;br /&gt;
.csharpcode .attr { color: #ff0000; }&lt;br /&gt;
.csharpcode .alt&lt;br /&gt;
{&lt;br /&gt;
	background-color: #f4f4f4;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	margin: 0em;&lt;br /&gt;
}&lt;br /&gt;
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;p&gt;.csharpcode, .csharpcode pre&lt;br /&gt;
{&lt;br /&gt;
	font-size: small;&lt;br /&gt;
	color: black;&lt;br /&gt;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;
	background-color: #ffffff;&lt;br /&gt;
	/*white-space: pre;*/&lt;br /&gt;
}&lt;br /&gt;
.csharpcode pre { margin: 0em; }&lt;br /&gt;
.csharpcode .rem { color: #008000; }&lt;br /&gt;
.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;
.csharpcode .str { color: #006080; }&lt;br /&gt;
.csharpcode .op { color: #0000c0; }&lt;br /&gt;
.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;
.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;
.csharpcode .html { color: #800000; }&lt;br /&gt;
.csharpcode .attr { color: #ff0000; }&lt;br /&gt;
.csharpcode .alt&lt;br /&gt;
{&lt;br /&gt;
	background-color: #f4f4f4;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	margin: 0em;&lt;br /&gt;
}&lt;br /&gt;
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; var catalog = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; AggregateCatalog();&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; catalog.Catalogs.Add(&lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; AssemblyCatalog(&lt;span style=&quot;color: #0000ff&quot;&gt;typeof&lt;/span&gt;(Program).Assembly));&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt; container = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; CompositionContainer(catalog);&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;And composing the MEF parts:&lt;/p&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;p&gt;.csharpcode, .csharpcode pre&lt;br /&gt;
{&lt;br /&gt;
	font-size: small;&lt;br /&gt;
	color: black;&lt;br /&gt;
	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;
	background-color: #ffffff;&lt;br /&gt;
	/*white-space: pre;*/&lt;br /&gt;
}&lt;br /&gt;
.csharpcode pre { margin: 0em; }&lt;br /&gt;
.csharpcode .rem { color: #008000; }&lt;br /&gt;
.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;
.csharpcode .str { color: #006080; }&lt;br /&gt;
.csharpcode .op { color: #0000c0; }&lt;br /&gt;
.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;
.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;
.csharpcode .html { color: #800000; }&lt;br /&gt;
.csharpcode .attr { color: #ff0000; }&lt;br /&gt;
.csharpcode .alt&lt;br /&gt;
{&lt;br /&gt;
	background-color: #f4f4f4;&lt;br /&gt;
	width: 100%;&lt;br /&gt;
	margin: 0em;&lt;br /&gt;
}&lt;br /&gt;
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;try&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt;     container.ComposeParts(&lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;);&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt; }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;catch&lt;/span&gt; (CompositionException exception)&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt; {&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt;     Console.WriteLine(exception.ToString());&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;
&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt; }&lt;/pre&gt;
&lt;p&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This wraps up my overall introduction to MEF, but does this qualify MEF as a DI container? &lt;/p&gt;
&lt;h2&gt;Is It a DI Container…?&lt;/h2&gt;
&lt;p&gt;This post is not suppose to be a complete outlining of what dependency injection is, or how a DI container works. People have written books on these matters. Please see my previous &lt;a href=&quot;http://madstt.dk/dependency-injection-and-me/&quot;&gt;post&lt;/a&gt; on DI. I’ll therefore be very concise, and focus on how MEF fits into the DI world.&lt;/p&gt;
&lt;p&gt;MEF was developed for a different purpose than a DI container. It’s a framework facilitating add-in support for parts. Such parts is an unknown component for a standard application. A part exposes certain interfaces, but that is all the application knows about the part. There may be zero, or multiple parts, depending on the environment. This is a key difference from a DI container, where we typically know about all, or most of, the components at compile time. We use the knowledge about components to configure the container in the applications Composition Root.&lt;/p&gt;
&lt;p&gt;Facilitating add-in requires some sort of discoverability mechanism. Usually discoverability is implemented by scanning a certain folder for assemblies to find all classes implementing the required abstraction. MEF addresses through an advanced discovery model that uses attributes to define consumers and their services. &lt;/p&gt;
&lt;p&gt;So to sum up. A fully-fledged DI container favors decoupled composition of services. This provides the greatest degree of flexibility, but it comes at a cost. As developers, we must have knowledge about the components we wish to compose at the time we configure the container. MEF favors discovery of components. This addresses the issue when we know little about the add-ins a design time. The tradeoff is that the discovery mechanism is tightly coupled with the components, so we lose some flexibility.&lt;/p&gt;
&lt;p&gt;Some proponents of MEF argues it’s a DI container, but as it, it is not. You might be able to use is as such, but out of the box it a framework for facilitating a plugin architecture.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Branching and Deployment - Good Practices</title>
   <link href="http://madstt.dk/branching-and-deploymentgood-practices/"/>
   <updated>2012-11-05T11:09:29+00:00</updated>
   <id>http://madstt.dk/branching-and-deploymentgood-practices</id>
   <content type="html">&lt;h2&gt;Feature Branches&lt;/h2&gt;
&lt;p&gt;Branching is a vital tool for all developers, working alone or in teams. The basic idea of &lt;a href=&quot;http://martinfowler.com/bliki/FeatureBranch.html&quot;&gt;feature branching&lt;/a&gt; is that when you start work on a feature,&amp;nbsp; you create a branch off of the repository and commit all the changes for the feature onto the branch and when your feature is code complete then merge the changes back.
&lt;p&gt;The advantage in using feature branches is that your main line (you might call main line ‘master’, ‘trunk’ or ‘head’ depending on the version control system you use) is kept clear of uncompleted features or bug fixes, which enables you to release software at any time because you don’t have to wait for all the features and bug fixes being worked on to be completed.
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2012/11/clip_image001.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px&quot; title=&quot;clip_image001&quot; border=&quot;0&quot; alt=&quot;clip_image001&quot; src=&quot;assets/clip_image001_thumb.png&quot; width=&quot;244&quot; height=&quot;75&quot; /&gt;&lt;/a&gt;
&lt;p&gt;If concurrent development on other branches are in progress, it is a good idea to keep in synch with the latest changes on trunk. Synching with trunk helps avoiding the 'big' merge at code complete.
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2012/11/clip_image002.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px&quot; title=&quot;clip_image002&quot; border=&quot;0&quot; alt=&quot;clip_image002&quot; src=&quot;assets/clip_image002_thumb.png&quot; width=&quot;244&quot; height=&quot;111&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;Test And Deployment Branches&lt;/h2&gt;
&lt;p&gt;The advantages mentioned above for feature branches, is also evident for test and deployment branches. We would like to isolate test and production versions from the continuous development made on trunk. &lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;display: block; float: none; margin-left: auto; margin-right: auto&quot; alt=&quot;Multiple release branches&quot; src=&quot;assets/vcd_release.png&quot; /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Every time a version is released to production it is versioned on its own branch. Should there occur any issues or hot fixes to any releases, these are made on the release branch and changes are merged back into trunk. &lt;/p&gt;
&lt;p&gt;A test branch holds an isolated version that is currently being tested either by QA or business. Again, should there occur any smaller fixes, then these should be merged back into trunk. Larger changes, or feedback from business, should be put on a separate feature branch.&lt;/p&gt;
&lt;p&gt;A good practice is to release to production from the test branch, so that the version that has been tested and verified by either QA or business, is the one being released to production. This means, that when we need to deploy to production, we merge trunk into the test branch and, when the revision is verified, we create and version a release branch from the test branch. &lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>T4 Templating without Visual Studio</title>
   <link href="http://madstt.dk/t4-templating-without-visual-studio/"/>
   <updated>2012-10-31T08:52:32+00:00</updated>
   <id>http://madstt.dk/t4-templating-without-visual-studio</id>
   <content type="html">&lt;p&gt;I’m currently appointed to an older project to make some new features. I soon realized that this project is developed in a pre-Nuget era, so all dependencies were copied into a 3rd party folder and included in source control. The entire solution includes 29 projects, so there were a larger number of dependencies to this solution. I decided to get rid of all the dependencies that is available on Nuget. These included &lt;a href=&quot;http://nuget.org/packages/nhibernate&quot;&gt;NHibernate&lt;/a&gt;, &lt;a href=&quot;http://nuget.org/packages/MvvmLight&quot;&gt;MVVM Light&lt;/a&gt;, &lt;a href=&quot;http://nuget.org/packages/log4net&quot;&gt;log4net&lt;/a&gt;, &lt;a href=&quot;http://nuget.org/packages/Castle.Windsor&quot;&gt;Castle Windsor&lt;/a&gt;, &lt;a href=&quot;http://nuget.org/packages/AutoMapper/2.2.0&quot;&gt;Auto Mapper&lt;/a&gt;, &lt;a href=&quot;http://nuget.org/packages/RhinoMocks&quot;&gt;Rhino Mocks&lt;/a&gt;, &lt;a href=&quot;http://nuget.org/packages/NUnit&quot;&gt;NUnit&lt;/a&gt;, and the &lt;a href=&quot;http://nuget.org/packages/SilverlightToolkit-Input&quot;&gt;Silverlight Toolkit&lt;/a&gt;. I noticed that the Silverlight Toolkit is available as individual components, instead of just installing them all. It took a few hours to get all dependencies to work across the solution, but pretty trivial. Besides these dependencies, there was a dependency to Texttransform.exe. &lt;/p&gt;
&lt;h2&gt;T4 Templating and Visual Studio&lt;/h2&gt;
&lt;p&gt;Texttransform.exe is part of T4 templating and is installed together with Visual Studio. In this case a developer has copied the Texttransform.exe from the its default installation path in \Program Files (x86)\Common Files\Microsoft Shared\Text Templating\ to the 3rd party folder in the solution folder. The problem with this approach is that the version in the solution folder is the Visual Studio 2010 version. Running Texttransform.exe from Visual Studio 2012, provides an error. I therefore removed the copy from the solution folder and wrote a relative path in the pre-build event to the default installation. &lt;/p&gt;
&lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&quot;%COMMONPROGRAMFILES(x86)%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe&quot;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;The $(VisualStudioVersion) variable provides the current version of Visual Studio, so this approach works on both Visual Studio 2010 and Visual Studio 2012.&lt;/p&gt;
&lt;p&gt;I’m not going to cover T4 templating in detail in this post, but I recommend reading &lt;a href=&quot;http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx&quot;&gt;Scott Hanselman’s post&lt;/a&gt; on this issue. Basically, T4 is code generation. It can generate all kinds of text files, not just code. &lt;/p&gt;
&lt;p&gt;Since T4 is installed together with Visual Studio, it gives us quite a challenge to get this to work with Team Foundation Server (TFS) (which is the management decision of source control at my current employer), since the $(VisualStudioVersion) variable is not present on the build server.&lt;/p&gt;
&lt;h1&gt;T4 Templating and Team Foundation Server&lt;/h1&gt;
&lt;p&gt;To get the necessary dlls I needed to install the &lt;a href=&quot;http://www.microsoft.com/en-us/download/details.aspx?id=30668&quot;&gt;Visual Studio SDK 2012&lt;/a&gt; on my development machine and the copy the following files to the build server:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;\Program Files (x86)\Microsoft Visual Studio 11.0\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\
&lt;ul&gt;
&lt;li&gt;Microsoft.VisualStudio.TextTemplating.11.0.dll  &lt;/li&gt;
&lt;li&gt;Microsoft.VisualStudio.TextTemplating.Interfaces.11.0.dll  &lt;/li&gt;
&lt;li&gt;Microsoft.VisualStudio.TextTemplating.VSHost.11.0.dll&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v11.0\TextTemplating\
&lt;ul&gt;
&lt;li&gt;Microsoft.VisualStudio.TextTemplating.Sdk.Host.11.0.dll&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;\Program Files(x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\
&lt;ul&gt;
&lt;li&gt;Microsoft.VisualStudio.TextTemplating.Modeling.11.0.dll&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;\Program Files(x86)\Common Files\microsoft shared\TextTemplating\11.0\
&lt;ul&gt;
&lt;li&gt;TextTransform.exe  &lt;/li&gt;
&lt;li&gt;TextTransform.ico&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is important to keep the same directory hierarchy. Due to these issues with T4 Templating and TFS, Microsoft has changed their EULA for Visual Studio making it license-wise legal to copy the files to a build server.&lt;/p&gt;
&lt;p&gt;Without making too much custom TFS handling of this, I going to the send the VisualStudioVersion variable, mentioned above, to the TFS from Visual Studio through a MSBuild argument. This is done in your Build Definition, under the Process tab, like this:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://madstt.dk/wp-content/uploads/2012/10/image.png&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;assets/image_thumb.png&quot; width=&quot;569&quot; height=&quot;145&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now TFS is able to find texttransform.exe and do the T4 templating.&lt;/p&gt;
&lt;p&gt;Instead of this kind of hack, MSBuild ought to support T4 templating natively. Like MSBuild is able to perform configuration transformations, it should support T4 templating as well.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Dependency Injection and Me</title>
   <link href="http://madstt.dk/dependency-injection-and-me/"/>
   <updated>2012-10-15T17:25:11+00:00</updated>
   <id>http://madstt.dk/dependency-injection-and-me</id>
   <content type="html">&lt;p&gt;From time to time I look into my toolbox to see which tools I use the most. With almost 8 years of software development experience, I’ve learned that constantly sharpening the knives of your toolbox and adding new tools, is what makes you a great developer. If I were to highlight one of my favorite tools in the box, the tool that just makes me smile every time I use it, it must be dependency injection (DI).&lt;/p&gt;
&lt;p&gt;I’ve used DI a long time before I knew it was called dependency injection. I was introduced to these principles in &lt;a href=&quot;http://en.wikipedia.org/wiki/Behavior-driven_development&quot;&gt;Behavior-Driven Development&lt;/a&gt; course around 5 years ago. Always code against an interface and the &lt;a href=&quot;http://en.wikipedia.org/wiki/Open/closed_principle&quot;&gt;Open/Close principle&lt;/a&gt;. I started using the techniques and soon realized that they were quite useful, if not mandatory, when unit testing. The loose coupling between components and layers, have given me numerous architectural advantages over years. Even when doing embedded development on Linux using C++, I instinctively grabbed for DI in my toolbox. I had found tricks to handle transient dependencies, and how to share dependencies among several consumers. I usually related my home-brewed DI techniques with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Strategy_pattern&quot;&gt;strategy pattern&lt;/a&gt; and the &lt;a href=&quot;http://en.wikipedia.org/wiki/Decorator_pattern&quot;&gt;decorator pattern&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;2 years ago, I left the dark side of Linux and C++ to dedicate my life to .Net and C#, this is where I realized that this loose coupling technique I had used for the past 3 years, was actually termed dependency injection. I then started using DI Containers over my own home-made DI techniques. &lt;/p&gt;
&lt;h2&gt;DI Container Basics&lt;/h2&gt;
&lt;p&gt;So, by laying off my home-brewed DI techniques, I’ve found a tool that enhance my productivity, and supplying me with an arsenal of great features. &lt;/p&gt;
&lt;p&gt;DI containers are about two things, R&amp;amp;R. No, not rest and relaxation. I’m talking about registration and resolving. These are the acts of storing a list of types and later retrieving instances of them at will.
&lt;p&gt;The DI container is the tool that turns DI into architectural patterns that lets you satisfy a type’s dependencies easily and automatically. It is a repository that typically associates interfaces with concrete types. DI containers all work in a very similar fashion. At the beginning of an application’s execution-cycle, you need to register associations of concrete types to the interfaces that they implement.
&lt;p&gt;Basically all DI containers are based on three dimensions, object composition, object lifetime, and interception. &lt;/p&gt;
&lt;h3&gt;Object Composition&lt;/h3&gt;
&lt;p&gt;Object composition is the technique used for wiring up the dependencies to its consumers. This is usually done in the composition root of the application. The composition varies from application type to application type, e.g.. in a console application, the Main() method would be the composition root, the place where all dependencies are wired up to their consumers. &lt;/p&gt;
&lt;p&gt;The composition can be configured using different techniques. Configuring by using XML is widely used, and supported by all major DI containers. When using XML, all dependencies are wired to their consumers using an XML file. This is great for late binding. An alternative is to write the bindings explicitly in code, it uses the same discrete bindings as in XML configuration, its just in code. An increasingly popular architectural model is the concept of convention over configuration. Instead of writing and maintaining a lot of configuration code, you agree on conventions.&lt;/p&gt;
&lt;p&gt;Four different patterns outlines the object composition catalog, constructor injection, property injection, method injection, and ambient context. &lt;/p&gt;
&lt;h3&gt;Object Lifetime&lt;/h3&gt;
&lt;p&gt;This dimension of DI manages the lifetime of the injected dependencies. Some dependencies might be disposable by using the IDisposable pattern, others might be shared between multiple consumers, some might be pooled, etc. &lt;/p&gt;
&lt;p&gt;When wiring up the dependencies with their consumers, no matter which composition technique, a certain lifestyle should be considered. Is it a dependency that is thread-safe and can be shared between multiple consumers, then choose singleton lifestyle. If its not thread-safe, then consider using a transient lifestyle. Is it an out-of-process dependency, then it might be a good idea to consider an object pool. &lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;Interception&lt;/h3&gt;
&lt;p&gt;Interception is the idea of intercepting the call between the consumer and a service and execute some before or after the actual service is invoked. This is a great feature for cross-cutting concerns, such as security, auditing, logging, exception handling, etc. The best analogy to interception is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Decorator_pattern&quot;&gt;decorator pattern&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Implementing interception using aspect attributes or relying entirely on decorators, you will find yourself violating the &lt;a href=&quot;http://en.wikipedia.org/wiki/Don't_repeat_yourself&quot;&gt;DRY principle&lt;/a&gt;. DI containers features dynamic interception by emitting new types at runtime.&lt;/p&gt;
&lt;h2&gt;Final words…&lt;/h2&gt;
&lt;p&gt;DI containers are awesome. Use them, use them, use them. You wont regret this, DI is a great tool to have in your toolbox. They provide so much architectural power, they often exceeds the your initial expectations.&lt;/p&gt;
&lt;p&gt;I have extensive experience using &lt;a href=&quot;http://www.ninject.org/&quot;&gt;NInject&lt;/a&gt;, and less experience using &lt;a href=&quot;http://www.castleproject.org/&quot;&gt;Castle Windsor&lt;/a&gt;, but no matter which DI container you choose, you won’t regret. There might be some initial learning curve, but you get paid back multiple times, I promise.&lt;/p&gt;
&lt;p&gt;For further reading I’ll highly recommend &lt;a href=&quot;http://blog.ploeh.dk/&quot;&gt;Mark Seemann&lt;/a&gt;’s ‘&lt;em&gt;&lt;a href=&quot;http://affiliate.manning.com/idevaffiliate.php?id=1150_236&quot;&gt;Dependency Injection in .Net&lt;/a&gt;&lt;/em&gt;’. It’s a really great read. I’ve read several chapters here and there, and is currently reading it from start to end. &lt;/p&gt;
&lt;p&gt;So, what’s your experience with DI? Throw me a comment…&lt;/p&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Buying a Kindle</title>
   <link href="http://madstt.dk/buying-a-kindle/"/>
   <updated>2012-09-25T10:37:50+00:00</updated>
   <id>http://madstt.dk/buying-a-kindle</id>
   <content type="html">&lt;p&gt;I have always been reading a lot of stuff at the same time. Both magazines and books, technical and fiction. So instead of always dragging around with all these sources I considered buying an e-reader. It quickly turned out to be a choice between an iPad or an Amazon Kindle. The obvious family choice would be to choose the iPad, which would be an excellent toy for the kids and a device that the wife would use. I guess the arguments for buying an iPad is obvious. But for me, I needed a device for reading books, magazines and blogs. Sometime stuff comes in PDFs, so these were the requirements for me.&lt;/p&gt;
&lt;p&gt;So I started researching how the Kindle versus the iPad performed in a read-only setting.&amp;#160; Factors like size, weight, e-ink, and no reflecting LCD, so reading outside is possible, is decisive for making the Kindle a more superior choice than the iPad. On the other hand, the iPad has a great browser for reading blogs, e-mail support, and better at formatting PDFs. I read &lt;a href=&quot;http://www.hanselman.com/blog/AmazonKindle.aspx&quot;&gt;Hanselmans&lt;/a&gt; blog post on the Kindle, and it seemed that formatting technical books is rather lousy on the Kindle. &lt;/p&gt;
&lt;p&gt;Quickly it turned out that the Kindle is the iPad superior when it comes to being an e-reader. But would I miss out on technical books and blog posts? So to complete my research I downloaded a Kindle version of one of the technical books I’m reading (the eBook came free when you have bought the pBook, thank you &lt;a href=&quot;http://bit.ly/QvlgtC&quot;&gt;Manning&lt;/a&gt;). I loaded it into the &lt;a href=&quot;http://amzn.to/Qvld0R&quot;&gt;Kindle desktop reader&lt;/a&gt;, so I could get an idea how it would be formatted. It was actually formatted quite well. I know that I shouldn’t take the desktop version as a definitive conclusion on the formatting, since different devices renders the books differently. To be able to read blog posts on the Kindle could be some sort of a challenge. Then I read this &lt;a href=&quot;http://bit.ly/Qvo2iA&quot;&gt;blog post&lt;/a&gt;, about how to use &lt;a href=&quot;http://bit.ly/Qvo9e2&quot;&gt;Instapaper&lt;/a&gt; for storing web page for reading later and synchronizing them with your Kindle. It uses the unique e-mail address, that every Kindle has for sending personal documents to your Kindle. These documents are also stored in the Amazon cloud storage. So when there is a new article your Instapaper Read Later folder is send to your Kindle at a certain time of the day. Cool. The Instapaper article is a stripped down version of the blog post, where only the text is saved.&lt;/p&gt;
&lt;p&gt;Finally, when Amazon lowered their pricing on the Kindle on 6th of September from $109 to $89, I ordered the &lt;a href=&quot;http://amzn.to/QvpoKh&quot;&gt;basic Kindle&lt;/a&gt;, the 6” version. Together with a leather casing and a power adapter. I would have ordered the &lt;a href=&quot;http://amzn.to/QvpDVx&quot;&gt;Paperwhite&lt;/a&gt; edition, but this is not available outside the US.&lt;/p&gt;
&lt;p&gt;In a later blog post I’ll provide my initial experiences.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>AAOSConf 2012 – The Retrospective</title>
   <link href="http://madstt.dk/aaosconf-2012-the-retrospective/"/>
   <updated>2012-09-22T17:35:16+00:00</updated>
   <id>http://madstt.dk/aaosconf-2012-the-retrospective</id>
   <content type="html">&lt;p&gt;Okay, I’ll start this post with the conclusion; the AAOSConf 2012 exceeded my expectations. In a previous &lt;a href=&quot;http://madstt.dk/?p=32&quot;&gt;post&lt;/a&gt;, I outlined my expectations ahead of the AAOSConf 2012. Reviewing these I found that the conference exceeded my expectations. Let my explain this.&lt;/p&gt;
&lt;p&gt;The venue was at some conference facilities at the University of Århus. There were three conference rooms assigned for the AAOSConf. The largest of the three rooms facilitated a projector for the code sessions. My overall impression of the facilities was that they were adequate for a conference of this size and type. Catering included breakfast,lunch, and cake in the afternoon. All day there were coffee and tea. Nothing to point my finger at here. &lt;/p&gt;
&lt;p&gt;I’d suppose 20 individuals gathered in largest of the conference rooms. Unfortunately, a number of participants, who were registered, did not show up. This is not just an unfortunate side-effect of free events like this, it’s bad morale. The organizer had put a significant amount of time into organizing this event, so at least you can expect is that registrants decline the event, instead of just not showing up. Okay, I’ve already spend too many lines on these individuals, let’s focus on the remaining participants.&lt;/p&gt;
&lt;p&gt;After a short breakfast we were encouraged to write a number of topics on post-its. These outlined the topics of the conference. The same procedure repeated on Friday. During the two day conference I participated in the following sessions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://martinfowler.com/bliki/CQRS.html&quot;&gt;CQRS&lt;/a&gt; + &lt;a href=&quot;http://martinfowler.com/eaaDev/EventSourcing.html&quot;&gt;Event Sourcing&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Technical Debt&lt;/li&gt;
&lt;li&gt;Event Driven Development&lt;/li&gt;
&lt;li&gt;Tooling, a decision-maker for language?&lt;/li&gt;
&lt;li&gt;Domain Driven Development&lt;/li&gt;
&lt;li&gt;“Contractors” aka consultants, how to manage?&lt;/li&gt;
&lt;li&gt;Document Databases, good or bad?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And two code sessions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.servicestack.net/&quot;&gt;ServiceStack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://martinfowler.com/eaaDev/EventSourcing.html&quot;&gt;Event Sourcing&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What really surprised me during this conference was the level of participation from attendees, so honest and willing to share their experiences. I didn’t get the feeling that these guys were trying to sell a book or a service. They were telling true war-stories from real projects. This created an atmosphere were every participant could join the discussions, despite different backgrounds and experience. I’m truly surprised how well this open space setting excels. The knowledge gained from these sessions has multiple perspectives, you get the full package when the participants are willing to share their experiences and their opinions on different matters.&lt;/p&gt;
&lt;p&gt;This conference experience exceeded my expectations because I got much more in the bag, than was covered by the sessions. Thank you. I’d encourage everyone who takes software development seriously to participate in this small conference in Århus, it will expand your horizon.&amp;#160; &lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Expectations Ahead of AAOSConf 2012</title>
   <link href="http://madstt.dk/expectations-ahead-of-aaosconf-2012/"/>
   <updated>2012-09-10T17:11:58+00:00</updated>
   <id>http://madstt.dk/expectations-ahead-of-aaosconf-2012</id>
   <content type="html">&lt;p&gt;Some time during the Spring I was made aware of this little conference called &lt;a href=&quot;http://aaosconf2012.eventbrite.com/?ref=estw&quot;&gt;Agile Architecture Open Space Conference&lt;/a&gt; (AAOSConf) by a co-worker. At first I was quite suspicious, but it seemed like an great collection of attendees and the organizer is a old co-worker, whom I know as a serious and hard-working guy. So, why not. I actually didn’t ask my boss until a few weeks ago, but he seemed cool about it, so on Thursday, I’ll attend my first AAOSConf.&lt;/p&gt;
&lt;p&gt;I have been wondering a lot of what to expect. I’ve never attended a conference of this sort before, so I don’t know what to expect. From the attendees list it’s going to be quite a variety of fields and domains represented for the open space discussions. There will be Microsoft employees, independent developers, Ruby developers, C# experts, architects, etc., so the ground is laid for some interesting discussions. I don’t know any other conferences of this sort, and the idea is great; gather different sorts software development disciplines and let them share their experience of different sorts. There is definitely going to be something to take with you home from these two days of discussions. &lt;/p&gt;
&lt;p&gt;I’m so fortunate that three of my former co-workers are coming along, haven’t seem them for a couple of years or so. So Thursday night going out for a informal dinner with former co-workers and other great people in my network is something I’m looking forward for.&lt;/p&gt;
&lt;p&gt;So I guess this sums up my expectations for the two day AAOSConf in Århus; great pragmatic, theoretic, discussions and informal networking and socialising.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>What Makes GOTO Århus 2012 So Special</title>
   <link href="http://madstt.dk/what-makes-goto-rhus-2012-so-special/"/>
   <updated>2012-09-10T05:48:06+00:00</updated>
   <id>http://madstt.dk/what-makes-goto-rhus-2012-so-special</id>
   <content type="html">&lt;p&gt;Being a pro developer for almost 8 years now, you know your peers and the experts around the field. So when deciding on a conference you check out the speakers list, the organizer and the venue, in that order. I went to Las Vegas in the Spring for the &lt;a href=&quot;http://http://www.devconnections.com&quot;&gt;DevConnections&lt;/a&gt;, the speakers list and the venue was the main drivers. On the speakers list for DevConnections was Scott Hanselman and Scott Guthrie. I had the pleasure of enjoying Hanselman at PDC 2008, and he is on top of my speakers list. He is an awesome speaker, with a great sense of humour.&lt;/p&gt;
&lt;p&gt;Besides Hanselman, &lt;a href=&quot;http://gotocon.com/aarhus-2012/&quot;&gt;GOTO Århus&lt;/a&gt; also has Martin Fowler and Anders Hejlsberg on the schedule. I’ve read some articles and a book by Martin Fowler, and is looking forward hearing him talk on the &lt;a href=&quot;http://gotocon.com/aarhus-2012/presentation/Introduction%20to%20NoSQL&quot;&gt;NoSQL&lt;/a&gt; topic. Anders Hejlsberg got some secret project up his sleeve, that I’m looking forward hearing about. These three speakers are my main reasons for attending GOTO Århus this year. In my perspective these three speakers makes the GOTO Århus 2012 a special conference this year.&lt;/p&gt;
&lt;p&gt;In second line of recommended spearkers is Linda Rising, Jesper Boeg, Hadi Hariri, Jez Humble, and Michael T. Nygard. This year is going to be be my second &lt;a href=&quot;http://http://gotocon.com/aarhus-2012/&quot;&gt;GOTO Århus&lt;/a&gt; conference. I had the pleasure last year as well. I know that I’ll attend sessions that I didn’t plan on hearing. Going to a Microsoft conference you know that the topics will all be about and around Microsoft products, at the GOTO conferences the subjects differ greatly. From strong technical sessions to process oriented sessions. All aspects of software development. It is therefore a good idea to attend the morning presentations of the different tracks of the day. This might convince you into attending a session that you didn’t plan to attend in the first place, or fill in the gaps of your schedule.&lt;/p&gt;
&lt;p&gt;Another important aspect of attending the GOTO conferences is the networking aspect. As mentioned above, the GOTO conferences attracts a wide variety of different peers and experts of different areas of software development. This sets perfect conditions for networking at GOTO. To me it seems like the speakers and the attendees are closer to each other, the oppotunities to mingle is higher at GOTO than at any other conference I’ve attended.&lt;/p&gt;
&lt;p&gt;Besides cool speakers and nursing my network, I’ll this attend a &lt;a href=&quot;http://gotocon.com/aarhus-2012/presentations/show_presentation.jsp?oid=3964&quot;&gt;ReSharper workshop&lt;/a&gt;, with Technical Evangelist Hadi Hariri from JetBrains. ReSharper is at the top of my tools list, and I’d love to learn more about this great tool.&lt;/p&gt;
&lt;p&gt;With high anticipations I’m looking forward for the GOTO Århus 2012. See you there..?&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Interoperating with Flash</title>
   <link href="http://madstt.dk/interoperating-with-flash/"/>
   <updated>2009-06-04T07:26:36+00:00</updated>
   <id>http://madstt.dk/interoperating-with-flash</id>
   <content type="html">&lt;p&gt;I've never seen Flash developers as 'real' developers, they don't write real code. They usually come from a design background and always seems focused on transitions and blending rather than aggragations and inheritance. From time to time you have to face the unknown and step into new territories. I recently had to make a tiny step into the Flash territory. I was given the task to create a client player that can stream an &lt;a href=&quot;http://www.adobe.com/livedocs/flashmediaserver/3.0/docs/help.html?content=01_overview_basics_13.html&quot;&gt;RTMPe&lt;/a&gt; stream. The RTMPe is an encrypted version of the RTMP protocol from Adobe, orginally Macromedia. This protocol is used by the &lt;a href=&quot;http://www.adobe.com/products/flashmediaserver/pdfs/FlashMediaServer3_WhitePaper_ue.pdf&quot;&gt;Flash Media Server (.pdf)&lt;/a&gt;. On the client side you choose from the different Adobe Flash clients, Adobe Flash Player, Adobe AIR, Adobe Media Player, basically anything that can play an .swf file. So your faced with the challenge of interoperating with Flash.&lt;/p&gt;
&lt;p&gt;This is a two side development cycle, so lets start out on the Flash side.&lt;/p&gt;
&lt;p&gt;Flash side:&lt;/p&gt;
&lt;p&gt;I was recommended a open-source IDE called &lt;a href=&quot;http://www.flashdevelop.org&quot;&gt;FlashDevelop&lt;/a&gt;. I quickly realised that it has a lot in common with Visual Studio, which is my preferred IDE. Flash is written in a language called ActionScript. ActionScript has some elements in common with VB. VB enthusiasts will probably disagree... With some help from the Adobe Developer Forum I could easily put together a working .swf file. The main components used is the NetConnection and NetStream. To be able to interact with the flash code, your have to set up some callbacks to the external interface:&lt;/p&gt;
&lt;p&gt;ExternalInterface.addCallback(&quot;SetTrack&quot;, SetTrack);&lt;br /&gt;
ExternalInterface.addCallback(&quot;TogglePause&quot;, TogglePause);&lt;br /&gt;
ExternalInterface.addCallback(&quot;Stop&quot;, StopPlayback);&lt;/p&gt;
&lt;p&gt;The first parameter is name of the method on which the C# code should call. The second parameter is the function pointer, or delegate in C#, to which ActionScript method should be invoked when, in this case, SetTrack is called. SetTrack receives an URL from the C# code and starts streaming.&lt;/p&gt;
&lt;p&gt;C# side:&lt;/p&gt;
&lt;p&gt;The first step is to host the Flash Player ActiveX component in the application. This can be done by choosing Add Reference in the context menu of your project or by adding it to your Toolbox by choosing Choose Items in the context menu of the Toolbox.&lt;/p&gt;
&lt;p&gt;Then you set the Movie property on the Flash Player: axShockwaveFlash1.Movie = @&quot;xxx.swf&quot;; Now you are able to invoke the methods on the .swf file. This is done by using the CallFunction method on the Flash Player. These calls are done through XML:&lt;/p&gt;
&lt;p&gt;axShockwaveFlash1.CallFunction(&quot;&amp;lt;invoke name=\&quot;SetTrack\&quot; returnENGINE=\&quot;xml\&quot;&amp;gt; &amp;lt;arguments&amp;gt;&amp;lt;string&amp;gt;&quot; + url + &quot;&amp;lt;/string&amp;gt;&amp;lt;/arguments&amp;gt;&amp;lt;/invoke&amp;gt;&quot;);&lt;/p&gt;
&lt;p&gt;This call sets the new URL in Flash and starts the stream. Likewise you can pause the stream and make other control calls to Flash Player. One thing that irritated me, was the ability to stop the stream. There is no command for that. So I closes the stream everytime I switch track.&lt;/p&gt;
&lt;p&gt;As you can see from this walk-through it is very easy to interoperate with Flash, and writing code in ActionScript seems reasonably easy. Although, I have heard that larger projects in ActionScript can make life a hell.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>The beauty of SSH</title>
   <link href="http://madstt.dk/the-beauty-of-ssh/"/>
   <updated>2009-03-17T14:48:38+00:00</updated>
   <id>http://madstt.dk/the-beauty-of-ssh</id>
   <content type="html">&lt;p&gt;In some cases it might be desirable to get access to your home network. This could be servers, printers, client PCs, etc. At home I have a &lt;a href=&quot;http://www.fireflymediaserver.org/&quot;&gt;Firefly&lt;/a&gt;&lt;a href=&quot;http://www.fireflymediaserver.org/&quot;&gt; Media Server&lt;/a&gt;, formerly known as mt-daapd, with all my digital music. Firefly is a cool media server that can stream .mp3, .ogg, .flac, .aac, and .wma. It also supports ID3 tagging. It can on-the-fly transcode .ogg, .flac, .alac, and .wma. It support Roku Server Protocol (RSP) and &lt;a href=&quot;http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol&quot;&gt;Digital Audio Access Protocol&lt;/a&gt; (DAAP). This means that you're able to stream the content in iTunes and on your Roku Soundbridge.&lt;/p&gt;
&lt;p&gt;Firefly is also able to stream its content through a Java applet. This makes it possible to access all your digital music from any webbrowser. This is a cool feature, it gives you the oppotunity to listen to you tunes when you're away from it could be at work, at a party, on vacation, etc. All it requires is internet access.&lt;/p&gt;
&lt;p&gt;When it comes to digital distribution of music there is always a 'but'. In this case the 'but' is that Firefly uses port 3689, which usually is blocked by many firewalls. This is also the case at my company. This is when the beauty of &lt;a href=&quot;http://en.wikipedia.org/wiki/Secure_Shell&quot;&gt;SSH&lt;/a&gt;, Secure Shell, comes in handy. SSH allow secure exchange of data between two networked devices using secure channels. The SSH server listens on standard TCP port 22, but you might want to change this since port scanners also knows about SSH. This protocol is often used during network maintenance and is therefore usually open. Through SSH you can gain a secure, encrypted access to your home network. In my case this means, among other things, access to my digital content.&lt;/p&gt;
&lt;p&gt;I use a small, but excellent application, called &lt;a href=&quot;http://en.wikipedia.org/wiki/PuTTY&quot;&gt;PuTTY&lt;/a&gt;. PuTTY is a terminal emulator application which can act as SSH client. In PuTTY you can define secure tunnels by port forwarding to the clients on your home network. Since the SSH server is also running on the same machine as Firefly, I add the following forwarded port: localhost:3689. Through a public-private key arrangement (key generation is provided by PuTTYGen) I can gain access, through SSH, to my home server. When PuTTY has connected to my home server, I can type http://localhost:3689/applet.html in my default browser and enter the required password. Then the Firefly Java applet will launch.  Sweet.&lt;/p&gt;
&lt;p&gt;I have set up other tunnels, for &lt;a href=&quot;http://mediatomb.cc/&quot;&gt;MediaThomb&lt;/a&gt;, &lt;a href=&quot;http://mysql.com/&quot;&gt;MySql&lt;/a&gt;, etc. These are all servers running on the same Linux machine. It gets even more beautiful, when accessing other clients on the home network. I don't remember the exact reason, but I once had to access the webpage of my router. I probably had to open a port or give wireless access to someone. You cannot access this webpage from the outside. I set up a tunnel for the IP address of the router and port 80, and bingo, I had access to my router. The funny thing is that I use SSH to gain a secure tunnel through my router and then I accessed the router's IP address from inside the network. That is some sweet stuff.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hattrick</title>
   <link href="http://madstt.dk/hattrick/"/>
   <updated>2009-03-09T10:17:02+00:00</updated>
   <id>http://madstt.dk/hattrick</id>
   <content type="html">&lt;p&gt;Since 2002 I've been playing an online football manager game called &lt;a href=&quot;http://www.hattrick.org&quot;&gt;Hattrick&lt;/a&gt;. I joined the game while I was still studying and it started as a competition with some of my fellow students. They have since stopped playing the game, but I can't leave it. I don't use the same amount of time that I used to.&lt;/p&gt;
&lt;p&gt;One of the great things about Hattrick is that even with a small amount of effort you can enjoy the game. The more time you spend on it, the better is you chance to win, win promotion, titles, etc. When you get beyond the initial learning curve, you only have to use 15 minutes a week to control your team. It is possible to use different approaches to Hattrick. Some people spend alot of time trading players and making money, some study tactics and their next opponents, some people is in there for the community side of Hattrick, etc. Since the start I've had the nursing and training talents approach to the game. This means that I buy young midfielders and train them. When they reach a certain age, I sell them and buy new ones. There is two games a week, Wednesday and Sunday. Midfielders playing these days will receive training. Depending on your tactic, you can at maximum train three midfielders 100% and two wingers will receive 50%. This makes it six midfielders and four wingers will receive training per week. Once every season, usually at the end of the season, I sell the oldest player and buy a young one. The profit made on these will be invested on the remaining positions on the team, the stadium, the youth team, coach, etc.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Back...</title>
   <link href="http://madstt.dk/back/"/>
   <updated>2009-03-09T09:48:58+00:00</updated>
   <id>http://madstt.dk/back</id>
   <content type="html">&lt;p&gt;Since October I've had difficulties finding the motivation and time for this blog, my appologies. I assumed that this will change for time to come.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Arrived in Los Angeles</title>
   <link href="http://madstt.dk/arrived-in-los-angeles/"/>
   <updated>2008-10-26T13:10:36+00:00</updated>
   <id>http://madstt.dk/arrived-in-los-angeles</id>
   <content type="html">&lt;p class=&quot;MsoNormal&quot;&gt;After travelling for 16,5 hours, I've finally arrived in Los Angeles. I'm travelling with a good collegue of mine. We transfered in Amsterdam. I was unlucky and obviously the worlds tallast man got seat right in front of me. He insisted in having his seat laid down, which made the journey somewhat discomfortable. And it wasn't better when large frenchman sat next to me, he had some difficulties in using only on seat... Service was okay and they showed the new Indiana Jones movie, that together with the excitement of soon partipating in years biggest and most important developer conference made the journey worthwhile.&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot;&gt;I'll get back tomorrow when I've finished the Advanced Windows Debugging pre-con session.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Selected sessions for PDC 2008</title>
   <link href="http://madstt.dk/selected-sessions-for-pdc-2008/"/>
   <updated>2008-10-17T09:54:43+00:00</updated>
   <id>http://madstt.dk/selected-sessions-for-pdc-2008</id>
   <content type="html">&lt;p&gt;With only a week left till Microsoft PDC 2008, I've started to focus on which sessions I'm going to attend.&lt;/p&gt;
&lt;p&gt;At the moment my list of sessions looks like this:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Day 1:&lt;/strong&gt;&lt;/p&gt;
&lt;div id=&quot;selectedTitle&quot;&gt;
&lt;p&gt;&lt;strong&gt;Microsoft Visual C# IDE: Tips and Tricks&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Learn tips and tricks that will make C# code editing faster and more fun using Microsoft Visual Studio.&lt;/p&gt;
&lt;div&gt;
&lt;div id=&quot;selectedTitle&quot;&gt;
&lt;p&gt;&lt;strong&gt;Microsoft Visual Studio: Bringing out the Best in Multicore Systems&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Learn how to prepare for the new challenges in developing and tuning concurrent applications. Hear about important steps in the creation of or conversion to parallel applications with demonstrations of the parallel performance analysis and optimization tools in the next release of Microsoft Visual Studio. See how to identify opportunities for parallelism and how to exploit those opportunities by choosing applicable coding patterns using existing or future programming models. Finally, watch a demonstration that shows how to optimize parallel code by focusing on common sources of inefficiency such as I/O and synchronization.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Agile Development with Microsoft Visual Studio&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Visual Studio has built-in tool support for agile practices such as Scrum, XP, and others. The next version adds practices like test-driven development, continuous integration, and single product backlog. See how these can be applied at scale and across geographies.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Day 2:&lt;/strong&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Coding4Fun: Windows Presentation Foundation Animation, YouTube, iTunes, Twitter, and Nintendo's Wiimote&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Spend time with Coding4Fun authors as they walk through some DIY Development projects: TwitterVote, Wiimote, InnerTube, and BabySmash.&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Developing Applications Using Data Services&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In the near future, applications will be developed using a combination of custom application code and online building block services, including data-centric services. In this session we discuss advancements in the Microsoft development platform and online service interfaces to enable seamless interaction with data services both on-premises (e.g., ADO.NET Data Services Framework over on-premises SQL Server) and in the cloud (e.g., SQL Server Data Services). Learn how you can leverage existing know-how related to LINQ (Language Integrated Query), data access APIs, data-binding, and more when building applications using online data.&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Research: BAM, AjaxScope, and Doloto&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;See Microsoft Research present new technologies for developing, debugging, and deploying web applications. Hear how BAM can turn a simple specification into a web-based cloud application with the click of a button. Learn how AjaxScope and Doloto automatically instrument and rewrite your web applications' JavaScript code for end-to-end monitoring and optimization.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Day 3:&lt;/strong&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Parallel Programming for Managed Developers with the Next Version of Microsoft Visual Studio&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Come learn how the next version of Visual Studio and the Microsoft .NET Framework can help you write better performing and more scalable applications. We take a tour of new .NET APIs, including the Task Parallel Library (TPL) and Parallel LINQ (PLINQ). We also introduce new features in the debugger that help you quickly identify concurrency issues and visualize the internal state of your application.&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Improving Code Quality with Code Analysis&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Learn how to catch critical bugs earlier in the development cycle by identifying issues such as buffer overruns and SQL injection attacks before they actually cause a security exploit. The Code Analysis features in Visual Studio help you tune application security, robustness, performance, and more. Learn about Code Analysis (for native and managed) and how to apply it effectively within your team's development lifecycle. Also hear about new features in Visual Studio 2010, including the new Rule Sets feature that makes it easy to manage, configure, and maintain rules.&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Improving .NET Application Performance and Scalability&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Performance must be considered in each step of the development lifecycle. See how to integrate performance in design, development, testing, tuning, and production. Work with tools and technologies like: static analysis, managed memory profiling, data population, load testing, and performance reports. Learn best practices to avoid the performance pitfalls of poor CPU utilization, memory allocation bugs, and improper data sizing.&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;The Future of C#&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In this talk Microsoft Technical fellow and C# Chief Architect Anders Hejlsberg outlines the future of C#. He describes the many forces that influence and shape the future of programming languages and explain how they fit into C#.&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Mono and .NET&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;See how Mono, the open source implementation of the .NET Framework, offers a platform for developers to leverage .NET in new and unconventional scenarios. Explore many of these innovations: the C# shell and the embeddable, C# runtime &quot;eval&quot;; how and why developers are choosing to embed Mono in applications and games on Windows and other platforms; static compilation with Mono enables .NET to be supported on more devices.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Day 4:&lt;/strong&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Microsoft .NET Framework: Declarative Programming Using XAML&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;If you're using Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), or Windows Workflow Foundation (WF), then XAML is your new best friend! Learn how an entire application-from presentation to data to services to workflow--can be authored using simple, declarative XAML notations introduced in the next version of the .NET Framework. Learn about XAML additions like: support for generics, object references, non-default constructors, and more.&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Microsoft Visual Studio: Customizing and Extending the Development Environment&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The next version of Visual Studio moves beyond add-ins and packages to unleash powerful new ways to customize and extend the environment. Learn about the Visual Studio extension model-built on a common Microsoft .NET extensibility framework--that makes it easy to customize Visual Studio in new ways. See how to create extensions for the new code editor and project system, and hear how to build your own graphical designers and specialized development environments.&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Managed and Native Code Interoperability: Best Practices&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Learn when, where, and how to use the various managed to native interoperability technologies. See upcoming features and tools and how they make interoperability even easier.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;p&gt;&lt;strong&gt;Live Services: Deep Dive on Microsoft Virtual Earth&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Learn about the next major release of Virtual Earth. See the improvements to our parsing and geo-coding engines, clustering, localization, and routing. Hear how the new Virtual Earth Web Services provide server-side support for building location-based applications on desktops and mobile devices.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;This list is still due to changes, I'll notify you as soon as the come. As you can read from the above it looks like an intensive week. My experience tells me that I'll be busted when I come back to the hotel in the evening. Besides all the sessions, Microsoft has arranged a number of social activities. The main social event of the weeks is the &lt;a href=&quot;http://microsoftpdc.com/Social/AttendeeParty.aspx&quot;&gt;Universal Studio&lt;/a&gt; visit on Wednesday. The park will be open exclusively to PDC attendees.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>One new mobile for me...</title>
   <link href="http://madstt.dk/one-new-mobile-for-me/"/>
   <updated>2008-08-27T09:40:46+00:00</updated>
   <id>http://madstt.dk/one-new-mobile-for-me</id>
   <content type="html">&lt;p&gt;I don't know about you, but when ever I have to buy anything, whether its a car, camera, mobile, laptop, etc., I spend a long time researching the market. It has taken me more than six months to find the right mobile for me. I like reading reviews, finding the right price, comparing products, all the elements that that is required for finding the right mobile for me.&lt;/p&gt;
&lt;p&gt;My requirements were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A mobile with an intuitive and intelligent calendar.&lt;/li&gt;
&lt;li&gt;A WiFi and 3G enabled device.&lt;/li&gt;
&lt;li&gt;A mobile which can seemless integrate with GMail.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My history of mobile phones is the following, &lt;a href=&quot;http://www.mobilmania.sk/Files/Obrazky/2007/clanky/temy/10v_gsm/mmericssonGA628.jpg&quot;&gt;Ericsson GA628&lt;/a&gt;, &lt;a href=&quot;http://www.ulttelecom.com/data/photo/Erisson%20T10.gif&quot;&gt;Ericsson T10&lt;/a&gt;, &lt;a href=&quot;http://static.esato.com/gfx/phones/ericssont65.jpg&quot;&gt;Ericsson T65&lt;/a&gt;, &lt;a href=&quot;http://www.mobile-review.com/preview/image/2003/z200/pic1.jpg&quot;&gt;Sony Ericsson Z200&lt;/a&gt; and &lt;a href=&quot;¨http://www.mobiledia.com/news/images/26701-1.jpg&quot;&gt;Sony Ericsson K750&lt;/a&gt;. As you can see, my history tells of faithful support for Ericsson/Sony Ericsson. I've always loved the intuitive UI, solid built and nice design. I wouldn't think of buying a Nokia. A couple of times I've had a Nokia in hand (speaking of blasphemy!) and I've had difficulties finding my way around, I don't find the UI intuitive. Another factor could also be the support for the 'underdog' in Scandinavia...&lt;/p&gt;
&lt;p&gt;I can't reject my history of mobile phones so I started looking at Sony Ericsson smartphones that would fulfil my requirements. The first one to undergo a closer look was the Sony Ericsson M600i. It fulfilled my requirements except 3G. I could live with this lack, but it also lacks a camera, which means no MMS, FM radio and TrackID. Which is stuff that I regularly use, they are not primary requirements, but comes in handy from time to time. Last summer Sony Ericsson released their &lt;a href=&quot;http://bp2.blogger.com/_QNsCmSfL9Z4/Rrb_gmsksdI/AAAAAAAAADM/I0kcMtTdRUE/s400/sony+p1i.JPG&quot;&gt;P1i&lt;/a&gt;, which is the predecessor of both the M600i but also the P990. Its a 3G enabled mobile with 3.2 megapixel camera, FM radio, semi-QWERTY keyboard and TrackID. It fulfilled all my requirements. I was convinced that this was my new mobile.&lt;/p&gt;
&lt;p&gt;During this period I also considered the Sony Ericsson &lt;a href=&quot;http://gadgetgue.com/wp-content/uploads/2008/02/g900-sony-ericsson-468.jpg&quot;&gt;G900&lt;/a&gt;. The G900 is like the P1i based on Symbian and UIQ 3.0. It holds a few other applications (which has been ported to the P1i). The main difference is the form factor. The G900 has the same size as the K750. I would prefer the big screen and the semi-QWERTY keyboard.&lt;/p&gt;
&lt;p&gt;Also Apple released their new &lt;a href=&quot;http://www.mobilegazette.com/handsets/apple/apple-iphone-3g/apple-iphone-3g-black.jpg&quot;&gt;iPhone 3G&lt;/a&gt; this summer. This mobile device has conquered the world since its release, and after trying it, it seemed like the obvious choice. I could live with the lack of MMS support, TrackID and FM radio. When Steve Jobs announced the iPhone 3G, he stated the fairly low price of this device as a main feature for the iPhone 3G. Unfortunately, the iPhone is sold in Denmark under license by Swedish Telia. First, Telia has the lousiest 3G coverage available on this planet. Secondly, Telia requires almost $940 for the first 6 month, and that does not include flatrate data transfer, it only includes 300 MB data. I don't know about you, but I can't just throw $940 on the desk for a new mobile.&lt;/p&gt;
&lt;p&gt;Therefore I ended up choosing the P1i. When the P1i was realeased in Denmark it included a Wayfinder GPS module and 12 month of maps for free. Now a days it is sold without. Therefore I've spend some time finding a second-hand device with the GPS module. Fortunately, a friend of mine had just invested in the new iPhone 3G. I could therefore buy his for an acceptable price.&lt;/p&gt;
&lt;p&gt;I've now had for a couple of weeks and I'm certain that this is the right phone for me. I use &lt;a href=&quot;http://www.goosync.com/&quot;&gt;GooSync&lt;/a&gt; to sync the calendar with Google Calendar, it works perfect. It is so convenient to have your calendar in you pocket. I then use the Push Mail feature of the P1i to receive the headers of the mails on my GMail. I have prioritized the data connections, as WiFi has first priority, then 3G and finally GPRS.&lt;/p&gt;
&lt;p&gt;I'll write another port later on about the apps I've installed.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ErrorProvider providing localization difficulties</title>
   <link href="http://madstt.dk/errorprovider-providing-localization-difficulties/"/>
   <updated>2008-07-24T12:05:25+00:00</updated>
   <id>http://madstt.dk/errorprovider-providing-localization-difficulties</id>
   <content type="html">&lt;p&gt;The .Net framework provides several mechanisms for indicating invalid user inputs. You can use a MessageBox to indicate that the state of the control is not valid. A MessageBox can then provide the reason and remedies in the popup dialog box. Having several controls that needs user input this approach can be both cumbersome and intrusive for the user. Other approaches could be a balloon message, using the status panel or giving an audio clue of the invalid input. The .Net framework also provides a control named &lt;a href=&quot;http://http://msdn.microsoft.com/en-us/library/system.windows.forms.errorprovider.aspx&quot;&gt;ErrorProvider&lt;/a&gt;, which is a control you can attach to any control that needs validation logic. If the error description string is set, an icon will appear next to the control. Hovering the mouse over the icon, a tooltip will display the error description string.&lt;/p&gt;
&lt;h3&gt;How to use the ErrorProvider&lt;/h3&gt;
&lt;p&gt;You can either drag the control from the ToolBox or you can programatically create an instance of the ErrorProvider. To modify the behavior, you can set the following properties:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;BlinkRate: This is the rate in milliseconds with which the icon will blink.&lt;/li&gt;
&lt;li&gt;BlinkStyle: This property can have one of the following values, AlwaysBlink, BlinkIfDifferentError or NeverBlink.&lt;/li&gt;
&lt;li&gt;Icon: The icon that is displayed when the error description string is set.&lt;/li&gt;
&lt;li&gt;IconAlignment: Where the icon should be placed relative to the control.&lt;/li&gt;
&lt;li&gt;IconPadding: The extra space between the error icon and the control.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Whenever the control's state is invalid, you set the error description string, by using the SetError method on the ErrorProvider control.&lt;/p&gt;
&lt;pre&gt;if (!validUserInput(textBox.Text))
{
  errorProvider1.SetError(this, &quot;Invalid user input&quot;);
}
else
{
  errorProvider1.SetError(this, &quot;&quot;);
}&lt;/pre&gt;
&lt;p&gt;This displays the error symbol next to the control.&lt;/p&gt;
&lt;h3&gt;Localization difficulties&lt;/h3&gt;
&lt;p&gt;This is a very useful control for providing non-intrusive feedback to the user. But, there is something that bothers every time I'm using this control. Why do you have to set a 'string' to display an icon?! I don't get it. Its the only control in the .Net framework that uses this &quot;mechanism&quot;. Elsewhere its either a Start() method, Enable() method etc.&lt;/p&gt;
&lt;p&gt;By combining a string with control display features it is difficult to use localization. In many applications it is evident to provide error descriptors in different languages, but when you cannot set the descriptor in whatever language without displaying the icon, you face additional work. Fortunately there are multiple options to come around this. One neat and clean solution is to create a user control that inherites the ErrorProvider. The new user control holds the local error descriptor string, which you can change whenever you'd like to without displaying the icon. Then you provide an Enable() method which calls SetError with the local string and displays the icon.&lt;/p&gt;
&lt;pre&gt;class NewUserControl : ErrorProvider
{
  private string errorDescriptor;

  ...

  string ErrorDescriptor
  {
    set
    {
      errorDescriptor = value;
    }
    get
    {
      return errorDescriptor;
    }
  }

  void Enable()
  {
    base.SetError(errorDescriptor);
  }&lt;/pre&gt;
&lt;pre&gt;}&lt;/pre&gt;
&lt;p&gt;Another option is to use the ResourceManager. When using the ResourceManager, you add a resource file, .resx file,  to your project. Name it this way, Res.XX.resx, where the XXs are you language you're writing strings for, e.g. 'en' for english, 'da' for danish. When using the ResourceManager's GetString() method, you can receive the correct localized string. To use this method across the whole solution, a satellite assembly should be used. I'll make a post of this on another occation.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Registered for Microsoft PDC 2008</title>
   <link href="http://madstt.dk/registered-for-microsoft-pdc-2008/"/>
   <updated>2008-07-02T11:02:47+00:00</updated>
   <id>http://madstt.dk/registered-for-microsoft-pdc-2008</id>
   <content type="html">&lt;p&gt;A couple of weeks ago I pursuited my employer to let me register for &lt;a href=&quot;http://www.microsoftpdc.com&quot;&gt;Microsoft Professional Developers Conference&lt;/a&gt; in Los Angeles. The conference is set to rumble from the 27th - 30th of&lt;/p&gt;
&lt;p&gt;October. It will be held at the Los Angeles Convention Center. I've registered for pre-conference as well, which is a day-long session on a specific issue. I've chosen &lt;a href=&quot;http://microsoftpdc.com/Agenda/Preconference.aspx#advanced-windows-debugging&quot;&gt;Advanced Windows Debugging&lt;/a&gt;, of which I'm having high expectations.&lt;img class=&quot;alignright size-thumbnail wp-image-7&quot; title=&quot;bling2&quot; src=&quot;assets/bling2.jpg&quot; alt=&quot;&quot; width=&quot;108&quot; height=&quot;150&quot; /&gt;&lt;/p&gt;
&lt;p&gt;I still haven't made any specific plans for which sessions to attend, but I do know that I'll attend the session where Anders Hejlsberg is given a speech under the title, 'The Future of C#'.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Connected or not...?!</title>
   <link href="http://madstt.dk/connected-or-not/"/>
   <updated>2008-07-01T06:33:02+00:00</updated>
   <id>http://madstt.dk/connected-or-not</id>
   <content type="html">&lt;p&gt;A few days back, my wife experienced a weird network issue on her laptop. Usually the laptop receives an IP address immediately on start-up, but this day she received the following network error message: &quot;Limited or no connectivity.&quot; What does limited connectivity mean, is there a connection or not? The message did not say anything about the origin of this.&lt;/p&gt;
&lt;p&gt;At first I told her to repair the connection to renew the IP address. This has helped in the past. But no luck this time. I then consulted my wireless router to see if there should be anything that could hint a solution. In the device list I could see the correct MAC address, but there were no IP address related to that MAC address. Everytime a repair was attempted the device left the list and came back with no IP address. I reviewed the security settings to see if the wireless filter was messing up things or the DHCP was not working properly.&lt;/p&gt;
&lt;p&gt;Well, GIYF (Google Is You Friend), so I started hunting a solution. One solution was that malware had replaced the tcpip.sys file. My tcpip.sys file seemed in fine form. Just to be sure I made a full computer scan with AVG, no luck. I then uninstalled the network driver, and re-installed the latest version. This neither solved the issue. After reading several forum posts I realized that this issue is related to Windows XP Service Pack 2, and the Microsoft patch (&lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=17d997d2-5034-4bbb-b74d-ad8430a1f7c8&amp;amp;DisplayLang=en&quot;&gt;KB884020&lt;/a&gt;) should do the work. Again, no luck, this patch only seems to work with a specific language version of Windows XP. Another hint I got was to use the &lt;a href=&quot;http://www.snapfiles.com/get/winsockxpfix.html&quot;&gt;Winsock&lt;/a&gt; XP Fix, but unfortunately this neither solved the problem. At this point frustration started creeping in on me.&lt;/p&gt;
&lt;p&gt;Another hint sent me check out which services there where running (services.msc from command line). I then realized that the DHCP Client was not running. Trying to start it manually gave me an error saying that a dependent service could not be started. Checking the Dependencies tab under the DHCP Client Properties reviled an unknown service. These services should be removed through the registry. I navigated to the following keys in the registry:&lt;br /&gt;
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\DHCP&lt;/p&gt;
&lt;p&gt;HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT&lt;/p&gt;
&lt;div id=&quot;EchoTopic&quot; class=&quot;answerBody quoted&quot;&gt;For each of these, on the right side, double-click: DependOnService&lt;br /&gt;
I then deleted SYMTD. In the post where I read this, it also said that it could have NISDRV instead. I was now able to start the DHCP Client service again. After a reboot, the laptop was able to receive an IP address.&lt;/div&gt;
&lt;div class=&quot;answerBody quoted&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;answerBody quoted&quot;&gt;So what is this SYMTDI? The SYMTDI service appears to get installed by Norton Antivirus, where it is added as a dependency for DHCP client. The unistall of Norton removes the file: C:\WIndows\System32\Drivers\SYMTDI.SYS, but it does NOT remove the entry for SYMTDI in the DependOnService value for DHCP. So, SYMTDI won't start because symtdi.sys has been removed. I had actually uninstalled Norten Antivirus just before I ran into this issue.&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>just another blog...?</title>
   <link href="http://madstt.dk/just-another-blog/"/>
   <updated>2008-06-27T08:00:31+00:00</updated>
   <id>http://madstt.dk/just-another-blog</id>
   <content type="html">&lt;p&gt;So what am I going to write on my blog?&lt;/p&gt;
&lt;p&gt;At this blog I'll be writing about stuff from my job, sparetime, etc. It's going to contain the following elements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;.Net issues&lt;/li&gt;
&lt;li&gt;C# snippets&lt;/li&gt;
&lt;li&gt;Gadgets of interest&lt;/li&gt;
&lt;li&gt;Computer oddities&lt;/li&gt;
&lt;li&gt;... and maybe something about football&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hope you'll come back...&lt;/p&gt;
</content>
 </entry>
 

</feed>
