<?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>Martijn's C# Programming Blog &#187; monodevelop</title>
	<atom:link href="http://www.dijksterhuis.org/tag/monodevelop/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dijksterhuis.org</link>
	<description>Information, news about programming in C#</description>
	<lastBuildDate>Fri, 07 Aug 2009 21:26:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using NUnit with MonoDevelop</title>
		<link>http://www.dijksterhuis.org/using-nunit-with-monodevelop/</link>
		<comments>http://www.dijksterhuis.org/using-nunit-with-monodevelop/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 04:29:04 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Learn C#]]></category>
		<category><![CDATA[monodevelop]]></category>
		<category><![CDATA[nunit]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.dijksterhuis.org/?p=403</guid>
		<description><![CDATA[Unit testing with NUnit is deeply integrated into Mono. The Mono code itself uses NUnit extensively to test its own functionality. In this post we look at how you can enable unit testing for your own code under MonoDevelop. In an earlier post I looked at how to install NUnit for Visual Studio 2008 Express, [...]<p>This is a post from <a href="http://www.dijksterhuis.org">Martijn's C# Coding Blog</a>. </p>
]]></description>
			<content:encoded><![CDATA[<p><em>Unit testing with NUnit is deeply integrated into Mono. The Mono code itself uses NUnit extensively to test its own functionality. In this post we look at how you can enable unit testing for your own code under MonoDevelop. In an earlier post I looked at<a href="http://www.dijksterhuis.org/setting-up-nunit-for-c-unit-testing-with-visual-studio-c-express-2008/"> how to install NUnit for Visual Studio 2008 Express</a>, in this post we do the same for MonoDevelop.</em></p>
<p><span id="more-403"></span></p>
<p><strong>Creating your first NUnit test</strong></p>
<p>We need to create a new solution to test if this works and we need to add a reference to NUnit to be able to use the code.  This is the only &#8220;difficult&#8221; bit, the MonoDevelop documentation is sparse at best on how to include external assemblies. A dedicated menu option would have been nice.</p>
<p>To be able to add an assembly or package to an existing project you need to right click the References item on the Solution panel and then click &#8220;Edit References&#8221;. Click the &#8220;NUnit.Core&#8221; and &#8220;NUnit.Framework&#8221; selections to include them into your solution.</p>
<p><a href="http://www.dijksterhuis.org/wp-content/uploads/2008/12/screenshot.png"><img src="http://www.dijksterhuis.org/wp-content/uploads/2008/12/screenshot-500x387.png" alt="Including NUnit as an External Assembly to MonoDevelop" title="Including NUnit as an External Assembly to MonoDevelop" width="500" height="387" class="alignnone size-medium wp-image-404" /></a></p>
<p><strong>Testing the NUnit Demo code</strong></p>
<p>Below I have included a little bit of demo code that tests if this works properly. The code is mostly borrowed from the NUnit website demo, I have just for the sake of it included a class containing “Main” so that the code actually compiles and runs.</p>
<pre class="brush: c#">
using System;
using NUnit.Framework;

namespace bank
{
    public class Account
    {
        private float balance;
        public void Deposit(float amount)
        {
            balance += amount;
        }

        public void Withdraw(float amount)
        {
            balance -= amount;
        }

        public void TransferFunds(Account destination, float amount)
        {
        }

        public float Balance
        {
            get { return balance; }
        }
    }
}

namespace bank
{
    [TestFixture]
    public class AccountTest
    {
        [Test]
        public void TransferFunds()
        {
            Account source = new Account();
            source.Deposit(200.00F);
            Account destination = new Account();
            destination.Deposit(150.00F);

            source.TransferFunds(destination, 100.00F);
            Assert.AreEqual(250.00F, destination.Balance);
            Assert.AreEqual(100.00F, source.Balance);

        }

        [Test]
        public void DepositFunds()
        {
            Account source = new Account();
            source.Deposit(200.00F);
            Assert.AreEqual(200.00F, source.Balance);
        }

    }
}

namespace UnitTestDemo
{
    public class MyAccountingSoftware
    {

        public static void Main()
        {
            bank.Account DemoAccount = new bank.Account();
            DemoAccount.Deposit(1000.00F);
            DemoAccount.Withdraw(500.50F);
            Console.WriteLine(&quot;Our account balance is {0}&quot;, DemoAccount.Balance);
        }

    }
}
</pre>
<p>In the above code the actual unit testing is done by the “AccountTest” class, for simplicity we keep this in the same file but usually you would keep a separate directory with all of your unit tests, separate from the actual code.Note that because the “TransferFunds” function in the code above is poorly implemented (eg. its empty) the Unit test will hopefully (!!) fail. The second unit test in DepositFunds should succeed.</p>
<p><strong>How to run NUnit tests from within MonoDevelop</strong></p>
<p><a href="http://www.dijksterhuis.org/wp-content/uploads/2008/12/screenshot-1.png"><img src="http://www.dijksterhuis.org/wp-content/uploads/2008/12/screenshot-1-500x290.png" alt="Running NUnit from within MonoDevelop" title="Running NUnit from within MonoDevelop" width="500" height="290" class="alignnone size-medium wp-image-407" /></a></p>
<p>MonoDevelop allows you to run the NUnit tests directly in the GUI environment. Select &#8220;View > Unit Tests&#8221; to see an overview of all the defined tests in the left panel. Right click on a test , or a group of tests and select &#8220;Run Test&#8221;. Click on <em>&#8220;View > NUnit Test Results&#8221;</em> to see which tests passed and which failed.</p>
<p>This is a post from <a href="http://www.dijksterhuis.org">Martijn's C# Coding Blog</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dijksterhuis.org/using-nunit-with-monodevelop/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Debugging C# in Monodevelop on Ubuntu</title>
		<link>http://www.dijksterhuis.org/debugging-c-in-monodevelop-on-ubuntu/</link>
		<comments>http://www.dijksterhuis.org/debugging-c-in-monodevelop-on-ubuntu/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 06:26:22 +0000</pubDate>
		<dc:creator>Martijn</dc:creator>
				<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Learn C#]]></category>
		<category><![CDATA[monodevelop]]></category>

		<guid isPermaLink="false">http://www.dijksterhuis.org/?p=387</guid>
		<description><![CDATA[As soon as I heard that the  MonoDevelop Subversion code included support for actually debugging my C# code I tried installing it to give it a go. Optimistically I kept notes, figuring that it would be useful to write a post about the install process later. As my notes started to turn into a book, [...]<p>This is a post from <a href="http://www.dijksterhuis.org">Martijn's C# Coding Blog</a>. </p>
]]></description>
			<content:encoded><![CDATA[<p>As soon as I heard that the  MonoDevelop Subversion code included support for actually debugging my C# code I tried installing it to give it a go. Optimistically I kept notes, figuring that it would be useful to write a post about the install process later. As my notes started to turn into a book, and the arrows back and forth and <span style="text-decoration: line-through;">crossed out scribbles </span>increased I gave up on writing the ultimate &#8220;ten step guide to installing Monodevelop on Ubuntu&#8221;.</p>
<p>When I finally had MonoDevelop compiled and installed &#8212; the promised debugging didn&#8217;t actually work. Bummer. I gave up, and went back to coding the old way (with ticker tape). This morning I checked out the latest SVN, installed it and ran it, just for laughs.</p>
<p>And behold as shown below &#8212; debugging actually worked. I can step and trace through the code, and set watches making MonoDevelop suddenly that much more useful to me.</p>
<p>The best thing? The Mono C# libraries are not black boxes but open source &#8212; you can step and trace directly into the Mono libraries themselves and find out what Mono is doing as you call library functions.</p>
<p><a href="http://www.dijksterhuis.org/wp-content/uploads/2008/12/monodevelop1.png"><img class="alignnone size-medium wp-image-389" title="MonoDevelop on Ubuntu" src="http://www.dijksterhuis.org/wp-content/uploads/2008/12/monodevelop1-500x404.png" alt="MonoDevelop on Ubuntu" width="500" height="404" /></a></p>
<p>The problem with installing MonoDevelop 2.0alpha 2 is that<a href="http://monodevelop.com/Download_-_Unstable"> the guides online</a> don&#8217;t actually produce a working MonoDevelop installation. If you run MonoDevelop under Ubuntu like I do, the number of dependencies and sub-dependencies you need to resolve is large and I ended up compiling, re-compiling and changing version numbers of modules multiple times to find combinations that worked. In addition I had to change, add and resolve many missing library conflicts within Ubuntu as well.</p>
<p>Concluding: Yes, it is possible. Just do not expect a quick and easy install of MonoDevelop 2.0 alpha 2 on your Ubuntu installation.</p>
<p>This is fun only if you have plenty of spare time.</p>
<p><strong>Some hints &#8212; <em>this does not produce a working Mono Develop installation<br />
</em></strong></p>
<ul>
<li>Remove Mono 1.9, MonoDevelop 1.0, and any and all other mono related things from your ubuntu installation before attempting to compile MonoDevelop 2.0 Alpha 2 to avoid conflicts down the road.</li>
<li>Install mono 2.3, the debugger and mono develop from SVN, not from the packages provided on the website (they do not work)</li>
<li>$ svn co svn://anonsvn.mono-project.com/source/trunk/mono<br />
$ svn co svn://anonsvn.mono-project.com/source/trunk/mcs<br />
$ svn co svn://anonsvn.mono-project.com/source/trunk/debugger<br />
$ svn co svn://anonsvn.mono-project.com/source/trunk/mono-addins<br />
$ svn co svn://anonsvn.mono-project.com/source/trunk/olive<br />
$ svn co svn://anonsvn.mono-project.com/source/trunk/monodevelop</li>
<li>I installed gtk-sharp-2.12.5, gnome-sharp-2.20.0 and libglade-2.0.1 as support libraries</li>
<li>Compile and install monodevelop last of all</li>
</ul>
<p><em>Mono JIT compiler version 2.3 (/trunk/mono r121276 Thu Dec 11 13:04:53 CST 2008)<br />
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com</em></p>
<p>This is a post from <a href="http://www.dijksterhuis.org">Martijn's C# Coding Blog</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dijksterhuis.org/debugging-c-in-monodevelop-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
