<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Unit Testing on Marko Apfel</title><link>http://blog.marko-apfel.de/tags/unit-testing/</link><description>Recent content in Unit Testing on Marko Apfel</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Wed, 12 Sep 2012 15:20:00 +0200</lastBuildDate><atom:link href="http://blog.marko-apfel.de/tags/unit-testing/index.xml" rel="self" type="application/rss+xml"/><item><title>LINQ and ArcObjects</title><link>http://blog.marko-apfel.de/posts/linq-and-arcobjects/</link><pubDate>Wed, 12 Sep 2012 15:20:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/linq-and-arcobjects/</guid><description>&lt;h2 id="motivation"&gt;Motivation&lt;/h2&gt;
&lt;p&gt;LINQ (language integrated query) is a component of the Microsoft. NET Framework since version 3.5. It allows a SQL-like query to various data sources such as SQL, XML etc.&lt;/p&gt;
&lt;p&gt;Like SQL also LINQ to SQL provides a declarative notation of problem solving – i.e. you don’t need describe in detail how a task could be solved, you describe what to be solved at all. This frees the developer from error-prone iterator constructs.&lt;/p&gt;</description></item><item><title>xUnit runner eats system diagnostic output</title><link>http://blog.marko-apfel.de/posts/xunit-runner-eats-system-diagnostic-output/</link><pubDate>Mon, 07 Nov 2011 13:28:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/xunit-runner-eats-system-diagnostic-output/</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;When using xUnit and constructs like Debug.WriteLine the &lt;em&gt;DbgView&lt;/em&gt;-tool does not show the written output anymore.&lt;/p&gt;
&lt;h2 id="solution"&gt;Solution&lt;/h2&gt;
&lt;p&gt;Add a new Listener – for example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Debug&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Listeners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;DefaultTraceListener&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>InternalsVisibleTo, PublicKey and PublicKeyToken</title><link>http://blog.marko-apfel.de/posts/internalsvisibleto-publickey-and-publickeytoken/</link><pubDate>Thu, 27 Oct 2011 14:35:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/internalsvisibleto-publickey-and-publickeytoken/</guid><description>&lt;h2 id="intro"&gt;Intro&lt;/h2&gt;
&lt;p&gt;If you want to test the internals of a productive assembly you must mark the assembly with the InternalsVisibleTo-attribute. This attribute has only one constructor which needs the name of the testing assembly.&lt;/p&gt;</description></item><item><title>Let ReSharper and xUnit work together</title><link>http://blog.marko-apfel.de/posts/let-resharper-and-xunit-work-together/</link><pubDate>Sun, 05 Jun 2011 13:41:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/let-resharper-and-xunit-work-together/</guid><description>&lt;h2 id="getting-the-ressources"&gt;Getting the ressources&lt;/h2&gt;
&lt;p&gt;First at all download&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://xunit.codeplex.com/releases/"&gt;xUnit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://xunitcontrib.codeplex.com/releases/"&gt;xUnit Contrib ReSharper&lt;/a&gt;&lt;br&gt;
This gives you a bridge between ReSharper functionality and your XUnit coding.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="installation-und-configuration"&gt;Installation und Configuration&lt;/h2&gt;
&lt;p&gt;Unzip both archives.&lt;/p&gt;
&lt;h3 id="xunit-part"&gt;xUnit part&lt;/h3&gt;
&lt;h4 id="configure-the-code-to-use-xunit"&gt;Configure the code to use xUnit&lt;/h4&gt;
&lt;p&gt;Normally I prefer a single checkout point for my developing solution – this whole bundle I name DevTree. One of the top folders in the hierarchy of this DevTree is a lib-Folder. Beneath this folder all of the 3rd party libs which I use in my solution are located – all of them in an own folder. So I copy &lt;code&gt;xunit.dll&lt;/code&gt; to a folder &lt;code&gt;&amp;lt;DevTree-Root&amp;gt;\lib\xUnit&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Code Contracts: For unit test a manual rebuild is needed for toggeling “runtime checking”</title><link>http://blog.marko-apfel.de/posts/code-contracts-for-unit-test-a-manual-rebuild-is-needed-for-toggeling-runtime-checking/</link><pubDate>Sat, 04 Jun 2011 01:19:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/code-contracts-for-unit-test-a-manual-rebuild-is-needed-for-toggeling-runtime-checking/</guid><description>&lt;p&gt;Toggeling the checkbox &lt;em&gt;Perform Runtime Contract Checking&lt;/em&gt; lets run the next application start with the new set option. But for unit test an explicit new build will apply the option for the next run.&lt;/p&gt;</description></item><item><title>Set ApartmentState for ArcObjects-logic in separate threads</title><link>http://blog.marko-apfel.de/posts/set-apartmentstate-for-arcobjects-logic-in-separate-threads/</link><pubDate>Wed, 08 Sep 2010 10:54:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/set-apartmentstate-for-arcobjects-logic-in-separate-threads/</guid><description>&lt;h2 id="problem-context"&gt;Problem context&lt;/h2&gt;
&lt;p&gt;We use a &lt;code&gt;backgroundworker&lt;/code&gt; to load &lt;code&gt;.MXD&lt;/code&gt; documents from several places of the system and extract meta data and thumbnails which a GUI component shows in an asynchronous way.&lt;/p&gt;
&lt;p&gt;The unit tests for this logic throws an exception during the access the thumbnail:&lt;/p&gt;</description></item><item><title>Interpretations of F.I.R.S.T.</title><link>http://blog.marko-apfel.de/posts/interpretations-of-f-i-r-s-t/</link><pubDate>Mon, 19 Jul 2010 14:49:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/interpretations-of-f-i-r-s-t/</guid><description>&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fast&lt;/strong&gt;&lt;br&gt;
Many per second&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Independent&lt;/strong&gt;&lt;br&gt;
Ability to to run test cases in any order&lt;br&gt;
&lt;strong&gt;Isolated&lt;/strong&gt;&lt;br&gt;
only one aspect per test case –&amp;gt; Failure reasons could better be identified&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Repeatable&lt;/strong&gt;&lt;br&gt;
Execution order does no matter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Self-validating&lt;/strong&gt;&lt;br&gt;
No manual evaluation required&lt;br&gt;
&lt;strong&gt;Small&lt;/strong&gt;&lt;br&gt;
Easy to understand, evolvable&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Transparent&lt;/strong&gt;&lt;br&gt;
purpose of test case should be clear&lt;br&gt;
&lt;strong&gt;Timely&lt;/strong&gt;&lt;br&gt;
Written before/during code&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Integrate NUnit in Hudson CI-server</title><link>http://blog.marko-apfel.de/posts/integrate-nunit-in-hudson-ci-server/</link><pubDate>Wed, 07 Jul 2010 15:41:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/integrate-nunit-in-hudson-ci-server/</guid><description>&lt;h2 id="precondition"&gt;Precondition&lt;/h2&gt;
&lt;h3 id="naming"&gt;Naming&lt;/h3&gt;
&lt;p&gt;Its a good practice to have a common naming schema for test projects, fixture categories and fixture. Especially to configure automatic runs of unit tests is much more easier with this.&lt;/p&gt;</description></item><item><title>NUnit project file cant reference assemblies which are not in subfolders</title><link>http://blog.marko-apfel.de/posts/nunit-project-file-cant-reference-assemblies-which-are-not-in-subfolders/</link><pubDate>Fri, 12 Jun 2009 13:35:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/nunit-project-file-cant-reference-assemblies-which-are-not-in-subfolders/</guid><description>&lt;p&gt;We use a developer tree like&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;src&lt;/code&gt; (contains the master-SLN and other code-stuff)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;build&lt;/code&gt; (contains tools to build assemblies, code-doku, ..)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bin&lt;/code&gt; (central common output-folder for c#-compiler)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Under src normally the &lt;code&gt;&amp;lt;project&amp;gt;.nunit&lt;/code&gt; should lay. But this file then references the assembly in a schema like:
&lt;code&gt;&amp;lt;assembly path=&amp;quot;..\bin\Debug\EsriDE.PipelineManagement.Core.ClassExtensions.Test.dll&amp;quot; &amp;gt;&lt;/code&gt;&lt;/p&gt;</description></item></channel></rss>