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

<channel>
	<title>Gennadiy Donchyts</title>
	<atom:link href="http://don.env.com.ua/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://don.env.com.ua/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 22 Jun 2010 07:03:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Is it good or bad practice to use events in Domain Classes?</title>
		<link>http://don.env.com.ua/blog/?p=102</link>
		<comments>http://don.env.com.ua/blog/?p=102#comments</comments>
		<pubDate>Wed, 03 Feb 2010 17:17:37 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=102</guid>
		<description><![CDATA[Why to use events in entities?
.NET provides a native implementation of observer / subscriber pattern by means of events. I tried to use them not only in the UI classes but also to manage changes in the entities (see info about DDD for a definition of an entity). A lot of Entities in our application [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Why to use events in </strong><strong>entities?</strong></p>
<p>.NET provides a native implementation of observer / subscriber pattern by means of events. I tried to use them not only in the UI classes but also to manage changes in the entities (see info about DDD for a <a href="http://domaindrivendesign.org/node/109">definition of an entity</a>). A lot of Entities in our application are in most cases bound to one or many controls. Entities are composed with other entities, they get changed, all these changes need to be monitored so that corresponding views will be updated or any other actions will be invoked.</p>
<p>Events in .NET is something to be used very carefully. Otherwise you'll end up with too many events <img src='http://don.env.com.ua/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Finally we ended up with the two types of the events which are used in the entities and can be considered as Domain Events:</p>
<p>1. <em>NotifyPropertyChanged</em> - fired when any property changes, e.g. when name of the branch is changed - tree node needs to be updated, if branch is selected - it's name in the property grid control needs to be updated, etc.</p>
<p>2. <em>NotifyCollectionChanged</em> - fired when any collection is changed, add/remove item</p>
<p>Definition of Domain Event comes from the following post of Martin Fowler: <a href="http://martinfowler.com/eaaDev/DomainEvent.html">http://martinfowler.com/eaaDev/DomainEvent.html</a></p>
<p>Once domain model is fully covered by events,  implementation of Undo / Redo functionality becomes trivial task (Memento pattern + these 2 types of events).</p>
<p>After a few tries we ended up with the following solution:</p>
<ul>
<li>All objects implement INotifyPropertyChanged for all entities</li>
<li>All collections used in the properties implement INotifyCollectionChange, using interface IEventedList&lt;T&gt;: IList&lt;T&gt;, INotifyCollectionChanged</li>
<li>When events are fired in the child objects - they are <a href="http://msdn.microsoft.com/en-us/library/ms742806.aspx#how_event_processing_works">bubbled</a> to the higher level object</li>
</ul>
<p>Of course implementing it by hand in every domain class is a violation of the DRY principle, so <a href="http://www.postsharp.org/">PostSharp</a> were used to implement such behavior automatically by adding a few attributes on top of the entity class.</p>
<p><strong>Example</strong></p>
<p><a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller"></a>Let's look on a very simple example, a blog containing blog posts and comments.</p>
<p>Without events it may look like this:</p>
<p><a href="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPostWithoutEvents2.png"><img title="BlogPostWithoutEvents2" src="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPostWithoutEvents2.png" alt="" width="200" height="177" /></a></p>
<p><a href="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogWithoutEvents1.png"><img class="alignnone size-medium wp-image-107" title="BlogWithoutEvents" src="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogWithoutEvents1-300x60.png" alt="" width="300" height="60" /></a></p>
<p><a href="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPostWithoutEvents_code.png"><img class="alignnone size-medium wp-image-112" title="BlogPostWithoutEvents_code" src="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPostWithoutEvents_code-300x178.png" alt="" width="300" height="178" /></a></p>
<p>When events are used - there is simply no need for controller, everything can be bound directly to the view controls:</p>
<p><a href="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPostWithEvents2.png"><img title="BlogPostWithEvents2" src="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPostWithEvents2.png" alt="" width="144" height="145" /></a></p>
<p><a href="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogWithEvents.png"><img class="alignnone size-medium wp-image-106" title="BlogWithEvents" src="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogWithEvents-300x82.png" alt="" width="300" height="82" /></a></p>
<p><a href="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPostWithEvents.png"><img class="alignnone size-medium wp-image-104" title="BlogPostWithEvents" src="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPostWithEvents-300x188.png" alt="" width="300" height="188" /></a></p>
<p>In this case view (or a very simple controller) subscribes to the changes in the domain model and then refreshes what needs to be refreshed.</p>
<p>Of course in reality there are some more issues, like:</p>
<ul>
<li>Clients need to subscribe only to the events they need to use (filter)</li>
<li>Memory leak issues, solution: use weak events where possible <a href="http://diditwith.net/2007/03/23/SolvingTheProblemWithEventsWeakEventHandlers.aspx">http://diditwith.net/2007/03/23/SolvingTheProblemWithEventsWeakEventHandlers.aspx</a></li>
<li>Sometimes events need to be grouped or filtered (10000 items added to collection will generate 10000 events and therefore 10000 calls, if there are no subscribers - overhead is not that big, ~20% compare to the plain calls)</li>
</ul>
<p>But in any case if events are used in as shown here - much less source code need to be produced plus data model always remain in sync with all views.</p>
<p>How events are fired and handled when blog title changes:</p>
<p><a href="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPost_TitleChange.png"><img class="alignnone wp-image-109" title="BlogPost_TitleChange" src="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPost_TitleChange-300x237.png" alt="" width="300" height="237" /></a></p>
<p>How events are fired and routed when new post is added:</p>
<p><a href="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPost_AddBlogPost.png"><img class="alignnone size-medium wp-image-108" title="BlogPost_AddBlogPost" src="http://don.env.com.ua/blog/wp-content/uploads/2010/02/BlogPost_AddBlogPost-300x269.png" alt="" width="300" height="269" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=102</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fitnesse4net source code is available on Google Code</title>
		<link>http://don.env.com.ua/blog/?p=99</link>
		<comments>http://don.env.com.ua/blog/?p=99#comments</comments>
		<pubDate>Sun, 20 Dec 2009 12:50:25 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[FitNesse]]></category>
		<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=99</guid>
		<description><![CDATA[I've uploaded source code for .NET version of FitNesse4Net to Google Code. It is simply original version of FitNesse but converted to .NET using IKVM.NET and then extended with a small wrapper allowing to use default test runner to run .NET tests. Also command-line is a bit extended so that it can run as a [...]]]></description>
			<content:encoded><![CDATA[<p>I've uploaded source code for .NET version of FitNesse4Net to Google Code. It is simply original version of FitNesse but converted to .NET using IKVM.NET and then extended with a small wrapper allowing to use default test runner to run .NET tests. Also command-line is a bit extended so that it can run as a server or command-line runner. See source code and binaries here: <a href="http://code.google.com/p/fitnesse4net/">FitNesse4Net on Google Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=99</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just learned from ReSharper how to make code look nicer</title>
		<link>http://don.env.com.ua/blog/?p=93</link>
		<comments>http://don.env.com.ua/blog/?p=93#comments</comments>
		<pubDate>Wed, 09 Dec 2009 22:59:51 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[Test]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=93</guid>
		<description><![CDATA[ReSharper really helps to learn how to code. During writing a test for a ForEach extension method for IEnumerable&#60;T&#62; it suggested to improve the following code:

The resulting code got much better:

]]></description>
			<content:encoded><![CDATA[<p>ReSharper really helps to learn how to code. During writing a test for a ForEach extension method for IEnumerable&lt;T&gt; it suggested to improve the following code:</p>
<p><img class="alignnone size-full wp-image-94" title="ReSharper_group1" src="http://don.env.com.ua/blog/wp-content/uploads/2009/12/ReSharper_group1.png" alt="ReSharper_group1" width="518" height="234" /></p>
<p>The resulting code got much better:</p>
<p><img class="alignnone size-full wp-image-95" title="ReSharper_group2" src="http://don.env.com.ua/blog/wp-content/uploads/2009/12/ReSharper_group2.png" alt="ReSharper_group2" width="496" height="192" /></p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=93</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update version of FitNesse for .NET.</title>
		<link>http://don.env.com.ua/blog/?p=66</link>
		<comments>http://don.env.com.ua/blog/?p=66#comments</comments>
		<pubDate>Mon, 07 Dec 2009 00:53:15 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=66</guid>
		<description><![CDATA[This time a command-line and MSBuild runners are included: fitnesse4net-bin.zip 8.3Mb
After experimenting a bit more with FitNesse I managed to make it run .NET assemblies with about 15Kb of source code injected directly into FitNesse internals  . It not tested much so probably some bugs will need to be fixed, but it is able to [...]]]></description>
			<content:encoded><![CDATA[<p>This time a command-line and MSBuild runners are included: <a href="http://fitnesse4net.googlecode.com/files/fitnesse4net-bin.zip">fitnesse4net-bin.zip</a> 8.3Mb</p>
<p>After experimenting a bit more with FitNesse I managed to make it run .NET assemblies with about 15Kb of source code injected directly into FitNesse internals <img src='http://don.env.com.ua/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . It not tested much so probably some bugs will need to be fixed, but it is able to run demo .NET assemblies without any problems. The main purpose was proof of concept, to see if it will work at all and try to develop a MSBuild tasks allowing to run all tests using command-line.</p>
<p>What is included:</p>
<p><img class="alignnone size-full wp-image-68" title="fitnesse4net" src="http://don.env.com.ua/blog/wp-content/uploads/2009/12/fitnesse4net.png" alt="fitnesse4net" width="514" height="607" /></p>
<p>DemoTest1 page contains the following text:</p>
<pre><span style="color: #008000;">!contents
!|script|DemoProject.MultiplierBy2|
 |input|2|
 |run|
 |check|output|4|
 !|script| DemoProject.MultiplierBy2|
 |input|2|
 |run|
 |check|output|5|</span></pre>
<p>The file content.txt in FitNesseRoot/ is used to find a list of assemblies to be referenced, looks like this:</p>
<pre><span style="color: #008000;">!path ..\DemoProject\bin\Debug\DemoProject.dll</span></pre>
<p>After run of run-test-suite.cmd the following output should be printed and the target/ directory should contain results of the tests as html.</p>
<pre><span style="color: #008000;">Loading assembly ..\DemoProject\bin\Debug\DemoProject.dll ...</span></pre>
<pre><span style="color: #008000;">Running test suite FrontPage.DemoSuite ...</span></pre>
<pre><span style="color: #008000;">Running test FrontPage.DemoSuite.DemoTest1 ...</span></pre>
<pre><span style="color: #008000;">Test results: 3 right, 1 wrong, 0 ignored, 0 exceptions</span></pre>
<pre><span style="color: #008000;">Running test FrontPage.DemoSuite.DemoTest2 ...</span></pre>
<pre><span style="color: #008000;">Test results: 4 right, 0 wrong, 0 ignored, 0 exceptions</span></pre>
<pre><img class="alignnone size-full wp-image-69" title="fitnesse4net-results" src="http://don.env.com.ua/blog/wp-content/uploads/2009/12/fitnesse4net-results.png" alt="fitnesse4net-results" width="427" height="412" /></pre>
<p>Contents of FitNesse.proj:</p>
<pre><span style="color: #008000;">&lt;Project&gt;</span></pre>
<pre><span style="color: #008000;">&lt;UsingTask TaskName="Tasks.RunSlimTestSuite" AssemblyFile="..\bin\FitNesse4Net.MSBuidTasks.dll" /&gt;</span></pre>
<pre><span style="color: #008000;">&lt;UsingTask TaskName="Tasks.RunSlimTest" AssemblyFile="..\bin\FitNesse4Net.MSBuidTasks.dll" /&gt;</span></pre>
<pre><span style="color: #008000;">
</span></pre>
<pre><span style="color: #008000;">&lt;Target Name="RunSlimTestSuite"&gt;</span></pre>
<pre><span style="color: #008000;">   &lt;RunSlimTestSuite WorkingDirectory=".\src\DemoProject.Tests" TargetDirectory=".\target" TestSuiteName="FrontPage.DemoSuite" /&gt;</span></pre>
<pre><span style="color: #008000;">&lt;/Target&gt;</span></pre>
<pre><span style="color: #008000;">
</span></pre>
<pre><span style="color: #008000;">&lt;Target Name="RunSlimTest"&gt;</span></pre>
<pre><span style="color: #008000;">   &lt;RunSlimTest WorkingDirectory=".\src\DemoProject.Tests" TargetDirectory=".\target" TestName="FrontPage.DemoSuite.DemoTest1" /&gt;</span></pre>
<pre><span style="color: #008000;">   &lt;RunSlimTest WorkingDirectory=".\src\DemoProject.Tests" TargetDirectory=".\target" TestName="FrontPage.DemoSuite.DemoTest2" /&gt;</span></pre>
<pre><span style="color: #008000;">&lt;/Target&gt;</span></pre>
<pre><span style="color: #008000;">
</span></pre>
<pre><span style="color: #008000;">&lt;/Project&gt;</span></pre>
<p>msbuild-run-test-suite.cmd:</p>
<pre><span style="color: #008000;">C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe FitNesse.proj /t:RunSlimTest</span></pre>
<p>msbuild-run-test.cmd:</p>
<pre><span style="color: #008000;">C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe FitNesse.proj /t:RunSlimTestSuite</span></pre>
<p>run-test-suite.cmd:</p>
<pre><span style="color: #008000;">..\bin\FitNesse4Net.exe --run-test-suite=FrontPage.DemoSuite --work-directory=.\src\DemoProject.Tests --target-directory=.\target</span></pre>
<p>run-test.cmd:</p>
<pre><span style="color: #008000;">..\bin\FitNesse4Net.exe --run-test=FrontPage.DemoSuite.DemoTest1 --work-directory=.\src\DemoProject.Tests --target-directory=.\target</span></pre>
<p>start-server.cmd:</p>
<pre><span style="color: #008000;">start ..\bin\FitNesse4Net.exe --port=8080 --work-directory=.\src\DemoProject.Tests</span></pre>
<p>stop-server.cmd:</p>
<pre><span style="color: #008000;">..\bin\FitNesse4Net.exe --shutdown --port=8080</span></pre>
<p>After FitNesse4Net.exe is started without arguments, usage help will be printed to the console. Many options are similar to those provided by Java fitnesse.jar but some are new like<span style="color: #008000;"> --shutdown, --run-test-suite, --run-test</span></p>
<p>Note: after run of start-server.cmd - it will generate a lot of other files in your FitNesseRoot.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">fitnesse4net-bin/</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   README</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">+---bin</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       fitnesse.dll .......................... original java fitnesse.jar</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       FitNesse4Net.exe ...................... main .NET executable</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       FitNesse4Net.MSBuidTasks.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Core.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Misc.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Security.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Text.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Util.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.XML.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.Runtime.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       log4net.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       NDesk.Options.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---examples</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   FitNesse.proj</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   msbuild-run-test-suite.cmd .............. example scripts showing how to run FitNesse</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   msbuild-run-test.cmd                      using command-line runner or MSBuild</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   run-test-suite.cmd</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   run-test.cmd</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   start-server.cmd</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   stop-server.cmd</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---src</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">+---DemoProject</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   |   DemoProject.csproj</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   |   MultiplierBy2.cs</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   |</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   +---bin</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   |   \---Debug</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   |           DemoProject.dll .......... system under test</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   |           DemoProject.pdb</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   |</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   \---Properties</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|           AssemblyInfo.cs</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---DemoProject.Tests</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---FitNesseRoot</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   content.txt</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   properties.xml</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">+---files ......................... some files required to generate reports</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---FrontPage</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   content.txt</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   properties.xml</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---DemoSuite ................. demo test suite</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   content.txt</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   properties.xml</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">+---DemoTest1</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       content.txt</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       properties.xml</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---DemoTest2</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">content.txt</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">properties.xml</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">DemoTest1 contains the following text:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">!contents</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">!|script|DemoProject.MultiplierBy2|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|input|2|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|run|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|check|output|4|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">!|script| DemoProject.MultiplierBy2|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|input|2|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|run|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|check|output|5|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">content.txt in FitNesseRoot is used to find a list of assemblies to be referenced. Usually it looks like:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">!path ..\DemoProject\bin\Debug\DemoProject.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">After run of run-test-suite.cmd the target/ directory will contain results of the tests as html.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">...</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Note1: after run of start-server.cmd - it will generate a lot of other files in your FitNesseRoot.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">FitNesse.proj:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;UsingTask TaskName="Tasks.RunSlimTestSuite" AssemblyFile="..\bin\FitNesse4Net.MSBuidTasks.dll" /&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;UsingTask TaskName="Tasks.RunSlimTest" AssemblyFile="..\bin\FitNesse4Net.MSBuidTasks.dll" /&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;Target Name="RunSlimTestSuite"&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;RunSlimTestSuite WorkingDirectory=".\src\DemoProject.Tests" TargetDirectory=".\target" TestSuiteName="FrontPage.DemoSuite" /&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;/Target&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;Target Name="RunSlimTest"&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;RunSlimTest WorkingDirectory=".\src\DemoProject.Tests" TargetDirectory=".\target" TestName="FrontPage.DemoSuite.DemoTest1" /&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;RunSlimTest WorkingDirectory=".\src\DemoProject.Tests" TargetDirectory=".\target" TestName="FrontPage.DemoSuite.DemoTest2" /&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;/Target&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;/Project&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">msbuild-run-test-suite.cmd:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe FitNesse.proj /t:RunSlimTest</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">msbuild-run-test.cmd:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe FitNesse.proj /t:RunSlimTestSuite</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">run-test-suite.cmd:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">..\bin\FitNesse4Net.exe --run-test-suite=FrontPage.DemoSuite --work-directory=.\src\DemoProject.Tests --target-directory=.\target</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">run-test.cmd:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">..\bin\FitNesse4Net.exe --run-test=FrontPage.DemoSuite.DemoTest1 --work-directory=.\src\DemoProject.Tests --target-directory=.\target</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">start-server.cmd:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">start ..\bin\FitNesse4Net.exe --port=8080 --work-directory=.\src\DemoProject.Tests</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">stop-server.cmd:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 63px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">..\bin\FitNesse4Net.exe --shutdown --port=8080</div>
<p>After FitNesse4Net.exe is stared, a list of possible options will be printed to the console. Many options a similar to those provided by Java fitnesse.jar but some are new like --shutdown, --run-test-suite, --run-test</p>
<p>TODO: check if it will work as a test runner from FitNesse wiki (currently it will say that runner is not found if you try to run tests from the fitnesse wiki).</p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=66</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Got stack overflow on StackOverflow :)</title>
		<link>http://don.env.com.ua/blog/?p=64</link>
		<comments>http://don.env.com.ua/blog/?p=64#comments</comments>
		<pubDate>Sun, 06 Dec 2009 01:29:57 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=64</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-63" title="StackOverflow" src="http://don.env.com.ua/blog/wp-content/uploads/2009/12/StackOverflow.png" alt="StackOverflow" width="631" height="425" /></p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=64</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FitNesse under .NET without JRE</title>
		<link>http://don.env.com.ua/blog/?p=57</link>
		<comments>http://don.env.com.ua/blog/?p=57#comments</comments>
		<pubDate>Tue, 01 Dec 2009 20:10:12 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=57</guid>
		<description><![CDATA[Not sure if anyone will use it but it was kind of funny thing to do. After playing with FitNesse (Function Integration Testing Framework) which is mainly developed in Java I check if it can be converted to .NET using IKVM and the trick seems to work, you can start server, edit pages and runs [...]]]></description>
			<content:encoded><![CDATA[<p>Not sure if anyone will use it but it was kind of funny thing to do. After playing with FitNesse (Function Integration Testing Framework) which is mainly developed in Java I check if it can be converted to .NET using IKVM and the trick seems to work, you can start server, edit pages and runs tests.<span><span style="text-decoration: line-through;"> It is simply packaged version of fitnesse.jar and .NET runner by by Mike Stockdale.</span> ... uses pure Java version.</span></p>
<p><span style="text-decoration: line-through;"> </span></p>
<p>Download: <a href="http://fitnesse4net.googlecode.com/files/fitnesse4net-bin.zip">fitnesse4net.zip</a> 8.7Mb</p>
<p>Zip file contains only .NET binaries required to run FitNesse and small demo project containing a single class. No Java is required.</p>
<p>After starting run_server.cmd you have to wait until FitNesse will unpack all it's files into FitNesseRoot, then press refresh in browser. After you run demo test on a root page you should get something like this (<strong>the web page has been updated, see <a href="http://don.env.com.ua/blog/?p=66">another</a> blog post for a new version</strong>):</p>
<p><img class="alignnone size-full wp-image-58" title="fitnesse-results" src="http://don.env.com.ua/blog/wp-content/uploads/2009/12/fitnesse-results.png" alt="fitnesse-results" width="537" height="470" /></p>
<p>It works a bit slower compare to Java but still seems to be stable.</p>
<p>Directory structure:</p>
<p><img class="alignnone size-full wp-image-59" title="fit4net-directory" src="http://don.env.com.ua/blog/wp-content/uploads/2009/12/fit4net-directory.png" alt="fit4net-directory" width="599" height="383" /></p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">fit4net</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">+---bin</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       fit.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       fitnesse.exe ................ FitNesse all in one wiki/server</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       fitSharp.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Core.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Misc.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Security.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Text.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.Util.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.OpenJDK.XML.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       IKVM.Runtime.dll</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       Runner.exe .................. command-line test runner, fetches content from server</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       RunnerW.exe ................. same as previous, but with window</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---example</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   run_server.cmd</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">+---FitNesseRoot</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       content.txt</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|       properties.xml</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---src</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   DemoFitNesseTests.csproj</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   DemoFitNesseTests.sln</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|   DemoMultiplierBy2.cs</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">|</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---bin</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">\---Debug</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 146px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">DemoFitNesseTests.dll</div>
<p><span style="text-decoration: line-through;">Right now I'm struggling trying to integrate it with MSBuild / TeamCity, looks like nobody implemented it yet <img src='http://don.env.com.ua/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </span> <strong>DONE</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=57</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Making NHibernate lazy-loading PostSharp-ed objects work.</title>
		<link>http://don.env.com.ua/blog/?p=14</link>
		<comments>http://don.env.com.ua/blog/?p=14#comments</comments>
		<pubDate>Thu, 30 Jul 2009 23:39:39 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=14</guid>
		<description><![CDATA[I'm using PostSharp to add implementation of INotifyPropertyChanged in AOP way using PostSharp compound aspect.
At the same time object has to be saved into a database and loaded in a lazy way (NHibernate + LinFu as a DynamicProxy). It seems that when object is loaded - all aspects disappear in a proxy object created by [...]]]></description>
			<content:encoded><![CDATA[<p>I'm using PostSharp to add implementation of INotifyPropertyChanged in AOP way using PostSharp compound aspect.</p>
<p>At the same time object has to be saved into a database and loaded in a lazy way (NHibernate + LinFu as a DynamicProxy). It seems that when object is loaded - all aspects disappear in a proxy object created by a DynamicProxy. All required fields are present in the proxy type but aspects are not initialized and PostSharp  instanceCredentials = {0}.</p>
<p><a href="http://twitter.com/postsharp">Gael Fraiteur</a> sent me a message after I Twittered about the problem (so, Twitter works! <img src='http://don.env.com.ua/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ):</p>
<blockquote><p>@gena_d Look at <a href="http://tiny.cc/zIXFT">http://tiny.cc/zIXFT</a>. Call this method: LaosUtils.InitializeCurrentAspects() if the aspect constructor is skipped.</p></blockquote>
<p>Thanks! But unfortunatelly it was not a solution for me since object even has no aspect implementation injected into it, it happens in the constructor which is skipped <img src='http://don.env.com.ua/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> .</p>
<p><a href="http://don.env.com.ua/images/2009-07-31_1214.jpg"><img src="http://don.env.com.ua/images/2009-07-31_1214.jpg" alt="QuickWatch_LazyAOPObject" width="583" height="218" /></a></p>
<p>After debugging deep into NHibernate and LinFu I've found a workaround:</p>
<ol>
<li>Listen to the ILoadEventListener when lazy object is initialized by NHibernate</li>
<li>During load, inject another instance of NotifyPropertyChangedImplementation into proxy and forward event from underlying object to that implementation.</li>
</ol>
<pre class="brush:csharp">public void OnLoad(LoadEvent @event, LoadType loadType)
{
    defaultLoadEventListener.OnLoad(@event, loadType);

    InitializePropertyChangedAspect(@event.Result);
}

///
/// Connects property changed events of the proxy object to the real object
/// so when PropertyChanged event is fired - it will be redirected to the proxy.
///
///

private void InitializePropertyChangedAspect(object o)
{
    if (!(o is INHibernateProxy) || !(o is IComposed))
    {
        return;
    }

    var proxyObject = (INHibernateProxy) o;
    var lazyInitializer = proxyObject.HibernateLazyInitializer;
    var realObject = lazyInitializer.GetImplementation();

    // initialized property changed aspect implementation
    // and redirects events fired in the wrapped object
    // to the aspect implementation in the parent object (proxy)
    var aspect = new NotifyPropertyChangedImplementation(o, InstanceCredentials.Null, false);
    ((IComposed) o).SetImplementation(InstanceCredentials.Null, aspect);

    var notifiable = (INotifyPropertyChanged) realObject;
    notifiable.PropertyChanged += ((sender, e) =&gt; aspect.OnPropertyChanged(proxyObject, e));
}</pre>
<p>As a result a client code subscribing to a proxy object can listen to a PropertyChanged event.  The code looks a bit ugly, it would nicer if DynamicProxy can handle these events.</p>
<p>After implementation of aspect is injected - the proxy object looks like this:<br />
<a href="http://don.env.com.ua/images/2009-07-31_1216.gif"><img src="http://don.env.com.ua/images/2009-07-31_1216.gif" alt="" width="548" height="334" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=14</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPAM</title>
		<link>http://don.env.com.ua/blog/?p=11</link>
		<comments>http://don.env.com.ua/blog/?p=11#comments</comments>
		<pubDate>Mon, 30 Mar 2009 19:01:55 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=11</guid>
		<description><![CDATA[Или как же меня достало удалять эти комменты, кто бы им интернет зафайерволил в конце-концов, поставил вот что-то под названием clickacha, чтобы им жизнь немного усложнить.
update: clickacha не работает, удалил и поставил обычную Capatcha
]]></description>
			<content:encoded><![CDATA[<p>Или как же меня достало удалять эти комменты, кто бы им интернет зафайерволил в конце-концов, поставил вот что-то под названием click<span style="text-decoration: line-through;">a</span>cha, чтобы им жизнь немного усложнить.</p>
<p>update: clickacha не работает, удалил и поставил обычную Capatcha</p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=11</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgraded jar2ikvmc to ikvm 0.38.0.2</title>
		<link>http://don.env.com.ua/blog/?p=8</link>
		<comments>http://don.env.com.ua/blog/?p=8#comments</comments>
		<pubDate>Sun, 22 Mar 2009 16:12:35 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[jar2ikvmc]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=8</guid>
		<description><![CDATA[Just upgraded jar2ikvmc to the last version of ikvm. The most annoying problem was with conversion of JarAnalyzer to .NET, a resource file called Filter.properties was missing. The problem was solved after I embedded it by hand into JarAnalyzer.jar and then converted using ikvmc.exe.
The new version is uploaded to jar2ikvmc on Google code page.
]]></description>
			<content:encoded><![CDATA[<p>Just upgraded jar2ikvmc to the last version of ikvm. The most annoying problem was with conversion of JarAnalyzer to .NET, a resource file called Filter.properties was missing. The problem was solved after I embedded it by hand into JarAnalyzer.jar and then converted using ikvmc.exe.</p>
<p>The new version is uploaded to <a href="http://code.google.com/p/jar2ikvmc/downloads/list">jar2ikvmc on Google code</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=8</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minor release. Moved to Google Code.</title>
		<link>http://don.env.com.ua/blog/?p=5</link>
		<comments>http://don.env.com.ua/blog/?p=5#comments</comments>
		<pubDate>Sun, 28 Oct 2007 16:03:22 +0000</pubDate>
		<dc:creator>Gena</dc:creator>
				<category><![CDATA[jar2ikvmc]]></category>

		<guid isPermaLink="false">http://don.env.com.ua/blog/?p=5</guid>
		<description><![CDATA[Today I moved all sources and binaries to Google Code. It seems to work fine for such a small tool  .
Please use Issues section there to submit bug fixes or suggestions.
Also a new release was created combined with latest version of ikvm: ikvmbin-0.37.2855.zip.
From now tool will be distributed using the following naming convention:
jar2ikvmc-&#60;major&#62;.&#60;minor&#62;.&#60;build&#62;.zip 
Build [...]]]></description>
			<content:encoded><![CDATA[<p>Today I moved all sources and binaries to <a href="http://code.google.com/p/jar2ikvmc/">Google Code</a>. It seems to work fine for such a small tool <img src='http://don.env.com.ua/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
Please use Issues section there to submit bug fixes or suggestions.<br />
Also a new release was created combined with latest version of ikvm: <a href="http://weblog.ikvm.net/default.aspx?date=2007-10-26">ikvmbin-0.37.2855.zip</a>.</p>
<p>From now tool will be distributed using the following naming convention:<br />
<em>jar2ikvmc-&lt;major&gt;.&lt;minor&gt;.&lt;build&gt;.zip </em></p>
<p>Build number is actually equal to tagged revision number in subversion.</p>
<p>Binary: <a href="http://jar2ikvmc.googlecode.com/files/jar2ikvmc-0.1.7.zip">jar2ikvmc-0.1.7.zip</a><br />
Source:  <a href="http://jar2ikvmc.googlecode.com/files/jar2ikvmc-0.1.7-src.zip">jar2ikvmc-0.1.7-src.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://don.env.com.ua/blog/?feed=rss2&amp;p=5</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
