<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-2475940304863204716</atom:id><lastBuildDate>Sat, 05 Oct 2024 01:57:39 +0000</lastBuildDate><category>Gallio</category><category>MbUnit</category><category>Contract Verifier</category><category>User Interface Design</category><category>Assertion</category><category>Extensibility</category><category>Custom Data Source</category><category>Data Generation Framework</category><category>ReSharper</category><category>NHamcrest</category><category>Presentation</category><category>Test Report</category><category>data-driven testing</category><category>.net</category><category>API Design</category><category>Book</category><category>C#</category><category>Hamcrest</category><category>Hash</category><category>Immutability</category><category>Impersonation</category><category>Metadata</category><category>Powershell</category><category>Rhino.Mocks</category><category>Structural Equality Comparer</category><category>TestDriven.Net</category><category>WatiN</category><category>Web Testing</category><category>Wiki</category><category>XML</category><category>dynamic</category><category>recruitment</category><category>stackoverflow</category><title>Interfacing Reality</title><description>About Gallio and Mbunit.</description><link>http://interfacingreality.blogspot.com/</link><managingEditor>noreply@blogger.com (Yann Trevin)</managingEditor><generator>Blogger</generator><openSearch:totalResults>66</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-503083453863900455</guid><pubDate>Mon, 23 Jul 2012 05:36:00 +0000</pubDate><atom:updated>2012-07-23T07:37:02.744+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><category domain="http://www.blogger.com/atom/ns#">ReSharper</category><title>Announcing Gallio and MbUnit 3.4</title><description>&lt;div align=&quot;justify&quot;&gt;I just realized that Graham Hay made a new release of &lt;a href=&quot;http://gallio.org/&quot;&gt;Gallio/MbUnit&lt;/a&gt; a few days ago. That new version supports R#6.1 and the latest versions of several unit testing frameworks. Please read the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.4&quot;&gt;release notes&lt;/a&gt; for more details.&lt;br /&gt;
&lt;h4&gt;· Downloads&lt;/h4&gt;
Please visit the Gallio website &lt;b&gt;&lt;a href=&quot;http://gallio.org/Downloads.aspx&quot;&gt;Downloads page&lt;/a&gt;&lt;/b&gt; to get the binaries, or grab them directly from here:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.4.14.0-Setup-x86.msi&quot;&gt;Gallio/MbUnit 3.4 (x86 MSI installer)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.4.14.0-Setup-x64.msi&quot;&gt;Gallio/MbUnit 3.4 (x64 MSI installer)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.4.14.0.zip&quot;&gt;Gallio/MbUnit 3.4 (zip archive - no installer)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2012/07/i-just-realized-that-graham-hay-made.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-1064078929126697605</guid><pubDate>Fri, 23 Dec 2011 06:00:00 +0000</pubDate><atom:updated>2011-12-23T07:00:07.207+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">data-driven testing</category><category domain="http://www.blogger.com/atom/ns#">dynamic</category><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Dynamic binding for data-driven tests in MbUnit v3</title><description>&lt;div align=&quot;justify&quot;&gt;MbUnit v3.3 has been now released for a &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.3&quot;&gt;while&lt;/a&gt; and I realize that I have completely forgotten to write about the new nifty features added by our fellow contributor Aleksandr Jones. Aleks had added a couple of very powerful attributes for writing data-driven tests. He had even written &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing:external_data_sources&quot;&gt;some useful documentation&lt;/a&gt; in the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=start&quot;&gt;Gallio wiki&lt;/a&gt;. Those attributes provide a seamless way to bind automatically your external data sources (CSV or XML data files) to the test parameters.&lt;p/&gt;Basically you can declare your test parameters as &quot;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd264736.aspx&quot;&gt;dynamic&lt;/a&gt;&quot; variables and let MbUnit to bind &lt;i&gt;automagically&lt;/i&gt; the parameters behind the scene. Of course it also means that the feature is only available for test projects targeting the .NET 4 framework.&lt;p/&gt;Let&#39;s consider the following simple comma-separated example data file:&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/1496193.js?file=Data.csv&quot;&gt;&lt;/script&gt;&lt;div align=&quot;justify&quot;&gt;Let&#39;s now write a test method which loads the file and gets data from it. We could have used the classic &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing:csvdata&quot;&gt;&lt;code&gt;[CsvData]&lt;/code&gt;&lt;/a&gt; attribute to bind explicitly the parameters. But with the new &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing:flatfiledataobject&quot;&gt;&lt;code&gt;[FlatFileDataObject]&lt;/code&gt;&lt;/a&gt; attribute, it&#39;s far easier:&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/1496241.js?file=gistfile1.cs&quot;&gt;&lt;/script&gt;&lt;div align=&quot;justify&quot;&gt;Look at how the different properties of the test parameter were bound and printed in the test log.&lt;/div&gt;&lt;img src=&quot;http://gallio.org/wiki/lib/exe/fetch.php?media=mbunit:data-driven_testing:tabulardataflatfilesample.png&quot;/&gt;That&#39;s just awesome! Good work Aleks!</description><link>http://interfacingreality.blogspot.com/2011/12/dynamic-binding-for-data-driven-tests.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-5976772632151546631</guid><pubDate>Mon, 19 Dec 2011 08:45:00 +0000</pubDate><atom:updated>2011-12-19T09:45:38.726+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><category domain="http://www.blogger.com/atom/ns#">WatiN</category><category domain="http://www.blogger.com/atom/ns#">Web Testing</category><title>Web Testing with MbUnit and WatiN</title><description>&lt;div align=&quot;justify&quot;&gt;A serie of articles of mine have been published recently on &lt;a href=&quot;http://www.developerfusion.com&quot;&gt;developerFusion.com&lt;/a&gt;. The articles explain how to use efficiently &lt;a href=&quot;http://gallio.org&quot;&gt;&lt;b&gt;Gallio/MbUnit&lt;/b&gt;&lt;/a&gt; and &lt;a href=&quot;http://watin.org/&quot;&gt;&lt;b&gt;WatiN&lt;/b&gt;&lt;/a&gt; to test your web applications. You can find already many interesting articles about web testing here and there. What I tried to do is to focus on a few less treated problems like testing on the local host, web pages with AJAX requests, controlling the Visual Studio web application server, etc. Good reading!&lt;ul&gt;&lt;li&gt;Part 1: &lt;a href=&quot;http://www.developerfusion.com/article/128726/web-testing-with-mbunit-and-watin-part-1-keeping-your-tests-legible/&quot;&gt;Keeping Your Tests Legible&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Part 2: &lt;a href=&quot;http://www.developerfusion.com/article/129668/web-testing-with-mbunit-and-watin-part-2-controlling-localhost-and-iis-express/&quot;&gt;Controlling Localhost and IIS Express&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Part 3: &lt;a href=&quot;http://www.developerfusion.com/article/134437/web-testing-with-mbunit-and-watin-part-3-testing-asynchronous-ajax-calls/&quot;&gt;Testing Asynchronous AJAX Calls&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;a href=&quot;http://www.developerfusion.com&quot;&gt;&lt;img src=&quot;http://cdn.developerfusion.com/images/shared/logo.gif&quot;/&gt;&lt;/a&gt;&lt;div align=&quot;justify&quot;&gt;A big thank you to Dan Maharry and all the editorial team of &lt;a href=&quot;http://www.developerfusion.com&quot;&gt;developerFusion.com&lt;/a&gt; for having reviewed my articles.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/12/web-testing-with-mbunit-and-watin.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-3679167580688223177</guid><pubDate>Fri, 14 Oct 2011 20:08:00 +0000</pubDate><atom:updated>2011-10-14T22:08:53.653+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><category domain="http://www.blogger.com/atom/ns#">ReSharper</category><title>Announcing Gallio and MbUnit 3.3.1</title><description>&lt;div align=&quot;justify&quot;&gt;We are pleased to announce that a new release of &lt;a href=&quot;http://gallio.org/&quot;&gt;Gallio/MbUnit&lt;/a&gt; is now available. Thanks to an &lt;a href=&quot;http://code.google.com/p/mb-unit/source/detail?r=3202&quot;&gt;awesome work&lt;/a&gt; made by Graham Hay, we can finally release a version which supports Resharper 6. Please see below or read the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.3.1&quot;&gt;release notes&lt;/a&gt; for more details.&lt;br /&gt;
&lt;h4&gt;· Downloads&lt;/h4&gt;
Please visit the Gallio website &lt;b&gt;&lt;a href=&quot;http://gallio.org/Downloads.aspx&quot;&gt;Downloads page&lt;/a&gt;&lt;/b&gt; to get the binaries, or grab them directly from here:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.3.458.0-Setup-x86.msi&quot;&gt;Gallio/MbUnit 3.3.1 (x86 MSI installer)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.3.458.0-Setup-x64.msi&quot;&gt;Gallio/MbUnit 3.3.1 (x64 MSI installer)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.3.458.0.zip&quot;&gt;Gallio/MbUnit 3.3.1 (zip archive - no installer)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/10/announcing-gallio-and-mbunit-331.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-1874624443705754174</guid><pubDate>Sat, 17 Sep 2011 19:49:00 +0000</pubDate><atom:updated>2011-09-17T21:49:09.553+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Announcing Gallio and MbUnit 3.3</title><description>&lt;div align=&quot;justify&quot;&gt;We are pleased to announce that a new release of &lt;a href=&quot;http://gallio.org/&quot;&gt;Gallio/MbUnit&lt;/a&gt; is now available. This release contains many new features and improvements for MbUnit. Please see below or read the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.3&quot;&gt;release notes&lt;/a&gt; for more details.&lt;br /&gt;
&lt;h4&gt;· Downloads&lt;/h4&gt;
Please visit the Gallio website &lt;b&gt;&lt;a href=&quot;http://gallio.org/Downloads.aspx&quot;&gt;Downloads page&lt;/a&gt;&lt;/b&gt; to get the binaries, or grab them directly from here:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.3.442.0-Setup-x86.msi&quot;&gt;Gallio/MbUnit 3.3 (x86 MSI installer)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.3.442.0-Setup-x64.msi&quot;&gt;Gallio/MbUnit 3.3 (x64 MSI installer)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.3.442.0.zip&quot;&gt;Gallio/MbUnit 3.3 (zip archive - no installer)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/09/announcing-gallio-and-mbunit-33.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-7831105653383597725</guid><pubDate>Sun, 07 Aug 2011 09:19:00 +0000</pubDate><atom:updated>2011-08-07T14:41:30.526+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">recruitment</category><title>Immediate opening for a .NET developer.</title><description>In case some readers live in Luxembourg area (&lt;a href=&quot;http://www.grande-region.lu&quot;&gt;&lt;i&gt;&quot;Grande Région&quot;&lt;/i&gt;&lt;/a&gt;), my team is recruiting a .NET developer (junior or experimented). It&#39;s a renewable 6 months temporary contract (CDD) but it might be possible that it become a full-time employee position afterwards (CDI). You may read more about &lt;a href=&quot;https://recruitingapp-1650.umantis.com/Vacancies/36385/Description/Detail/2/ShowDocument/ext%20.NET%20Software%20Engineer.doc?ep=./ExternalPublications/2/Documents/1/File&quot;&gt;&lt;b&gt;this job&lt;/b&gt;&lt;/a&gt; and apply to it by visiting the &lt;a href=&quot;http://www.goodyear-dunlop.com/career/jobboard/index.jsp&quot;&gt;Goodyear EMEA Job Board&lt;/a&gt;.</description><link>http://interfacingreality.blogspot.com/2011/08/immediate-opening-for-net-developer.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-9102950648192050418</guid><pubDate>Fri, 24 Jun 2011 11:43:00 +0000</pubDate><atom:updated>2011-06-24T14:18:15.930+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">Impersonation</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Running Tests Under Another User in Gallio/MbUnit v3.3</title><description>&lt;div align=&quot;justify&quot;&gt;It may be convenient sometimes to run test methods under a user account other than the one running the current test session. For example, you might want to test some security feature and see if it behaves correctly according to the level of credentials of a particular archetypal user.&lt;br /&gt;&lt;br /&gt;MbUnit provides a very simple attribute that does exactly that: &lt;code&gt;&lt;strong&gt;&lt;a href=&quot;http://gallio.org/api/html/T_MbUnit_Framework_ImpersonateAttribute.htm&quot;&gt;ImpersonateAttribute&lt;/a&gt;&lt;/strong&gt;&lt;/code&gt;. To use it, decorate the test methods (or the entire test fixture) with one or several instances of that attribute and feed them with valid user names, passwords and optionally a domain.&lt;/div&gt;&lt;br/&gt;&lt;script src=&quot;https://gist.github.com/1044622.js&quot;&gt;&lt;/script&gt;&lt;div align=&quot;justify&quot;&gt;You can find more details and a few samples on the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:impersonated_tests&quot;&gt;Gallio Wiki&lt;/a&gt;.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/06/running-tests-under-another-user-in.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-2209336444165418123</guid><pubDate>Wed, 15 Jun 2011 08:45:00 +0000</pubDate><atom:updated>2011-06-15T13:43:49.461+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Extensibility</category><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Extending MbUnit With Custom Expected Exception Attributes</title><description>&lt;div align=&quot;justify&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://gallio.org&quot;&gt;MbUnit&lt;/a&gt;&lt;/b&gt; provides &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:exceptions_handling&quot;&gt;several ways&lt;/a&gt; to deal with expected exceptions in the user code under test. The most popular one is certainly to decorate the test method with an &lt;code&gt;[&lt;a href=&quot;http://www.gallio.org/api/html/T_MbUnit_Framework_ExpectedExceptionAttribute.htm&quot;&gt;ExpectedException&lt;/a&gt;]&lt;/code&gt; attribute:&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test, ExpectedException(&lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(ArgumentOutOfRangeException))]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Constructs_Foo_with_negative_value_should_throw_exception()&lt;br /&gt;{&lt;br /&gt;   &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Foo(-123);&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Conveniently, you can use some built-in attributes to save a few more keystrokes:&lt;ul&gt;&lt;li&gt;&lt;code&gt;[&lt;a href=&quot;http://www.gallio.org/api/html/T_MbUnit_Framework_ExpectedArgumentExceptionAttribute.htm&quot;&gt;ExpectedArgumentException&lt;/a&gt;]&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;[&lt;a href=&quot;http://www.gallio.org/api/html/T_MbUnit_Framework_ExpectedArgumentNullExceptionAttribute.htm&quot;&gt;ExpectedArgumentNullException&lt;/a&gt;]&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;[&lt;a href=&quot;http://www.gallio.org/api/html/T_MbUnit_Framework_ExpectedArgumentOutOfRangeExceptionAttribute.htm&quot;&gt;ExpectedArgumentOutOfRangeException&lt;/a&gt;]&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test, ExpectedArgumentOutOfRangeException]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Constructs_Foo_with_negative_value_should_throw_exception()&lt;br /&gt;{&lt;br /&gt;   &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Foo(-123);&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Those shortcut attributes are very useful. They significantly improve the readability of the tests by removing two pairs of noisy nested parenthesis. &lt;br /&gt;&lt;br /&gt;But what if you want to define your own shortcut attribute for a custom exception of yours? Imagine for example that you use a fancy &lt;code&gt;SpaceTimeBrokenException&lt;/code&gt; all over your code. Let&#39;s define a custom shortcut expected exception attribute for it. That&#39;s very easy with Gallio&#39;s extensibility model: you just need to derive from &lt;code&gt;ExceptedExceptionAttribute&lt;/code&gt; like this:&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; Gallio.Framework.Pattern;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; MbUnit.Framework;&lt;br /&gt;&lt;br /&gt;[AttributeUsage(PatternAttributeTargets.Test, AllowMultiple = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;, Inherited = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;)]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; ExpectedSpaceTimeBrokenExceptionAttribute : ExpectedExceptionAttribute&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; ExpectedSpaceTimeBrokenExceptionAttribute()&lt;br /&gt;    : &lt;span class=&quot;kwrd&quot;&gt;base&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(SpaceTimeBrokenException))&lt;br /&gt;  {&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; ExpectedSpaceTimeBrokenExceptionAttribute(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; message)&lt;br /&gt;    : &lt;span class=&quot;kwrd&quot;&gt;base&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(SpaceTimeBrokenException), message)&lt;br /&gt;  {&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;That&#39;s all! Now just put that new class in a namespace accessible from your test project and enjoy it...&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test, ExpectedSpaceTimeBrokenException]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Run_TimeMachine_with_negative_power_should_collapse_the_entire_universe()&lt;br /&gt;{&lt;br /&gt;   &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; timeMachine = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; TimeMachine();&lt;br /&gt;   timeMachine.Run(-1E10);&lt;br /&gt;}&lt;/pre&gt;</description><link>http://interfacingreality.blogspot.com/2011/06/extending-mbunit-with-custom-expected.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-6881864925760345022</guid><pubDate>Tue, 10 May 2011 06:17:00 +0000</pubDate><atom:updated>2011-05-10T08:38:12.856+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Custom Data Source</category><category domain="http://www.blogger.com/atom/ns#">Extensibility</category><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>More About Custom Data Source Attributes</title><description>&lt;div align=&quot;justify&quot;&gt;Some weeks ago, I explained how to extend &lt;a href=&quot;http://gallio.org&quot;&gt;&lt;b&gt;Gallio/MbUnit&lt;/b&gt;&lt;/a&gt; with &lt;a href=&quot;http://interfacingreality.blogspot.com/2010/09/writing-custom-data-source-attributes.html&quot;&gt;custom data source attributes&lt;/a&gt;. The principle is to provide convenient and reusable attributes which feed test methods with data coming from an external source (e.g. file, database, distant service, etc.)&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://aleksjones.com/blog/&quot;&gt;Aleksandr Jones&lt;/a&gt; has just written &lt;a href=&quot;http://aleksjones.com/blog/?p=64&quot;&gt;a very nice article&lt;/a&gt; in his blog that illustrates the concept. He explains how to create an attribute that grabs test parameters from an OLE/SQL database. The typical usage is the following:&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test]&lt;br /&gt;[CustomAttribute(&quot;Provider=Microsoft.ACE.OLEDB.12.0;Data Source=MikeGarage.accdb;Persist Security Info=False;&quot;, &quot;Customers&quot;)]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; CustomAttributeTest(DataRow dataRow)&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;rem&quot;&gt;// ...&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;</description><link>http://interfacingreality.blogspot.com/2011/05/more-about-custom-data-source.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-2821637514522699495</guid><pubDate>Tue, 01 Mar 2011 21:05:00 +0000</pubDate><atom:updated>2011-03-14T09:34:13.258+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><category domain="http://www.blogger.com/atom/ns#">Metadata</category><title>Extending MbUnit with custom attributes</title><description>&lt;div align=&quot;justify&quot;&gt;In a &lt;a href=&quot;http://devlicio.us/blogs/krzysztof_kozmic/archive/2011/03/01/tests-and-issue-trackers-how-to-manage-the-integration.aspx&quot;&gt;recent post&lt;/a&gt;, &lt;a href=&quot;http://kozmic.pl/about/&quot;&gt;Krzysztof Kozmic&lt;/a&gt; discussed about an efficient way to link a particular test to an issue in a bug tracker. &lt;strong&gt;&lt;a href=&quot;http://gallio.org&quot;&gt;MbUnit&lt;/a&gt;&lt;/strong&gt; provides several useful metadata attributes such as &lt;code&gt;[Category]&lt;/code&gt;, &lt;code&gt;[Author]&lt;/code&gt;, &lt;code&gt;[TestsOn]&lt;/code&gt; etc. But none is about issue tracking :( Fortunately, the Gallio framework is easily extensible (did I say &lt;a href=&quot;http://interfacingreality.blogspot.com/2010/09/writing-custom-data-source-attributes.html&quot;&gt;that already&lt;/a&gt;?); let&#39;s create such an attribute.&lt;h4&gt;Custom Metadata Attribute&lt;/h4&gt;We will first create a new simple metadata attribute. We just need to derive from &lt;code&gt;&lt;a href=&quot;http://gallio.org/api/html/T_Gallio_Framework_Pattern_MetadataPatternAttribute.htm&quot;&gt;Gallio.Framework.Pattern.MetadataPatternAttribute&lt;/a&gt;&lt;/code&gt; and to implement some basic code logic in it.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[AttributeUsage(PatternAttributeTargets.TestComponent, AllowMultiple = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;, Inherited = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;)]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; IssueAttribute : MetadataPatternAttribute&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;private readonly int&lt;/span&gt; issue;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; IssueAttribute(&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; issue)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.issue = issue;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public int&lt;/span&gt; Issue&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt; { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; issue; }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;protected override&lt;/span&gt; IEnumerable&amp;lt;KeyValuePair&amp;lt;&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;&amp;gt;&amp;gt; GetMetadata()&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;yield return new&lt;/span&gt; KeyValuePair&amp;lt;&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;&amp;gt;(&quot;Issue&quot;, issue.ToString());&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;We can now use that simple attribute and enjoy the information displayed in the test report.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[TestFixture]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; MyTestFixture&lt;br /&gt;{&lt;br /&gt;  [Test, Issue(123456)]&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; MyTest()&lt;br /&gt;  {&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiGF7yEXafkq1t-KS7f1X_ZJ9DF-sbkEvExcpUpBLAfq_QtGNFl3PpJTukJCGu2nr0MWdkblBmTxI-N2U2gEsUKUiR11kzIEVC_KlgMKYCZlIFEeI0boqISzAjJV7JugQvB5TKNSQPvB4/s800/IssueMetadataAttribute.png&quot; /&gt;&lt;h4&gt;Custom Test Decorator&lt;/h4&gt;But wait! We can certainly do better. My favorite issue tracker is a fancy web application and I would like to get an hyperlink that leads me directly to that issue. We cannot use Gallio metadata for that purpose because they are only key/value pairs of strings. Therefore it&#39;s uneasy to make them hold more interesting data like an URL. We will create a new test decorator instead; and use the powerful test log API to display cool stuff in the report. Let&#39;s implement a new test decorator attribute (&lt;code&gt;&lt;a href=&quot;http://gallio.org/api/html/T_MbUnit_Framework_TestDecoratorAttribute.htm&quot;&gt;MbUnit.Framework.TestDecoratorAttribute&lt;/a&gt;&lt;/code&gt;)&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[AttributeUsage(PatternAttributeTargets.Test, AllowMultiple = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;, Inherited = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;)]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; IssueAttribute : TestDecoratorAttribute&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;private readonly int&lt;/span&gt; issue;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; IssueAttribute(&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; issue)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.issue = issue;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public int&lt;/span&gt; Issue&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt; { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; issue; }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;protected override void&lt;/span&gt; Execute(PatternTestInstanceState testInstanceState)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; (TestLog.BeginSection(&quot;Issue&quot;))&lt;br /&gt;    {&lt;br /&gt;      TestLog.Write(&quot;This test is related to the &quot;);&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; (TestLog.BeginMarker(Marker.Link(&quot;http://MyCoolBugTracker/Issue/&quot; + issue)))&lt;br /&gt;      {&lt;br /&gt;        TestLog.WriteLine(&quot;issue #&quot; + issue);&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    base.Execute(testInstanceState);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Look now at the cool link printed in the test report:&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggg7H2Fb7yp5S-uRxpyOJPRHjNEgCI5c8ukaGDkzZAYgiqLrKHUKQWtv52gFEyoJyKLKVjYx3NcqfRyuiO43ruIWRv-608oUXnj8BGwaPB3GPG8950iOzwFnAz44DkFHNhZCQv6ou2OMU/s800/IssueTestDecoratorAttribute.png&quot; /&gt;&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/03/extending-mbunit-with-custom-attributes.html</link><author>noreply@blogger.com (Yann Trevin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiGF7yEXafkq1t-KS7f1X_ZJ9DF-sbkEvExcpUpBLAfq_QtGNFl3PpJTukJCGu2nr0MWdkblBmTxI-N2U2gEsUKUiR11kzIEVC_KlgMKYCZlIFEeI0boqISzAjJV7JugQvB5TKNSQPvB4/s72-c/IssueMetadataAttribute.png" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-1460523749397987842</guid><pubDate>Mon, 28 Feb 2011 07:22:00 +0000</pubDate><atom:updated>2011-03-02T08:22:47.494+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><category domain="http://www.blogger.com/atom/ns#">NHamcrest</category><title>Announcing Gallio and MbUnit v3.2.3</title><description>&lt;div align=&quot;justify&quot;&gt;We are pleased to announce that a new release of &lt;a href=&quot;http://gallio.org&quot;&gt;Gallio/MbUnit&lt;/a&gt; is now available. This release contains many new features and improvements for MbUnit. Please see below or read the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.2.3&quot;&gt;release notes&lt;/a&gt; for more details.&lt;h4&gt;&amp;middot; Downloads&lt;/h4&gt;Please visit the Gallio website &lt;b&gt;&lt;a href=&quot;http://gallio.org/Downloads.aspx&quot;&gt;Downloads page&lt;/a&gt;&lt;/b&gt; to get the binaries, or grab them directly from here:&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.2.750.0-Setup-x86.msi&quot;&gt;Gallio/MbUnit 3.2.3 (x86 MSI installer)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.2.750.0-Setup-x64.msi&quot;&gt;Gallio/MbUnit 3.2.3 (x64 MSI installer)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://mb-unit.googlecode.com/files/GallioBundle-3.2.750.0.zip&quot;&gt;Gallio/MbUnit 3.2.3 (zip archive - no installer)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;&amp;middot; Overview&lt;/h4&gt;This release mainly focuses on new features for MbUnit.&lt;h5&gt;NHamcrest&lt;/h5&gt;&lt;a href=&quot;https://github.com/grahamrhay/NHamcrest&quot;&gt;NHamcrest&lt;/a&gt; is an idiomatic C# port of Hamcrest (java version) made by Graham Hay. It provides a nice fluent syntax for &lt;a href=&quot;http://gallio.org/api/html/Overload_MbUnit_Framework_Assert_That.htm&quot;&gt;Assert.That&lt;/a&gt;. The library is now part of the Gallio bundle.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Assert_that()&lt;br /&gt;{&lt;br /&gt;  Assert.That(1, Is.Anything());&lt;br /&gt;&lt;br /&gt;  Assert.That(1 + 1, Is.EqualTo(2));&lt;br /&gt;  Assert.That(&quot;string&quot;, Is.EqualTo(&quot;string&quot;));&lt;br /&gt;  Assert.That(5.0, Is.EqualTo(5.0));&lt;br /&gt;&lt;br /&gt;  Assert.That(&lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;, Is.False());&lt;br /&gt;  Assert.That(&lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;, Is.True());&lt;br /&gt;&lt;br /&gt;  Assert.That(&lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;, Is.Null());&lt;br /&gt;  Assert.That(&quot;&quot;, Is.NotNull());&lt;br /&gt;&lt;br /&gt;  Assert.That(5, Is.LessThan(6));&lt;br /&gt;  Assert.That(5, Is.GreaterThan(4));&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;const string&lt;/span&gt; aString = &quot;aString&quot;;&lt;br /&gt;  Assert.That(aString, Is.SameAs(aString));&lt;br /&gt;  Assert.That(&quot;the cat sat on the mat&quot;, Starts.With(&quot;the cat&quot;));&lt;br /&gt;  Assert.That(&quot;the cat sat on the mat&quot;, Contains.String(&quot;sat on&quot;));&lt;br /&gt;  Assert.That(&quot;the cat sat on the mat&quot;, Ends.With(&quot;the mat&quot;));&lt;br /&gt;&lt;br /&gt;  Assert.That(1, Is.InstanceOf&amp;lt;&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt;&amp;gt;());&lt;br /&gt;&lt;br /&gt;  Assert.That(() =&amp;gt; { &lt;span class=&quot;kwrd&quot;&gt;throw new&lt;/span&gt; ArgumentException(); }, Throws.An&amp;lt;ArgumentException&amp;gt;());&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;&lt;h5&gt;Assert.HasAttribute(s)&lt;/h5&gt;&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:assertions:attribute&quot;&gt;2 new assertions&lt;/a&gt; to check whether a code element is decorated with a specific attribute. Those assertions are particularly powerful when used in combination with the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:mirror&quot;&gt;Mirror API&lt;/a&gt;.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[DisplayName(&quot;Item&quot;)]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; Product&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public int&lt;/span&gt; Id { &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt;; &lt;span class=&quot;kwrd&quot;&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;br /&gt;  [Required, StringLength(10)]&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public string&lt;/span&gt; Name { &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt;; &lt;span class=&quot;kwrd&quot;&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;br /&gt;  [Required]&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public string&lt;/span&gt; Description { &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt;; &lt;span class=&quot;kwrd&quot;&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;br /&gt;  [Required, Range(0, 1000)]&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public decimal&lt;/span&gt; Price { &lt;span class=&quot;kwrd&quot;&gt;get&lt;/span&gt;; &lt;span class=&quot;kwrd&quot;&gt;set&lt;/span&gt;; }&lt;br /&gt;}&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[TestFixture]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; ProductTest&lt;br /&gt;{&lt;br /&gt;  [Test]&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Product_has_DisplayNameAttribute()&lt;br /&gt;  {&lt;br /&gt;    Assert.HasAttribute&amp;lt;DisplayNameAttribute&amp;gt;(&lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(Product));&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  [Test]&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Description_has_RequiredAttribute()&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; property = Mirror.ForType&amp;lt;Product&amp;gt;()[&quot;Description&quot;];&lt;br /&gt;    Assert.HasAttribute&amp;lt;RequiredAttribute&amp;gt;(property);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;&lt;h5&gt;Case insensitive string matching.&lt;/h5&gt;&lt;a href=&quot;http://gallio.org/api/html/Overload_MbUnit_Framework_Assert_Contains.htm&quot;&gt;Assert.Contains&lt;/a&gt;, &lt;a href=&quot;http://gallio.org/api/html/Overload_MbUnit_Framework_Assert_DoesNotContain.htm&quot;&gt;Assert.DoesNotContain&lt;/a&gt;, &lt;a href=&quot;http://gallio.org/api/html/Overload_MbUnit_Framework_Assert_StartsWith.htm&quot;&gt;Assert.StartsWith&lt;/a&gt;, and &lt;a href=&quot;http://gallio.org/api/html/Overload_MbUnit_Framework_Assert_EndsWith.htm&quot;&gt;Assert.EndsWith&lt;/a&gt; now support case insensitive string matching.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Assert_contains()&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; actualValue = &quot;Edgar Allan Poe (January 19, 1809 – October 7, 1849)&quot;;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; expectedSubstring = &quot;ALLAN POE&quot;;&lt;br /&gt;  Assert.Contains(actualValue, expectedSubstring, StringComparison.OrdinalIgnoreCase);&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;&lt;h5&gt;Assert.DoesNotExist&lt;/h5&gt;Again a &lt;a href=&quot;http://gallio.org/api/html/Overload_MbUnit_Framework_Assert_DoesNotExist.htm&quot;&gt;new assertion&lt;/a&gt; which finally brings some symmetry to &lt;a href=&quot;http://gallio.org/api/html/Overload_MbUnit_Framework_Assert_Exists.htm&quot;&gt;Assert.Exists&lt;/a&gt;.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Assert_doesNotExist()&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; data = new[] { &quot;Athos&quot;, &quot;Porthos&quot;, &quot;Aramis&quot; };&lt;br /&gt;  Assert.DoesNotExist(data, x =&gt; x.Contains(&quot;gnan&quot;));&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;&lt;h5&gt;Multiple [Impersonate] instances&lt;/h5&gt;Running tests under another identity is a little-known feature of MbUnit. It is now possible to provide several user credentials at once.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test]&lt;br /&gt;[Impersonate(UserName = &quot;Julius&quot;, Password = &quot;Ven1V1d1V1c1&quot;)]&lt;br /&gt;[Impersonate(UserName = &quot;Brutus&quot;, Password = &quot;F**kD4ddy&quot;)]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Test()&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; identity = WindowsIdentity.GetCurrent();&lt;br /&gt;  TestLog.Write(&quot;User = {0}&quot;, identity.Name);&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;&lt;h5&gt;And many other things...&lt;/h5&gt;Such as improvements to contract verifiers, &quot;Seed&quot; property to the random data sources, easier ways to assert over inner exceptions, etc.&lt;h4&gt;&amp;middot; Credits&lt;/h4&gt;This great release was made possible thanks to the hard work of our dedicated fellow contributors:&lt;ul&gt;&lt;li&gt;Graham Hay&lt;/li&gt;&lt;li&gt;Artur Zgodziński&lt;/li&gt;&lt;li&gt;Jonathan Linstead&lt;/li&gt;&lt;li&gt;Yann Trévin&lt;/li&gt;&lt;/ul&gt;And a special thank to &lt;strong&gt;Jeff Brown&lt;/strong&gt; for his invaluable advices and his deep knowledge of the Gallio infrastructure. &lt;br /&gt;&lt;br /&gt;Finally, we would like to express our gratitude to our passionate users who help us in building that great piece of software by submitting bug reports, patches, blog posts, and suggestions.&lt;br /&gt;&lt;br /&gt;And more than ever, &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=devel:how_to_contribute&quot;&gt;contributions are gratefully received&lt;/a&gt;.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/02/announcing-gallio-and-mbunit-v323.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-4123130929151485561</guid><pubDate>Fri, 18 Feb 2011 09:41:00 +0000</pubDate><atom:updated>2011-02-18T11:32:05.402+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">Test Report</category><title>Multi-page Reports in Gallio/MbUnit v3.3</title><description>&lt;div align=&quot;justify&quot;&gt;While the announcement of a &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.2.3&quot;&gt;new intermediate release&lt;/a&gt; of &lt;a href=&quot;http://gallio.org&quot;&gt;&lt;strong&gt;Gallio/MbUnit&lt;/strong&gt;&lt;/a&gt; is imminent (next week?), we are continuing to focus on the major improvements that will be available in the future versions.&lt;br /&gt;&lt;br /&gt;In case you are running &lt;a href=&quot;http://gallio.org&quot;&gt;&lt;strong&gt;Gallio&lt;/strong&gt;&lt;/a&gt; against very large test suites (&gt; 10000 tests), you might be interested by the following new feature. You can experiment it already by installing the latest &lt;a href=&quot;http://ccnet.gallio.org/Distributables/&quot;&gt;v3.3 daily build&lt;/a&gt; (it&#39;s pretty stable already, IMHO)&lt;br /&gt;&lt;br /&gt;As you may know, we dropped the XSL-based engine used for the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=gallio:reporting&quot;&gt;report generation&lt;/a&gt;, in favor of high performing VTL templates (based on &lt;a href=&quot;http://www.castleproject.org/others/nvelocity/index.html&quot;&gt;Castle NVelocity&lt;/a&gt;). The generation of the Text/HTML reports (&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=tools:gallio_report_types#text&quot;&gt;Text&lt;/a&gt;, &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=tools:gallio_report_types#text-condensed&quot;&gt;Text-Condensed&lt;/a&gt;, &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=tools:gallio_report_types#html&quot;&gt;Html&lt;/a&gt;, &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=tools:gallio_report_types#html-condensed&quot;&gt;Html-Condensed&lt;/a&gt;, &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=tools:gallio_report_types#xhtml&quot;&gt;XHtml&lt;/a&gt;, and &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=tools:gallio_report_types#xhtml-condensed&quot;&gt;XHtml-Condensed&lt;/a&gt;) is about 3 times faster. But more important, the report writer now supports multi-paging. Say goodbye to the heavy 20Mb reports that take hours to open in the web browser! Gallio is now able to split large reports into several smaller browsable files.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTaJfB-wHJy7AWLFGKP1Rg0idAWyLZXL_CIq7dO1HtMCGmE1BdQuJFA8XUUAw-hGZtMKUmDxvMwaXLaLnk5YpJ96I4cG4HvjjxHn3cyfP4xpY61ONTZwp-nriDi-6IsvmZGXYKihdYPOY/s800/MultiplePageReport.png&quot; /&gt;&lt;br /&gt;&lt;br /&gt;You might configure some parameters from the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=tools:control_panel#reports_settings&quot;&gt;Gallio Control Panel&lt;/a&gt;. It&#39;s machine-wide settings that will affect the reports generated by every tool and test runner.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;http://gallio.org/wiki/lib/exe/fetch.php?media=tools:controlpanel_gallio_reports.png&quot; /&gt;&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/02/multi-page-reports-in-galliombunit-v33.html</link><author>noreply@blogger.com (Yann Trevin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTaJfB-wHJy7AWLFGKP1Rg0idAWyLZXL_CIq7dO1HtMCGmE1BdQuJFA8XUUAw-hGZtMKUmDxvMwaXLaLnk5YpJ96I4cG4HvjjxHn3cyfP4xpY61ONTZwp-nriDi-6IsvmZGXYKihdYPOY/s72-c/MultiplePageReport.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-1665315948470321472</guid><pubDate>Wed, 19 Jan 2011 10:54:00 +0000</pubDate><atom:updated>2011-01-19T12:06:43.559+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>What&#39;s next?</title><description>&lt;div align=&quot;justify&quot;&gt;&lt;a href=&quot;http://interfacingreality.blogspot.com/2011/01/announcing-gallio-and-mbunit-v322.html&quot;&gt;Gallio/MbUnit v3.2.2&lt;/a&gt; was released some days ago. And we&#39;ve got many &quot;thank you&quot; for the resolution of this annoying &lt;a href=&quot;http://code.google.com/p/mb-unit/issues/detail?id=784&quot;&gt;CS1685 issue&lt;/a&gt; (thank you Graham for having fixed it). &lt;br /&gt;&lt;br /&gt;Now what can you expect from the incoming releases of Gallio? The path to v3.3 is still long, but we plan to release several intermediate point releases with more fixes, more improvements and a lot of new features. In a random order, here is an overview of those future new nifty features:&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Major performance improvements&lt;/strong&gt;: We are in the process of replacing the XSLT-based engine which generates the test reports by a brand new and faster system based on &lt;a href=&quot;http://www.castleproject.org/others/nvelocity/index.html&quot;&gt;Castle NVelocity&lt;/a&gt;. We also would like to do no longer rely on that damn slow &lt;span style=&quot;font-style:italic;&quot;&gt;.NET Remoting&lt;/span&gt; for IPC communications and to use the popular &lt;a href=&quot;http://code.google.com/p/protobuf/&quot;&gt;Google&#39;s Protobuf&lt;/a&gt; format instead. Those major changes should bring dramatic performance improvements while running the tests and formatting the test reports.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;http://www.gallio.org/wiki/doku.php?id=mbunitcpp&quot;&gt;MbUnitCpp&lt;/a&gt;&lt;/strong&gt;: a port of the &lt;a href=&quot;http://www.gallio.org/wiki/doku.php?id=mbunit&quot;&gt;MbUnit&lt;/a&gt; testing framework to the native unmanaged C++ realm; entirely integrated to the Gallio ecosystem. It’s not feature complete yet, but MbUnitCpp is already fully functional and available as part of the &lt;a href=&quot;http://ccnet.gallio.org/Distributables/&quot;&gt;daily v3.3 builds&lt;/a&gt;. The wiki documentation is also very detailed already; with a comprehensive &lt;a href=&quot;http://www.gallio.org/wiki/doku.php?id=mbunitcpp:getting_started&quot;&gt;tutorial&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/grahamrhay/NHamcrest&quot;&gt;NHamcrest&lt;/a&gt; support&lt;/strong&gt;: Graham Hay did port recently &lt;a href=&quot;http://code.google.com/p/hamcrest/&quot;&gt;Hamcrest&lt;/a&gt; to C#. &lt;a href=&quot;http://www.gallio.org/api/html/Overload_MbUnit_Framework_AssertEx_That.htm&quot;&gt;&lt;/code&gt;Assert.That&lt;/code&gt;&lt;/a&gt; is going to be extended to support that fluent API.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;http://partcover.blogspot.com/&quot;&gt;PartCover&lt;/a&gt; support&lt;/strong&gt;: A new adapter for this excellent test coverage tool.&lt;/li&gt;&lt;li&gt;New assertions, new contract verifiers, and many other little enhancements (see &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.3&quot;&gt;draft release notes&lt;/a&gt; for detailed)&lt;/li&gt;&lt;/ul&gt;Some of those features are in fact fully or partially available in the &lt;a href=&quot;http://code.google.com/p/mb-unit/source/list&quot;&gt;v3.3 trunk&lt;/a&gt; already. Feel free to test them. Feedback and suggestions are always &lt;a href=&quot;http://groups.google.com/group/gallio-user&quot;&gt;gratefully received&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;And of course, we will continue to closely follow the continuous releases of the 3rd party tools that coexist in the Gallio ecosystem and to update the existing test adapters and plugins accordingly.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/01/whats-next.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-5001581279787494507</guid><pubDate>Thu, 13 Jan 2011 06:49:00 +0000</pubDate><atom:updated>2011-01-13T07:52:35.162+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Announcing Gallio and MbUnit v3.2.2</title><description>&lt;div align=&quot;justify&quot;&gt;We are pleased to announce that a maintenance release of &lt;a href=&quot;http://gallio.org&quot;&gt;Gallio/MbUnit&lt;/a&gt; is now available. This release mainly contains many bug fixes and little enhancements. It fixes in particular this annoying &lt;a href=&quot;http://code.google.com/p/mb-unit/issues/detail?id=784&quot;&gt;CS1685&lt;/a&gt; warning. Read the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.2.2&quot;&gt;release notes&lt;/a&gt; for more details.&lt;br /&gt;&lt;br /&gt;Please visit the Gallio website &lt;b&gt;&lt;a href=&quot;http://gallio.org/Downloads.aspx&quot;&gt;Downloads page&lt;/a&gt;&lt;/b&gt; to get the binaries, or grab them directly from here:&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/mb-unit/downloads/detail?name=GallioBundle-3.2.708.0-Setup-x86.msi&quot;&gt;Gallio/MbUnit 3.2.2 (x86 MSI installer)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/mb-unit/downloads/detail?name=GallioBundle-3.2.708.0-Setup-x64.msi&quot;&gt;Gallio/MbUnit 3.2.2 (x64 MSI installer)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/mb-unit/downloads/detail?name=GallioBundle-3.2.708.0.zip&quot;&gt;Gallio/MbUnit 3.2.2 (zip archive - no installer)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2011/01/announcing-gallio-and-mbunit-v322.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-8115763752020343536</guid><pubDate>Fri, 03 Dec 2010 07:00:00 +0000</pubDate><atom:updated>2011-01-13T07:53:25.221+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Announcing Gallio and MbUnit v3.2.1</title><description>&lt;div align=&quot;justify&quot;&gt;We are pleased to announce that a maintenance release of &lt;a href=&quot;http://gallio.org&quot;&gt;Gallio/MbUnit&lt;/a&gt; is now available. This release mainly contains many bug fixes and little enhancements. But it also features the long-awaited support to &lt;a href=&quot;http://www.jetbrains.com/dotcover/&quot;&gt;Jetbrains dotCover&lt;/a&gt;. See the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.2.1&quot;&gt;release notes&lt;/a&gt; for more details.&lt;br /&gt;&lt;br /&gt;Please visit the Gallio website &lt;b&gt;&lt;a href=&quot;http://gallio.org/Downloads.aspx&quot;&gt;Downloads page&lt;/a&gt;&lt;/b&gt; to get the binaries, or grab them directly from here:&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/mb-unit/downloads/detail?name=GallioBundle-3.2.679.0-Setup-x86.msi&quot;&gt;Gallio/MbUnit 3.2.1 (x86 MSI installer)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/mb-unit/downloads/detail?name=GallioBundle-3.2.679.0-Setup-x64.msi&quot;&gt;Gallio/MbUnit 3.2.1 (x64 MSI installer)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/mb-unit/downloads/detail?name=GallioBundle-3.2.679.0.zip&quot;&gt;Gallio/MbUnit 3.2.1 (zip archive - no installer)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2010/12/announcing-gallio-and-mbunit-v321.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-7109758127647949081</guid><pubDate>Mon, 15 Nov 2010 12:27:00 +0000</pubDate><atom:updated>2010-11-15T14:05:48.109+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">Hamcrest</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><category domain="http://www.blogger.com/atom/ns#">NHamcrest</category><title>MbUnit v3 to support (N)Hamcrest</title><description>&lt;div align=&quot;justify&quot;&gt;Recently, Graham Hay did port the well-known &lt;a href=&quot;http://code.google.com/p/hamcrest/&quot;&gt;Hamcrest&lt;/a&gt; library to .NET. The new version of that library was judiciously ;) named &lt;a href=&quot;https://github.com/grahamrhay/NHamcrest&quot;&gt;NHamcrest&lt;/a&gt;. It is also fully integrated to &lt;a href=&quot;http://gallio.org&quot;&gt;Gallio/MbUnit&lt;/a&gt; with &lt;code&gt;Assert.That&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Try it out by downloading the &lt;a href=&quot;http://ccnet.gallio.org/Distributables/&quot;&gt;latest v3.3 daily build&lt;/a&gt; and give us &lt;a href=&quot;http://groups.google.com/group/gallio-user/browse_thread/thread/278c59cdb71881e7&quot;&gt;feedback and suggestions&lt;/a&gt;.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; NHamcrestExample()&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; array = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt;[] {&quot;red&quot;, &quot;green&quot;, &quot;blue&quot;};&lt;br /&gt;  Assert.That(array, Is.InstanceOf(typeof(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;[])));&lt;br /&gt;  Assert.That(array, Has.Items(new[] { &quot;green&quot;, &quot;red&quot; }));&lt;br /&gt;  Assert.That(array, Has.Item&amp;lt;&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;&amp;gt;(Starts.With(&quot;bl&quot;)));&lt;br /&gt;}&lt;/pre&gt;</description><link>http://interfacingreality.blogspot.com/2010/11/mbunit-v3-to-support-nhamcrest.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-1453838235079662783</guid><pubDate>Thu, 07 Oct 2010 12:35:00 +0000</pubDate><atom:updated>2010-10-07T15:02:42.573+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Custom Data Source</category><category domain="http://www.blogger.com/atom/ns#">Extensibility</category><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Testing Custom Data Source Attributes in MbUnit v3.2</title><description>&lt;div align=&quot;justify&quot;&gt;In a &lt;a href=&quot;http://interfacingreality.blogspot.com/2010/09/writing-custom-data-source-attributes.html&quot;&gt;recent post&lt;/a&gt;, I explained how to create a custom data source attribute for &lt;a href=&quot;http://gallio.org&quot;&gt;MbUnit&lt;/a&gt;. But before using it, it&#39;s certainly safer to test it. The method described below is the same as the one which is applied in the &lt;a href=&quot;http://code.google.com/p/mb-unit/source/browse/#svn/trunk/v3/src/MbUnit/MbUnit.Tests/Framework&quot;&gt;MbUnit test project&lt;/a&gt; itself. It is widely used to verify that the built-in attributes of MbUnit behave as expected. The principle is the following:&lt;ol&gt;&lt;li&gt;Create a nested explicit sample test fixture which consumes the attribute under test. It must be marked as &lt;span style=&quot;font-weight:bold;&quot;&gt;explicit&lt;/span&gt;, so that it will not be taken in account by the primary test runner.&lt;/li&gt;&lt;li&gt;Create a regular unit test which launches an inner isolated test runner, and runs the sample fixture.&lt;/li&gt;&lt;li&gt;Retrieve the output of the inner test runner and assert over the test log.&lt;/li&gt;&lt;/ol&gt;The Gallio framework has everything you need to create an isolated test runner. But in order to make the things easier, the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=devel:gallio_sdk&quot;&gt;Gallio SDK&lt;/a&gt; (you can find the SDK under &lt;code&gt;%gallio_install_path%\sdk&lt;/code&gt;) contains a couple of handy helper classes for that very purpose. It provides in particular a &lt;code&gt;BaseTestWithSampleRunner&lt;/code&gt; class that you can use as a base class of you main fixture, and a &lt;code&gt;[RunSample]&lt;/code&gt; attribute to easily target the nested explicit sample fixtures.&lt;br /&gt;&lt;br /&gt;Here is a simple example that shows how to test the &lt;code&gt;[BooleanData]&lt;/code&gt; attribute that we did create &lt;a href=&quot;http://interfacingreality.blogspot.com/2010/09/writing-custom-data-source-attributes.html&quot;&gt;last time&lt;/a&gt;.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[TestFixture, RunSample(&lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(SampleFixture))]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; BooleanDataAttributeTest : BaseTestWithSampleRunner&lt;br /&gt;{&lt;br /&gt;  [Test]&lt;br /&gt;  public void Test()&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; runs = GetTestStepRuns(&lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(SampleFixture), &quot;Test&quot;);&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; logs = runs.Select(GetLog).Where(x =&gt; x.Length &gt; 0);&lt;br /&gt;    Assert.AreElementsEqualIgnoringOrder(&lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt;[] { &quot;value=True&quot;, &quot;value=False&quot; }, logs);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  [TestFixture, Explicit]&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;internal class&lt;/span&gt; SampleFixture&lt;br /&gt;  {&lt;br /&gt;    [Test]&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Test([BooleanData] &lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; value)&lt;br /&gt;    {&lt;br /&gt;      TestLog.Write(&quot;value={0}&quot;, value);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Want to know more? Be sure to read &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=devel:custom_mbunit_data_source_testability&quot;&gt;this page&lt;/a&gt; in the Gallio wiki.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2010/10/testing-custom-data-source-attributes.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-7787159958052676302</guid><pubDate>Wed, 22 Sep 2010 08:31:00 +0000</pubDate><atom:updated>2010-09-23T09:50:45.031+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Announcing Gallio and MbUnit v3.2</title><description>&lt;div align=&quot;justify&quot;&gt;We are pleased to announce the release of &lt;a href=&quot;http://gallio.org&quot;&gt;Gallio&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://www.mbunit.com&quot;&gt;MbUnit&lt;/a&gt; v3.2. Please visit the Gallio website &lt;b&gt;&lt;a href=&quot;http://gallio.org/Downloads.aspx&quot;&gt;download page&lt;/a&gt;&lt;/b&gt;. This is a major release with many new features and enhancements. See the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.2&quot;&gt;release notes&lt;/a&gt; for more details.&lt;br /&gt;&lt;br /&gt;Be sure to read &lt;a href=&quot;http://weblogs.asp.net/astopford/archive/2010/09/22/mbunit-gallio-3-3.aspx&quot;&gt;Andy&#39;s blog post&lt;/a&gt; too.&lt;/div&gt;&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=start&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSRm2S5O6lCm3TTBdaDFtOZyplT7vJtv-n0QFlvYRUi3NxJz2d9tlFQ2PWtEHwXqoBWBcVR4fnNRyBVNfdFqnOZnpkBGfbO3unefNHOzVGfFsJqI0ZYkhDtnJ-js0ttS7VWiGdB3w4LAk/s800/Galliov32.png&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</description><link>http://interfacingreality.blogspot.com/2010/09/announcing-gallio-and-mbunit-v32.html</link><author>noreply@blogger.com (Yann Trevin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSRm2S5O6lCm3TTBdaDFtOZyplT7vJtv-n0QFlvYRUi3NxJz2d9tlFQ2PWtEHwXqoBWBcVR4fnNRyBVNfdFqnOZnpkBGfbO3unefNHOzVGfFsJqI0ZYkhDtnJ-js0ttS7VWiGdB3w4LAk/s72-c/Galliov32.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-6425730384803250207</guid><pubDate>Fri, 03 Sep 2010 12:06:00 +0000</pubDate><atom:updated>2010-09-03T20:32:03.503+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Custom Data Source</category><category domain="http://www.blogger.com/atom/ns#">Extensibility</category><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Writing Custom Data Source Attributes in MbUnit v3.2</title><description>&lt;div align=&quot;justify&quot;&gt;The extensibility of the &lt;a href=&quot;http://gallio.org&quot;&gt;Gallio platform&lt;/a&gt; is simply amazing. You can virtually extend any part of the system. It goes from a &lt;a href=&quot;http://blog.thomas-weller.de/archive/2010/04/28/mocking-the-unmockable-using-microsoft-moles-with-gallio.aspx&quot;&gt;simple plugin&lt;/a&gt; that provides new handy functionalities to a &lt;a href=&quot;http://www.ndl.kiev.ua/content/gallio-adapter-boosttest&quot;&gt;full-blown adapter&lt;/a&gt; for your fancy testing framework. Today, I would like to explain how easy it is to extend the &lt;a href=&quot;http://mbunit.com&quot;&gt;MbUnit&lt;/a&gt; framework with a custom data source attribute. &lt;br /&gt;&lt;br /&gt;MbUnit has many useful built-in data source attributes which might be used to create powerful &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing&quot;&gt;data-driven tests&lt;/a&gt;. The most popular attributes are certainly &lt;code&gt;&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing:row&quot;&gt;[Row]&lt;/a&gt;&lt;/code&gt; and &lt;code&gt;&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing:column&quot;&gt;[Column]&lt;/a&gt;&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Now let&#39;s imagine you get bored with writing that kind of tests:&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public void&lt;/span&gt; Mytest(&lt;br /&gt;  [Column(&lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;)] &lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; flag1, &lt;br /&gt;  [Column(&lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;)] &lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; flag2, &lt;br /&gt;  [Column(&lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;)] &lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; flag3)&lt;br /&gt;{&lt;br /&gt;  // ...&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Imagine how beautiful would be the world if you could write the following instead:&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[Test]&lt;br /&gt;public void Mytest(&lt;br /&gt;  [BooleanData] &lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; flag1, &lt;br /&gt;  [BooleanData] &lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; flag2, &lt;br /&gt;  [BooleanData] &lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt; flag3)&lt;br /&gt;{&lt;br /&gt;  // ...&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Unfortunately, this data source attribute does not exist in MbUnit. &lt;br /&gt;&lt;br /&gt;So let&#39;s make it happen!&lt;br /&gt;&lt;br /&gt;Creating a custom data source is very easy. Basically you simply need to derive from &lt;code&gt;&lt;a href=&quot;http://gallio.org/api/html/T_MbUnit_Framework_DataAttribute.htm&quot;&gt;MbUnit.Framework.DataAttribute&lt;/a&gt;&lt;/code&gt;, and to override the virtual method &lt;code&gt;&lt;a href=&quot;http://gallio.org/api/html/M_Gallio_Framework_Pattern_DataPatternAttribute_PopulateDataSource.htm&quot;&gt;PopulateDataSource&lt;/a&gt;&lt;/code&gt;.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[AttributeUsage(PatternAttributeTargets.DataContext, AllowMultiple = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;, Inherited = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;)]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; BooleanDataAttribute : DataAttribute&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;protected override void&lt;/span&gt; PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)&lt;br /&gt;  {&lt;br /&gt;    dataSource.AddDataSet(&lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ValueSequenceDataSet(&lt;span class=&quot;kwrd&quot;&gt;new object&lt;/span&gt;[] { &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt; }, GetMetadata(), &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;));&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;That&#39;s all. Compile and run your test happily!&lt;br /&gt;&lt;br /&gt;You might find more inspiration by examining the actual implementation of existing built-in attributes such as &lt;code&gt;&lt;a href=&quot;http://code.google.com/p/mb-unit/source/browse/trunk/v3/src/MbUnit/MbUnit/Framework/EnumDataAttribute.cs&quot;&gt;[EnumData]&lt;/a&gt;&lt;/code&gt; or &lt;code&gt;&lt;a href=&quot;http://code.google.com/p/mb-unit/source/browse/trunk/v3/src/MbUnit/MbUnit/Framework/RandomStringsAttribute.cs&quot;&gt;[RandomStrings]&lt;/a&gt;&lt;/code&gt; which is slightly more complicated as it relies on the underlying &lt;a href=&quot;http://interfacingreality.blogspot.com/2009/10/data-generation-framework-in-mbunit-v31.html&quot;&gt;Gallio data generation framework&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Next time, I will explain how to properly test you custom data source attribute by using the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=devel:gallio_sdk&quot;&gt;Gallio SDK&lt;/a&gt;.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2010/09/writing-custom-data-source-attributes.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-7536731364245283559</guid><pubDate>Tue, 31 Aug 2010 06:05:00 +0000</pubDate><atom:updated>2010-08-31T08:21:44.959+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">data-driven testing</category><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Data-Driven Testing in MbUnit v3</title><description>&lt;div align=&quot;justify&quot;&gt;&lt;a href=&quot;http://mbunit.com/&quot;&gt;MbUnit&lt;/a&gt; was mostly known in the past as &lt;span style=&quot;font-weight:bold;&quot;&gt;the&lt;/span&gt; testing framework dedicated to data-driven testing. This is certainly due to the very popular &lt;code&gt;&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing:row&quot;&gt;[Row]&lt;/a&gt;&lt;/code&gt; attribute. But unsurprisingly this statement is still true in version 3 as the support for data-driven testing is still certainly one the most powerful feature of &lt;a href=&quot;http://gallio.org&quot;&gt;Gallio/MbUnit v3&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;But the famous &lt;code&gt;[Row]&lt;/code&gt; attribute is not the only way to create data-driven tests. We have written &lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing&quot;&gt;several articles and tutorials&lt;/a&gt;&lt;/span&gt; in the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=start&quot;&gt;Gallio Wiki&lt;/a&gt; which cover that wide topic. All the pages have not been written yet, but you will find many useful samples and details already. They explain how to use the &lt;code&gt;[Row]&lt;/code&gt;, &lt;code&gt;[Column]&lt;/code&gt; and &lt;code&gt;[Factory]&lt;/code&gt; attributes, how to combine them and how to flavor them with tasty parameters. In the next coming weeks, you will read more about external and generative data sources as well.&lt;/div&gt;&lt;br /&gt;&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=start&quot;&gt;&lt;img src=&quot;http://gallio.org/wiki/lib/exe/fetch.php?media=mbunitwiki.png&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</description><link>http://interfacingreality.blogspot.com/2010/08/data-driven-testing-in-mbunit-v3.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-8231150728316553101</guid><pubDate>Sun, 18 Jul 2010 13:14:00 +0000</pubDate><atom:updated>2010-07-18T15:28:51.101+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Assertion</category><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Assert.Count in MbUnit v3.2</title><description>&lt;div align=&quot;justify&quot;&gt;&lt;code&gt;&lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:assertions:collection#assertcount&quot;&gt;Assert.Count&lt;/a&gt;&lt;/code&gt; is a last-minute addition made to &lt;a href=&quot;http://mbunit.com&quot;&gt;Gallio/MbUnit v3.2&lt;/a&gt; just before passing to &lt;a href=&quot;http://interfacingreality.blogspot.com/2010/07/gallio-mbunit-32-rc.html&quot;&gt;RC&lt;/a&gt;. Be sure to read the &lt;a href=&quot;http://vkreynin.wordpress.com/2010/07/18/assert-count-in-mbunit-version-3-2/&quot;&gt;nice article&lt;/a&gt; that &lt;a href=&quot;http://vkreynin.wordpress.com/&quot;&gt;Vadim Kreynin&lt;/a&gt; has written about that new convenient assertion.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2010/07/assertcount-in-mbunit-v32.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-918728939483065858</guid><pubDate>Thu, 15 Jul 2010 18:39:00 +0000</pubDate><atom:updated>2010-07-17T10:25:31.072+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Gallio &amp; MbUnit 3.2 RC</title><description>&lt;div align=&quot;justify&quot;&gt;Graham has unleashed today &lt;a href=&quot;http://groups.google.com/group/gallio-user/browse_thread/thread/c2d66cf11a7503e2&quot;&gt;Gallio v3.2 RC&lt;/a&gt; in the wild:&lt;br /&gt;&lt;blockquote&gt;The latest build of Gallio &amp; MbUnit 3.2 (build 517) is considered a Release Candidate, you can find it &lt;a href=&quot;http://gallio.org/Downloads.aspx/&quot;&gt;here&lt;/a&gt;. Release notes are on the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=release_notes:v3.2&quot;&gt;wiki&lt;/a&gt;. This means no new features will be added, but obviously any critical bugs will be fixed before the official release.&lt;br /&gt;&lt;br /&gt;We&#39;re aware that it&#39;s been a long time since the last release, and we&#39;re hoping to push more frequent smaller releases over the coming months.&lt;br /&gt;&lt;br /&gt;Please download it and let us know what you think!&lt;/blockquote&gt;&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2010/07/gallio-mbunit-32-rc.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-5771952649612789703</guid><pubDate>Mon, 12 Jul 2010 05:58:00 +0000</pubDate><atom:updated>2010-07-12T08:12:56.060+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">ReSharper</category><title>Gallio v3.2 + ReSharper 5.1</title><description>&lt;div align=&quot;justify&quot;&gt;As you may know, Graham Hay is one of the major contributors of the Gallio project. He has committed recently an amazing amount of work to make &lt;a href=&quot;http://gallio.org&quot;&gt;Gallio&lt;/a&gt; support the latest version of &lt;a href=&quot;http://www.jetbrains.com/resharper/&quot;&gt;JetBrains ReSharper&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The version 5.1 of R# has not been officially released yet; but you can run your tests with Gallio and that very popular Visual Studio extension already.&lt;br /&gt;&lt;br /&gt;Download &lt;a href=&quot;http://ccnet.gallio.org/Distributables/&quot;&gt;here&lt;/a&gt; the latest build of the Gallio bundle.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2010/07/gallio-v32-resharper-51.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-3363695691257331054</guid><pubDate>Tue, 01 Jun 2010 12:14:00 +0000</pubDate><atom:updated>2010-06-01T14:45:30.453+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><category domain="http://www.blogger.com/atom/ns#">Presentation</category><title>Niklas Dahlman talks about advanced features of MbUnit v3</title><description>It seems that I had totally missed &lt;a href=&quot;http://vimeo.com/9936524&quot;&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;that great presentation&lt;/span&gt;&lt;/a&gt; by Niklas Dahlman about some advanced features of &lt;a href=&quot;http://gallio.org&quot;&gt;MbUnit v3&lt;/a&gt;. The session was recorded in November 2009 during the &lt;a href=&quot;http://www.oredev.org&quot;&gt;&amp;Oslash;redev&lt;/a&gt; conference.&lt;br /&gt;&lt;br /&gt;In particular I like very much the part about the contract verifiers. Niklas shows a couple of very nice examples.</description><link>http://interfacingreality.blogspot.com/2010/06/niklas-dahlman-talks-about-advanced.html</link><author>noreply@blogger.com (Yann Trevin)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2475940304863204716.post-4913649207942673829</guid><pubDate>Tue, 18 May 2010 12:23:00 +0000</pubDate><atom:updated>2010-07-17T18:30:15.457+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Contract Verifier</category><category domain="http://www.blogger.com/atom/ns#">Gallio</category><category domain="http://www.blogger.com/atom/ns#">Hash</category><category domain="http://www.blogger.com/atom/ns#">MbUnit</category><title>Hash Code Acceptance Contract Verifier in MbUnit v3</title><description>&lt;div align=&quot;justify&quot;&gt;Designing a good hash code generation algorithm is a black art. There is no formal and objective way to determine what is the best algorithm for a given scenario. In fact, most of the developers do not know how exactly to implement efficiently hash functions. As you know, hash functions for a given type are implemented in .NET by overriding the method &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx&quot;&gt;&lt;code&gt;Object.GetHashCode()&lt;/code&gt;&lt;/a&gt;. Most of us (including myself, I must admit) usually shake up and down the values by shifting and xoring them randomly without knowing exactly if the result will be good enough. It’s even worse: if the implementation is poor, your application will continue to work because a bad hash function does &quot;only&quot; affect performance. So you might even not be able to notice it immediately.&lt;br /&gt;&lt;br /&gt;In the other hand, testing a hash function is cumbersome. A good hash function should have the following properties:&lt;ul&gt;&lt;li&gt;Low probability of collision; meaning that the odds to get two values that produces the same hash code should be as low as possible.&lt;/li&gt;&lt;li&gt;Hash codes should be distributed uniformly.&lt;/li&gt;&lt;li&gt;It should achieve &quot;&lt;a href=&quot;http://en.wikipedia.org/wiki/Avalanche_effect&quot;&gt;avalanche&lt;/a&gt;&quot; by generating hash values wildly different if even a single bit is different in the input key.&lt;/li&gt;&lt;/ul&gt;Writing unit tests for a hash generator is therefore not a trivial task. Fortunately &lt;a href=&quot;http://gallio.org&quot;&gt;MbUnit&lt;/a&gt; comes to rescue. The &lt;a href=&quot;http://blog.bits-in-motion.com/2010/05/gallio-v32-beta.html&quot;&gt;soon released v3.2&lt;/a&gt; provides a new &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:contract_verifiers&quot;&gt;contract verifier&lt;/a&gt; named &lt;a href=&quot;http://gallio.org/api/html/T_MbUnit_Framework_ContractVerifiers_HashCodeAcceptanceContract_1.htm&quot;&gt;Hash Code Acceptance Contract&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The contract verifier adds two child tests to the test fixture. They evaluate the probability of collision and the uniform distribution goodness-of-fit. At this time, the avalanche test is not supported (perhaps in a future release?)&lt;br /&gt;&lt;br /&gt;Consider the sample type below. It implements an awful hash function of the additive kind. Let&#39;s imagine that according to some imaginary specifications, &lt;code&gt;value&lt;/code&gt; is a number between 0 and 9, and &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.dayofweek.aspx&quot;&gt;&lt;code&gt;dayOfWeek&lt;/code&gt;&lt;/a&gt; is... well, I just let you find out :)&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; Foo&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;private readonly int&lt;/span&gt; value;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;private readonly&lt;/span&gt; DayOfWeek dayOfWeek;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; Foo(&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; value, DayOfWeek dayOfWeek)&lt;br /&gt;  {&lt;br /&gt;    this.value = value;&lt;br /&gt;    this.dayOfWeek = dayOfWeek;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public override int&lt;/span&gt; GetHashCode()&lt;br /&gt;  {&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; value + (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt;)dayOfWeek;&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Now let&#39;s use the contract verifier to evaluate our poor implementation.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[TestFixture]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public class&lt;/span&gt; FooTest&lt;br /&gt;{&lt;br /&gt;  [VerifyContract]&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;public readonly&lt;/span&gt; IContract HashCodeAcceptanceTests = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; HashCodeAcceptanceContract&amp;lt;Foo&amp;gt;()&lt;br /&gt;  {&lt;br /&gt;    CollisionProbabilityLimit = CollisionProbability.Low,&lt;br /&gt;    UniformDistributionQuality = UniformDistributionQuality.Good,&lt;br /&gt;    DistinctInstances = DataGenerators.Join(&lt;br /&gt;                          Enumerable.Range(0, 10),&lt;br /&gt;                          Enum.GetValues(typeof(DayOfWeek)).Cast&amp;lt;DayOfWeek&amp;gt;())&lt;br /&gt;                          .Select(o =&amp;gt &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Foo(o.First, o.Second))&lt;br /&gt;  };&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;&lt;code&gt;CollisionProbabilityLimit&lt;/code&gt; and &lt;code&gt;UniformDistributionQuality&lt;/code&gt; are the expected confidence levels. These are probability values between 0 (good) and 1 (bad), but we use here some handy predefined constants to improve readability (more details &lt;a href=&quot;http://gallio.org/api/html/AllMembers_T_MbUnit_Framework_ContractVerifiers_CollisionProbability.htm&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://gallio.org/api/html/AllMembers_T_MbUnit_Framework_ContractVerifiers_UniformDistributionQuality.htm&quot;&gt;here&lt;/a&gt;). You may want to let the default values of 5% if you are not sure.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;DistinctInstances&lt;/code&gt; must be fed with an enumeration of distinct &lt;code&gt;Foo&lt;/code&gt; instances. It&#39;s important to understand that the entire evaluation of the hash function is based on the statistical population you decide to provide. Therefore the confidence in the test results will be as good as (or as bad as, for the pessimists) the quality and the representativeness of that population. Two types of scenarios are possible. Either the range of possibilities is finite and reasonably small, or the number of possible distinct instances is nearly infinite or insanely large. In the first case, it&#39;s better to provide to the contract verifier all the possible values. Thus you get an exact and complete stochastic evaluation of your hash function. In the second case, you will need to carefully select a representative subset of all the possible values. &lt;br /&gt;&lt;br /&gt;In both cases you can feed the contract verifier by using a static method which returns an enumeration.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;// ...&lt;/span&gt;&lt;br /&gt;DistinctInstances = GetDistinctInstances()&lt;br /&gt;&lt;span class=&quot;rem&quot;&gt;// ...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;private static&lt;/span&gt; IEnumerable&amp;lt;Foo&amp;gt; GetDistinctInstances()&lt;br /&gt;{&lt;br /&gt;  &lt;span class=&quot;rem&quot;&gt;// ...&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Or to provide an existing catalog if they can be retrieved from an external data source.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;// ...&lt;/span&gt;&lt;br /&gt;DistinctInstances = Foo.GetThemAll()&lt;br /&gt;&lt;span class=&quot;rem&quot;&gt;// ...&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;You may also use the powerful MbUnit data generation framework to easily combine and generate random or sequential values.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;// ...&lt;/span&gt;&lt;br /&gt;DistinctInstances = DataGenerators.Join(&lt;br /&gt;                      Enumerable.Range(0, 10), &lt;br /&gt;                      Enum.GetValues(typeof(DayOfWeek)).Cast&amp;lt;DayOfWeek&amp;gt;())&lt;br /&gt;                      .Select(o =&amp;gt; &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Foo(o.First, o.Second))&lt;br /&gt;&lt;span class=&quot;rem&quot;&gt;// ...&lt;/span&gt;&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;If we run the tests, the report informs us that the tests have miserably failed. The probability of collision is terribly high and the distribution is far from being uniform.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwH63w2Bo5OYE2Bz4jumz1giOLN36uusNbC2F7laOM1MhccveCZ1TpmhgN-67iyT9DhpfwtEMnDLnNacA3x0Ga7zrJeSGgsao537LuW7qu3ezT9M7rYt1nRtAC2fjYx2cRP7GbYZQrOI/s800/HashCodeAcceptanceContractFails.png&quot;/&gt;&lt;br /&gt;&lt;br /&gt;Let&#39;s improve our hash function by using a simple implementation of &lt;a href=&quot;http://en.literateprograms.org/Hash_function_comparison_(C,_sh)#Bernstein&quot;&gt;Dan Bernstein&#39;s famous algorithm&lt;/a&gt;.&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;public override int&lt;/span&gt; GetHashCode()&lt;br /&gt;{&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; 33 * value ^ dayOfWeek.GetHashCode();&lt;br /&gt;}&lt;/pre&gt;&lt;div align=&quot;justify&quot;&gt;Unsurprisingly, running the tests again makes the report look better :)&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRn8TdGk4rGSAjInvXCOhuubvziWG6k8EsByLhe4c1PuEV-pPNI2qrn_fyZM08la6Isx3LaTeeVPh6KTl6xGe6HwDAfLbxBwsdP4wDb0WmGyUSeN4_1XZ6ECMGOEcsBQx5h5qS_bnYhzk/s800/HashCodeAcceptanceContractPasses.png&quot;/&gt;&lt;br /&gt;&lt;br /&gt;Mission accomplished!&lt;br /&gt;&lt;br /&gt;Additional information and examples might be found in the &lt;a href=&quot;http://gallio.org/wiki/doku.php?id=mbunit:contract_verifiers:hash_code_acceptance_contract&quot;&gt;Gallio Wiki&lt;/a&gt;.&lt;/div&gt;</description><link>http://interfacingreality.blogspot.com/2010/05/hash-code-acceptance-contract-verifier.html</link><author>noreply@blogger.com (Yann Trevin)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcwH63w2Bo5OYE2Bz4jumz1giOLN36uusNbC2F7laOM1MhccveCZ1TpmhgN-67iyT9DhpfwtEMnDLnNacA3x0Ga7zrJeSGgsao537LuW7qu3ezT9M7rYt1nRtAC2fjYx2cRP7GbYZQrOI/s72-c/HashCodeAcceptanceContractFails.png" height="72" width="72"/><thr:total>0</thr:total></item></channel></rss>