<?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>Emad Ibrahim &#187; Testing</title>
	<atom:link href="http://www.emadibrahim.com/category/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emadibrahim.com</link>
	<description>web development, tech reviews, tips, tricks, blogging</description>
	<lastBuildDate>Mon, 03 May 2010 12:27:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Testing Web Apps With Selenium, Explorer and .NET</title>
		<link>http://www.emadibrahim.com/2009/01/19/testing-web-app-with-selenium-explorer-and-net/</link>
		<comments>http://www.emadibrahim.com/2009/01/19/testing-web-app-with-selenium-explorer-and-net/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 06:52:04 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Web Dev]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2009/01/19/testing-web-app-with-selenium-explorer-and-net/</guid>
		<description><![CDATA[Here are the steps to run your Selenium tests against Internet Explorer. Create the tests Install Selenium IDE from http://seleniumhq.org Record your tests in Firefox using the Selenium IDE Click File &#62; Create New Test Click the record button and create your test Click the record button to stop the test Save your test Click [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the steps to run your Selenium tests against Internet Explorer.</p>
<h2>Create the tests</h2>
<ol>
<li>Install Selenium IDE from <a title="http://seleniumhq.org" href="http://seleniumhq.org">http://seleniumhq.org</a>
<li>Record your tests in Firefox using the Selenium IDE <br /><a href="http://www.emadibrahim.com/wp-content/uploads/2009/01/image.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="352" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2009/01/image-thumb.png" width="262" border="0"></a>
<li>Click File &gt; Create New Test
<li>Click the record button and create your test
<li>Click the record button to stop the test
<li>Save your test
<li>Click Options &gt; Format &gt; C# to get the C# code <br /><a href="http://www.emadibrahim.com/wp-content/uploads/2009/01/image1.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="452" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2009/01/image-thumb1.png" width="463" border="0"></a> </li>
</ol>
<h2>Setup Selenium Remote Control (RC)</h2>
<ol>
<li>Download Selenium RC (it includes the server and all necessary files)
<li>Start the server by running selenium-server.jar in the selenium-server folder
<ol>
<li>You can double click it, or
<li>Open a command prompt and type: <br /><em>java -jar selenium-server.jar</em> </li>
</ol>
</li>
</ol>
<h2>Run the tests</h2>
<ol>
<li>Create a new class library project in Visual Studio.
<li>Reference the assemblies in the selenium RC folder related to .net
<li>Paste the generated code from step #7 above into a class file
<li>To test Internet Explorer, change the setup method to this <br /> 
<div>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">[SetUp]
<span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> SetupTest()
{
    selenium = <span style="color: #0000ff">new</span> DefaultSelenium(<span style="color: #006080">"localhost"</span>, 4444, <span style="color: #006080">"*iexplore"</span>,
                                    <span style="color: #006080">"http://www.mywebsite.com/"</span>);
    selenium.Start();
    verificationErrors = <span style="color: #0000ff">new</span> StringBuilder();
}</pre>
</div>
<li>Run the tests with your favorite Runner &#8211; I use ReSharper </li>
</ol>
<p>A Selenium Core window opens up as well as an IE window and your tests will run.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2009/01/image2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="218" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2009/01/image-thumb2.png" width="515" border="0"></a> </p>
<p>Jeremy blogged something very similar to this at <a title="http://codebetter.com/blogs/jeremy.miller/archive/2006/05/14/144666.aspx" href="http://codebetter.com/blogs/jeremy.miller/archive/2006/05/14/144666.aspx">http://codebetter.com/blogs/jeremy.miller/archive/2006/05/14/144666.aspx</a></p>
<div class="aizattos_related_posts"><span class="aizattos_related_posts_header" >Related Posts</span><ul><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/08/08/software-virtualization/" rel="bookmark" title="Permanent Link: Software Virtualization" >Software Virtualization</a></span><div class="aizattos_related_posts_excerpt">&nbsp; Look ma, no virtualisation window: at Tech.Ed Australia today, Microsoft showed its new "Soft...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/07/25/web-design-toolbox/" rel="bookmark" title="Permanent Link: Web Design Toolbox" >Web Design Toolbox</a></span><div class="aizattos_related_posts_excerpt">Here is an excellent post with tons of links to all sort of web design sites, tools, resources, etc....</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/08/01/smartsniff-freeware-packet-sniffer-2/" rel="bookmark" title="Permanent Link: SmartSniff: Freeware Packet Sniffer" >SmartSniff: Freeware Packet Sniffer</a></span><div class="aizattos_related_posts_excerpt">&nbsp; SmartSniff: Freeware Packet Sniffer - Capture TCP/IP packets on your network adapter  here is...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/09/24/free-icons-and-images/" rel="bookmark" title="Permanent Link: Free Icons and Images" >Free Icons and Images</a></span></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/08/10/the-best-javascript-library/" rel="bookmark" title="Permanent Link: The Best JavaScript Library" >The Best JavaScript Library</a></span></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2009/01/19/testing-web-app-with-selenium-explorer-and-net/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Good TDD Process Diagram?</title>
		<link>http://www.emadibrahim.com/2008/09/22/a-good-tdd-process-diagram/</link>
		<comments>http://www.emadibrahim.com/2008/09/22/a-good-tdd-process-diagram/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 14:50:33 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[MVC Book]]></category>
		<category><![CDATA[mvcbook]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2008/09/22/a-good-tdd-process-diagram/</guid>
		<description><![CDATA[I am trying to create a flow diagram that depicts the Test Driven Development process and I need your expertise/opinion/criticism in nailing it down. Take a look below and let me know what is wrong, what is right and what can be done better. I drew the above diagram based on my understanding of TDD [...]]]></description>
			<content:encoded><![CDATA[<p>I am trying to create a flow diagram that depicts the Test Driven Development process and I need your expertise/opinion/criticism in nailing it down.</p>
<p>Take a look below and let me know what is wrong, what is right and what can be done better.</p>
<p align="center"><a href="http://www.emadibrahim.com/wp-content/uploads/2008/09/image4.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="725" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2008/09/image-thumb4.png" width="235" border="0" /></a> </p>
<p>I drew the above diagram based on my understanding of TDD and by referencing other diagrams that I found online.&#160; Specifically:</p>
<p align="center"><a href="http://www.emadibrahim.com/wp-content/uploads/2008/09/image5.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="375" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2008/09/image-thumb5.png" width="211" border="0" /></a> </p>
<p>from <a href="http://www.agiledata.org/essays/tdd.html">http://www.agiledata.org/essays/tdd.html</a></p>
<p align="center"><a href="http://www.emadibrahim.com/wp-content/uploads/2008/09/image6.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="284" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2008/09/image-thumb6.png" width="241" border="0" /></a> </p>
<p>from <a href="http://designindrive.com/?p=31">http://designindrive.com/?p=31</a></p>
<p align="center"><a href="http://www.emadibrahim.com/wp-content/uploads/2008/09/image7.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="126" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2008/09/image-thumb7.png" width="244" border="0" /></a> </p>
<p>from <a title="http://tinyurl.com/498pjg" href="http://tinyurl.com/498pjg">http://tinyurl.com/498pjg</a></p>
<div class="aizattos_related_posts"><span class="aizattos_related_posts_header" >Related Posts</span><ul><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/09/07/deciding-between-aspnet-mvc-and-webforms/" rel="bookmark" title="Permanent Link: Deciding Between ASP.NET MVC and WebForms" >Deciding Between ASP.NET MVC and WebForms</a></span><div class="aizattos_related_posts_excerpt">I am trying to create a decision flowchart for my ASP.NET MVC book and wanted to get some community ...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/04/23/my-altnet-code/" rel="bookmark" title="Permanent Link: My ALT.NET Code" >My ALT.NET Code</a></span><div class="aizattos_related_posts_excerpt">Here is my alt.net code...  Click on the link to decode it.
IOC(SM):IOC(Nin):
MOC(MQ):
TDD(NU):T...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/08/18/the-best-ioc-container/" rel="bookmark" title="Permanent Link: The Best IoC Container?" >The Best IoC Container?</a></span><div class="aizattos_related_posts_excerpt">As I previously mentioned in my post "The Best JavaScript Library", I am in the process of developin...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/08/10/the-best-javascript-library/" rel="bookmark" title="Permanent Link: The Best JavaScript Library" >The Best JavaScript Library</a></span></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/06/08/failed-to-generate-a-user-instance-of-sql-server-due-to-a-failure-in-starting-the-process-for-the-user-instance-the-connection-will-be-closed/" rel="bookmark" title="Permanent Link: Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed." >Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.</a></span></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2008/09/22/a-good-tdd-process-diagram/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mocking and Dependency Injection in ASP.NET MVC</title>
		<link>http://www.emadibrahim.com/2008/08/27/mocking-and-dependency-injection-in-aspnet-mvc/</link>
		<comments>http://www.emadibrahim.com/2008/08/27/mocking-and-dependency-injection-in-aspnet-mvc/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 12:41:16 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[di]]></category>
		<category><![CDATA[ioc]]></category>
		<category><![CDATA[mbunit]]></category>
		<category><![CDATA[moq]]></category>
		<category><![CDATA[MVC Book]]></category>
		<category><![CDATA[ninject]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2008/08/27/mocking-and-dependency-injection-in-aspnet-mvc/</guid>
		<description><![CDATA[Here is the situation, my controller constructors take multiple interfaces as parameters.&#160; I do this in order to use constructor injection which allows me to inject the controllers with mocked objects in my unit tests. For example, my AccountController takes IEmailService, IFormsAuthentication and MembershipProvider (abstract class) as parameters. During my testing, I want to mock [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the situation, my controller constructors take multiple interfaces as parameters.&nbsp; I do this in order to use constructor injection which allows me to inject the controllers with mocked objects in my unit tests.</p>
<p>For example, my AccountController takes IEmailService, IFormsAuthentication and MembershipProvider (abstract class) as parameters.</p>
<p>During my testing, I want to mock the email, authentication and membership calls.&nbsp; For example when the user calls FormsAuthentication.Login, I don&#8217;t really care if actual call succeeded but rather that my login action works appropriately in the case FormstAuthentication.Login succeeds (or fails).&nbsp; I just want to mock that call.</p>
<p>I started off creating a few tests and slowly they have grown to several.&nbsp; There was a lot of repeated code in my unit tests and to be a good citizen of the <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a> universe, I needed to refactor the code.</p>
<p>For IoC, I initially started with <a href="http://www.emadibrahim.com/2008/08/18/the-best-ioc-container/">StructureMap</a> but now I am using <a href="http://www.emadibrahim.com/2008/08/21/ninject-killer-ioc/">Ninject</a>.&nbsp; </p>
<p>I created this module to bind my interfaces to mocked instances.&nbsp; It looks like this:</p>
<div>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">internal</span> <span style="color: #0000ff">class</span> TestModule : StandardModule
{
    <span style="color: #0000ff">public</span> <span style="color: #0000ff">override</span> <span style="color: #0000ff">void</span> Load()
    {
        Bind&lt;IEmailService&gt;()
            .ToConstant(MyMocks.MockEmailService.Object);

        Bind&lt;IFormsAuthentication&gt;()
            .ToConstant(MyMocks.MockFormsAuthentication.Object);

        Bind&lt;MembershipProvider&gt;()
            .ToConstant(MyMocks.MockMembershipProvider.Object);

        Bind&lt;IContactListService&gt;()
            .ToConstant(MyMocks.MockContactListService.Object);
    }
}</pre>
</div>
<p>Notice that I bind the interfaces to actual instances and not classes.&nbsp; These instances are declared in a global static class that will be accessed from my unit tests.&nbsp; As you can tell from the name, they are all mocked objects (I am using <a href="http://code.google.com/p/moq/">Moq</a>).&nbsp; Here is how the MockEmailService looks (all the others are declared the same way):</p>
<div>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">internal</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">class</span> MyMocks
{
    <span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> Mock&lt;IEmailService&gt; _mockEmailService;
    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> Mock&lt;IEmailService&gt; MockEmailService
    {
        get
        {
            _mockEmailService = _mockEmailService ?? <span style="color: #0000ff">new</span> Mock&lt;IEmailService&gt;();
            <span style="color: #0000ff">return</span> _mockEmailService;
        }
    }</pre>
</div>
<p>&nbsp;</p>
<p>So all this is good to setup Ninject and create my mocks.&nbsp; Now I want to easily and generically create a controller, so I can quickly create unit tests.&nbsp; In order to do that, I created a TestControllerFactory class that basically creates a controller with all the appropriate dependencies injected.</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">internal</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">class</span> TestControllerFactory</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> IKernel _kernel;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> IKernel Kernel</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   5:</span>     {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>         get</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   7:</span>         {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>             <span style="color: #0000ff">if</span> (_kernel == <span style="color: #0000ff">null</span>)</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   9:</span>             {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>                 var modules = <span style="color: #0000ff">new</span> IModule[] { <span style="color: #0000ff">new</span> TestModule() };</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  11:</span>                 _kernel = <span style="color: #0000ff">new</span> StandardKernel(modules);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>             }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  13:</span>             <span style="color: #0000ff">return</span> _kernel;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>         }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  15:</span>         <span style="color: #0000ff">private</span> set</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span>         {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  17:</span>             _kernel = <span style="color: #0000ff">value</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>         }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  19:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span>&nbsp; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  21:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> T GetControllerWithFakeContext&lt;T&gt;(<span style="color: #0000ff">string</span> httpMethod) </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  22:</span>         <span style="color: #0000ff">where</span> T : Controller</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  23:</span>     {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  24:</span>         var con = Kernel.Get&lt;T&gt;();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  25:</span>         con.SetFakeControllerContext();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  26:</span>         <span style="color: #0000ff">if</span> (con != <span style="color: #0000ff">null</span>) con.Request.SetHttpMethodResult(httpMethod);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  27:</span>         <span style="color: #0000ff">return</span> con;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  28:</span>     }</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  29:</span>&nbsp; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  30:</span> }</pre>
</div>
</div>
<p>In line #10, I use the TestModule class mentioned above to setup the <a href="http://ninject.org/" target="_blank">Ninject</a> Kernel.&nbsp; In lines #21 to #28, I create an instance of T which must be of type Controller from the Kernel which will automatically create the Controller with all the mocked objects.&nbsp; In line #25 and #26, I just set a fake/mocked context and the Http Method for the request (<a href="http://www.emadibrahim.com/2008/04/04/unit-test-linq-to-sql-in-aspnet-mvc-with-moq/">more info here</a>).</p>
<p>Now my unit tests are very clean and easy to setup.&nbsp;&nbsp;&nbsp; Using <a href="http://www.mbunit.com/" target="_blank">MbUnit</a> as my unit test framework, here is a unit tests that tests the reset password functionality.</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   1:</span> [Test]</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> ResetPasswordQuestion_Should_Send_Email_On_Success()</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   3:</span> {</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span>     var newpassword = <span style="color: #006080">"newpassword"</span>;</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   5:</span>     MyMocks.MockMembershipProvider</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span>          .Expect(p =&gt; p.ResetPassword(username, answer))</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   7:</span>          .Returns(newpassword);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span>     MyMocks.MockEmailService</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   9:</span>          .Expect(m =&gt; m.SendPasswordReset(username, newpassword));</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span>&nbsp; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  11:</span>     var ac = TestControllerFactory</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  12:</span>                 .GetControllerWithFakeContext&lt;AccountController&gt;(<span style="color: #006080">"POST"</span>);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  13:</span>&nbsp; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  14:</span>     var results = ac.ResetPasswordQuestion(username, question, answer);</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  15:</span>     <span style="color: #008000">//write some asserts in here to make sure things worked</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  16:</span>&nbsp; </pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  17:</span>     <span style="color: #008000">//verify all mocks</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  18:</span>     MyMocks.MockMembershipProvider.VerifyAll();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  19:</span>     MyMocks.MockEmailService.VerifyAll();</pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  20:</span> }</pre>
</div>
</div>
<p>Line #5: I mock the ResetPassword call on the membership provider and tell it to return the new password</p>
<p>Line #8: I mock the SendPasswordReset method on the email service</p>
<p>Line #11: Get an instance of AccountController from the Ninject Kernel</p>
<p>I just write some code to make sure the expected results took place and that my mocks were properly exercised and that&#8217;s pretty much it.&nbsp; No need to have an SMTP server working to test this, no need to have a database, no need to have an authentication method, no need to implement the interfaces or write dummy methods.</p>
<p>I am like a kid in a candy store with all these things: mocking, dependency injection, inversion of control, unit testing&#8230;&nbsp; I am loving it.</p>
<p>So what do you think?&nbsp; Is this a good way to go about it?&nbsp; Is there a better way and what is it?</p>
<div class="aizattos_related_posts"><span class="aizattos_related_posts_header" >Related Posts</span><ul><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/08/18/the-best-ioc-container/" rel="bookmark" title="Permanent Link: The Best IoC Container?" >The Best IoC Container?</a></span><div class="aizattos_related_posts_excerpt">As I previously mentioned in my post "The Best JavaScript Library", I am in the process of developin...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/03/31/ajax-with-aspnet-mvc-framework-preview-2/" rel="bookmark" title="Permanent Link: Ajax with ASP.NET MVC Framework Preview 2" >Ajax with ASP.NET MVC Framework Preview 2</a></span><div class="aizattos_related_posts_excerpt">This is the updated version of the Nikhil's excellent example on how to use Ajax with ASP.net MVC.
...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/09/07/deciding-between-aspnet-mvc-and-webforms/" rel="bookmark" title="Permanent Link: Deciding Between ASP.NET MVC and WebForms" >Deciding Between ASP.NET MVC and WebForms</a></span><div class="aizattos_related_posts_excerpt">I am trying to create a decision flowchart for my ASP.NET MVC book and wanted to get some community ...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/04/04/unit-test-linq-to-sql-in-aspnet-mvc-with-moq/" rel="bookmark" title="Permanent Link: Unit Test Linq to Sql in ASP.Net MVC with Moq" >Unit Test Linq to Sql in ASP.Net MVC with Moq</a></span></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/01/05/resolving-url-in-aspnet-using-tilda/" rel="bookmark" title="Permanent Link: Resolving URL in ASP.net using Tilda (~)" >Resolving URL in ASP.net using Tilda (~)</a></span></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2008/08/27/mocking-and-dependency-injection-in-aspnet-mvc/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The Best JavaScript Library</title>
		<link>http://www.emadibrahim.com/2008/08/10/the-best-javascript-library/</link>
		<comments>http://www.emadibrahim.com/2008/08/10/the-best-javascript-library/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 19:02:40 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[MVC Book]]></category>
		<category><![CDATA[mvcbook]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[script.aculo.us]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2008/08/10/choosing-a-javascript-library/</guid>
		<description><![CDATA[I am in the process of creating a new web application using asp.net mvc and I am trying to choose the best JavaScript library to use.  I am pretty much sure that I am going to go with jQuery but nonetheless I wanted to review the libraries out there.  One reason is that I am [...]]]></description>
			<content:encoded><![CDATA[<p>I am in the process of creating a new web application using asp.net mvc and I am trying to choose the best JavaScript library to use.  I am pretty much sure that I am going to go with jQuery but nonetheless I wanted to review the libraries out there.  One reason is that I am writing a book and I want to be able to justify to the readers why I am going with jQuery and not the others.</p>
<h2>What do I want from my JavaScript Library?</h2>
<p>I want it to be easy (I am not a JavaScript expert)<br />
I want it to be small<br />
I want it to be fast<br />
I want it to be extensible<br />
I want good documentation and/or community support<br />
I want good/easy AJAX support<br />
I want it to be asp.net-friendly<br />
I also want it to be testable (I am using TDD for this project/book)<br />
Open Source would be nice but not required</p>
<h2>What are my options?</h2>
<p>jQuery &#8211; <a title="http://jquery.com/" href="http://jquery.com/">http://jquery.com/</a><br />
Microsoft AJAX &#8211; <a title="http://www.asp.net/ajax/" href="http://www.asp.net/ajax/">http://www.asp.net/ajax/</a><br />
Dojo &#8211; <a title="http://dojotoolkit.org/" href="http://dojotoolkit.org/">http://dojotoolkit.org/</a><br />
Prototype &#8211; <a title="http://www.prototypejs.org/" href="http://www.prototypejs.org/">http://www.prototypejs.org/</a><br />
YUI &#8211; <a title="http://developer.yahoo.com/yui/" href="http://developer.yahoo.com/yui/">http://developer.yahoo.com/yui/</a></p>
<p>This is a shortlist but if you want a more exhaustive, <a href="http://ntt.cc/2008/02/13/the-most-complete-ajax-framework-and-javascript-libraries-list.html" target="_blank">read this</a>.  I only picked these, for the simple reasons that I have heard of them and are somewhat known by the community.</p>
<h2>3 days later</h2>
<p>It&#8217;s been 3 days since I started this post and I have spent all that time playing around with these libraries&#8230;  I have gone back and forth in my opinion on which library to use.  I love jQuery&#8217;s selectors, ease of use and community support.  Porototype is also very popular and somewhat similar to jQuery; but I would take jQuery over Prototype for the simple reason that I like jQuery.  YUI (Yahoo! UI) library is beautiful looking and very comprehensive.</p>
<h3>jQuery</h3>
<p>Pros</p>
<ol>
<li>Ease to learn and use</li>
<li>Beautiful syntax (the least typing)</li>
<li>Great community support and lots of fans</li>
<li>Decent Documentation</li>
<li>I already own <a href="http://www.amazon.com/exec/obidos/ASIN/1933988355/emadibrahim-20" target="_blank">the book</a></li>
<li>QUnit test framework (<a title="http://docs.jquery.com/QUnit" href="http://docs.jquery.com/QUnit">http://docs.jquery.com/QUnit</a>)</li>
</ol>
<p>Cons</p>
<ol>
<li>UI isn&#8217;t that great</li>
<li>Library is not as full-featured without plugins</li>
<li>Plugins are somewhat inconsistent in quality depending on the author</li>
</ol>
<h3>Prototype</h3>
<p>Pros</p>
<ol>
<li>Good documentation</li>
<li>Good community support</li>
<li>Lots of books
<ol>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/1590599195/emadibrahim-20" target="_blank">Practical Prototype and script-aculo.us</a></li>
<li><a href="http://www.amazon.com/exec/obidos/ASIN/1934356018/emadibrahim-20" target="_blank">Prototype and script.aculo.us: You Never Knew JavaScript Could Do This!</a></li>
<li>and many more&#8230;</li>
</ol>
</li>
<li>Great UI with the add-on script.aculo.us (<a title="http://script.aculo.us/" href="http://script.aculo.us/">http://script.aculo.us/</a>)</li>
</ol>
<p>Cons</p>
<ol>
<li>Couldn&#8217;t find a testing framework (but I didn&#8217;t look too hard)</li>
<li>For some purely emotional reason, I prefer jQuery</li>
</ol>
<h3>YUI</h3>
<p>Pros</p>
<ol>
<li>Great UI components and styles</li>
<li>The best documented library out there, hands down.</li>
<li>Distributed hosting of JS files &#8211; the script files will be downloaded from Yahoo server, so when my site becomes a mega-hit, it will scale better.</li>
<li>Great test framework and test runner &#8211; check these <a href="http://developer.yahoo.com/yui/examples/yuitest/index.html" target="_blank">demos</a><br />
<a href="http://www.emadibrahim.com/wp-content/uploads/2008/08/image1.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://www.emadibrahim.com/wp-content/uploads/2008/08/image-thumb1.png" border="0" alt="image" width="388" height="359" /></a></li>
<li>The most complete library</li>
<li>PDF cheat sheets for every component</li>
</ol>
<p>Cons</p>
<ol>
<li>Very verbose &#8211; not as elegant as jQuery, but that&#8217;s not too hard to fix e.g. I can assign YAHOO.util.Event to a variable $E and use $E as the shorthand.</li>
</ol>
<h3>The rest</h3>
<p>I got tired of all the research and decided to wrap it up, so I glanced over Microsoft AJAX and Dojo and realized that there isn&#8217;t enough there to justify more research.</p>
<h2>The winner&#8230;</h2>
<p>When I started this post, I was pretty certain my final choice will be jQuery.  Then I started playing with Prototype and it looked really good, which kind of opened my eyes to the need to be open minded and objective.  This lead to a more objective look at YUI and the conclusion to use YUI.  I was very impressed with YUI&#8217;s look &amp; feel, extensive documentation, testing framework and the icing on the cake was the free hosting of the JavaScript libraries.  This was a really tough decision because I still love jQuery the best.</p>
Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.
<div class="aizattos_related_posts"><span class="aizattos_related_posts_header" >Related Posts</span><ul><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/02/10/validating-the-page-using-javascript/" rel="bookmark" title="Permanent Link: Validating the page using JavaScript" >Validating the page using JavaScript</a></span><div class="aizattos_related_posts_excerpt">I was using an AJAX tab control and wanted to validate the tab page before the switching away to ano...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/09/09/online-book-library/" rel="bookmark" title="Permanent Link: Online Book Library" >Online Book Library</a></span><div class="aizattos_related_posts_excerpt">Here is an easy and quick way to create a virtual online book library.  Go to http://books.google.co...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/07/25/sitemeter-and-wordpress/" rel="bookmark" title="Permanent Link: Sitemeter and wordpress" >Sitemeter and wordpress</a></span><div class="aizattos_related_posts_excerpt">I just added sitemeter to BlogsToGo (WordPres Mu).  I have a plugins file in my mu-plugins directory...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/08/18/the-best-ioc-container/" rel="bookmark" title="Permanent Link: The Best IoC Container?" >The Best IoC Container?</a></span></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/07/14/sync-music-and-other-files-between-mac-and-pc/" rel="bookmark" title="Permanent Link: Sync music and other files between Mac and PC" >Sync music and other files between Mac and PC</a></span></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2008/08/10/the-best-javascript-library/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
		<item>
		<title>Unit Test Private Methods in Visual Studio</title>
		<link>http://www.emadibrahim.com/2008/07/09/unit-test-private-methods-in-visual-studio/</link>
		<comments>http://www.emadibrahim.com/2008/07/09/unit-test-private-methods-in-visual-studio/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 17:33:42 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[mstest]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[testing private methods]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[vsts]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2008/07/09/unit-test-private-methods-in-visual-studio/</guid>
		<description><![CDATA[I am working on a feature that will let me import twitter messages to yonkly and wanted to write a test for it.&#160; The method is private and I couldn&#8217;t get the unit test to see it.&#160; I also didn&#8217;t want to use the private accessor class generate by Visual Studio because I was mocking [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a feature that will let me import twitter messages to <a href="http://yonkly.com" target="_blank">yonkly</a> and wanted to write a test for it.&#160; The method is private and I couldn&#8217;t get the unit test to see it.&#160; I also didn&#8217;t want to use the private accessor class generate by Visual Studio because I was mocking some functionality in the actual class and didn&#8217;t really fell like re-mocking it on the private accessor.</p>
<p>So, after several minutes of googling, I found several solutions that I didn&#8217;t like.&#160; <a href="http://johnhann.blogspot.com/2007/04/unit-testing-private-methods.html" target="_blank">John Hann</a> uses reflection to test private methods.&#160; <a href="http://www.codeproject.com/KB/cs/testnonpublicmembers.aspx" target="_blank">Tim Stall</a> has a similar solution at the code project.&#160; <a href="http://weblogs.asp.net/astopford/archive/2005/06/03/410248.aspx" target="_blank">Andrew Stopford</a> suggested that I don&#8217;t test private methods and use code coverage to make sure that they are being exercised.&#160; I was about to use the methods suggested by John Hann and Tim Stall to test my private methods, but then I accidentally (thanks to IntelliSense) discovered PrivateObject.</p>
<p>The PrivateObject class is part of the Team Test API.</p>
<blockquote><p>Allows test code to call methods and properties on the code under test that would be inaccessible because they are not <b>public</b>.       <br />from <font style="background-color: #e8e9dc"><a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.privateobject(VS.80).aspx" target="_blank">msdn</a></font></p>
</blockquote>
<p>It turned out to be pretty easy to test private methods and the code looked like this:</p>
<div>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">var myController = <span style="color: #0000ff">new</span> TwitterController();
var po = <span style="color: #0000ff">new</span> PrivateObject(myController);
var page = 1;
var count = 25;
po.Invoke(<span style="color: #006080">&quot;ImportTweets&quot;</span>, <span style="color: #0000ff">new</span> <span style="color: #0000ff">object</span>[] { page, count });</pre>
</div>
<p>&#160;</p>
<p>The code above will call the private method ImportTweets and pass it two integer parameters.&#160; This is the equivalent of calling</p>
<div>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">myController.ImportTweets( page, count);</pre>
</div>
<p>&#160;</p>
<p>Note that this is essentially what John Hann and Tim Stall suggested but why use extra code when PrivateObject is already available for you.</p>
<div class="aizattos_related_posts"><span class="aizattos_related_posts_header" >Related Posts</span><ul><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/03/11/visual-studio-2005-tips/" rel="bookmark" title="Permanent Link: Visual Studio 2005 Tips" >Visual Studio 2005 Tips</a></span><div class="aizattos_related_posts_excerpt">Check out this time-saving article on visual studio 2005 tips and tricks:  http://msdn2.microsoft.co...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/04/04/unit-test-linq-to-sql-in-aspnet-mvc-with-moq/" rel="bookmark" title="Permanent Link: Unit Test Linq to Sql in ASP.Net MVC with Moq" >Unit Test Linq to Sql in ASP.Net MVC with Moq</a></span><div class="aizattos_related_posts_excerpt">I have just spent the entire day playing with Moq to unit test an asp.net mvc application I am worki...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/04/02/geeks-use-keyboard-shortcuts/" rel="bookmark" title="Permanent Link: Geeks use Keyboard Shortcuts" >Geeks use Keyboard Shortcuts</a></span><div class="aizattos_related_posts_excerpt">If you are using the mouse to copy and paste then this site is not for you. And for Pete's sake lear...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/07/14/visual-studio-window-manager/" rel="bookmark" title="Permanent Link: Visual Studio Window Manager" >Visual Studio Window Manager</a></span></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2007/03/04/visual-studio-orcas-and-wpf-first-impressions/" rel="bookmark" title="Permanent Link: Visual Studio Orcas and WPF First Impressions" >Visual Studio Orcas and WPF First Impressions</a></span></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2008/07/09/unit-test-private-methods-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Unit Test Linq to Sql in ASP.Net MVC with Moq</title>
		<link>http://www.emadibrahim.com/2008/04/04/unit-test-linq-to-sql-in-aspnet-mvc-with-moq/</link>
		<comments>http://www.emadibrahim.com/2008/04/04/unit-test-linq-to-sql-in-aspnet-mvc-with-moq/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 20:29:34 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[mocking]]></category>
		<category><![CDATA[moq]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2008/04/04/unit-test-linq-to-sql-in-aspnet-mvc-with-moq/</guid>
		<description><![CDATA[I have just spent the entire day playing with Moq to unit test an asp.net mvc application I am working with. All I wanted to do is test a &#8220;create&#8221; method that simply adds a record to the database. So here it goes. 1. I created a Mock Http context to be used by my [...]]]></description>
			<content:encoded><![CDATA[<p>I have just spent the entire day playing with Moq to unit test an asp.net mvc application I am working with. All I wanted to do is test a &#8220;create&#8221; method that simply adds a record to the database. So here it goes.</p>
<p>1. I created a Mock Http context to be used by my controller. I modified the Moq version of the MvcMockHelpers class from <a href="http://www.hanselman.com/blog/ASPNETMVCSessionAtMix08TDDAndMvcMockHelpers.aspx" target="_blank">Scott Hanselman</a> and added two more methods to mock an authenticated user</p>
<blockquote><pre class="code"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #2b91af">HttpContextBase</span> FakeAuthenticatedHttpContext()
{
<span style="color: #0000ff">var</span> context = <span style="color: #0000ff">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpContextBase</span>&gt;();
<span style="color: #0000ff">var</span> request = <span style="color: #0000ff">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpRequestBase</span>&gt;();
<span style="color: #0000ff">var</span> response = <span style="color: #0000ff">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpResponseBase</span>&gt;();
<span style="color: #0000ff">var</span> session = <span style="color: #0000ff">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpSessionStateBase</span>&gt;();
<span style="color: #0000ff">var</span> server = <span style="color: #0000ff">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpServerUtilityBase</span>&gt;();
<span style="color: #0000ff">var</span> user = <span style="color: #0000ff">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">IPrincipal</span>&gt;();
<span style="color: #0000ff">var</span> identity = <span style="color: #0000ff">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">IIdentity</span>&gt;();

context.Expect(ctx =&gt; ctx.Request).Returns(request.Object);
context.Expect(ctx =&gt; ctx.Response).Returns(response.Object);
context.Expect(ctx =&gt; ctx.Session).Returns(session.Object);
context.Expect(ctx =&gt; ctx.Server).Returns(server.Object);
context.Expect(ctx =&gt; ctx.User).Returns(user.Object);
user.Expect(ctx =&gt; ctx.Identity).Returns(identity.Object);
identity.Expect(id =&gt; id.IsAuthenticated).Returns(<span style="color: #0000ff">true</span>);
identity.Expect(id =&gt; id.Name).Returns(<span style="color: #a31515">"test"</span>); <span style="color: #008000">
</span>    <span style="color: #0000ff">return</span> context.Object;
}</pre>
</blockquote>
<blockquote><pre class="code"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span>
SetFakeAuthenticatedControllerContext(<span style="color: #0000ff">this</span> <span style="color: #2b91af">Controller</span> controller)
{
<span style="color: #0000ff">var</span> httpContext = FakeAuthenticatedHttpContext();
<span style="color: #2b91af">ControllerContext</span> context =                  <span style="color: #0000ff">
new</span> <span style="color: #2b91af">ControllerContext</span>(
<span style="color: #0000ff">new</span> <span style="color: #2b91af">RequestContext</span>(httpContext,
<span style="color: #0000ff">new</span> <span style="color: #2b91af">RouteData</span>()), controller);
controller.ControllerContext = context;
}</pre>
</blockquote>
<p>Note that the identity.Name returns &#8220;test&#8221; which is the username of an existing user in the database. If I don&#8217;t do that then the MembershipProvider.GetUser method will fail.</p>
<p>2. I added a couple of properties to my test class (MessageControllerTest) to make it easy for me to access the controller and view engine in all the test methods</p>
<blockquote><pre class="code"><span style="color: #0000ff">private</span> <span style="color: #2b91af">FakeViewEngine</span> _fakeViewEngine;
<span style="color: #0000ff">public</span> <span style="color: #2b91af">FakeViewEngine</span> FakeViewEngine
{
<span style="color: #0000ff">get
</span>    {
<span style="color: #0000ff">if</span> (_fakeViewEngine == <span style="color: #0000ff">null</span>)</pre>
<p></p>
<pre class="code">              _fakeViewEngine = <span style="color: #0000ff">new</span> <span style="color: #2b91af">FakeViewEngine</span>();
<span style="color: #0000ff">return</span> _fakeViewEngine;
}
}

<span style="color: #0000ff">private</span> <span style="color: #2b91af">MessageController</span> authenticatedController;
<span style="color: #0000ff">private</span> <span style="color: #2b91af">MessageController</span> AuthenticatedController
{
<span style="color: #0000ff">get
</span>    {
<span style="color: #0000ff">if</span> (authenticatedController == <span style="color: #0000ff">null</span>)
{
authenticatedController = <span style="color: #0000ff">new</span> <span style="color: #2b91af">MessageController</span>();
authenticatedController.ViewEngine = FakeViewEngine;
authenticatedController.SetFakeAuthenticatedControllerContext();
}
<span style="color: #0000ff">return</span> authenticatedController;
}
}</pre>
</blockquote>
<p>3. I created my test method which is going to call a Create method in my MessageController and pass it a string.</p>
<blockquote><pre class="code">[<span style="color: #2b91af">TestMethod</span>]
<span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Create_Message_Test()
{
AuthenticatedController.Create(<span style="color: #a31515">"This is a test message"</span>);

<span style="color: #008000">//verify
</span>    <span style="color: #2b91af">Assert</span>.AreEqual(<span style="color: #a31515">"Json"</span>, FakeViewEngine.ViewContext.ViewName);
<span style="color: #2b91af">Assert</span>.IsInstanceOfType(FakeViewEngine.ViewContext.ViewData,</pre>
<p></p>
<pre class="code">                             <span style="color: #0000ff">typeof</span>(MyViewData));
<span style="color: #2b91af">Assert</span>.IsTrue(((MyViewData)FakeViewEngine.ViewContext</pre>
<p></p>
<pre class="code">                            .ViewData).isSuccessful);
<span style="color: #2b91af">Assert</span>.IsNotNull(((MyViewData)FakeViewEngine</pre>
<p></p>
<pre class="code">                            .ViewContext.ViewData).Id);

<span style="color: #0000ff">using</span> (MyDataContext dc = <span style="color: #0000ff">new</span> MyDataContext())
{
<span style="color: #0000ff">var</span> query =
dc.Messages.Where(
m =&gt; m.MessageId ==
((MyViewData)FakeViewEngine</pre>
<p></p>
<pre class="code">                       .ViewContext.ViewData).Id);
<span style="color: #008000">//verify it was added to the database
</span>        <span style="color: #2b91af">Assert</span>.AreEqual(1, query.Count());

<span style="color: #008000">//delete it
</span>        dc.Messages.DeleteOnSubmit(query.First());
dc.SubmitChanges();

<span style="color: #008000">//verify it was delete
</span>        <span style="color: #2b91af">Assert</span>.AreEqual(0, query.Count());
}
}</pre>
</blockquote>
<p>Note that in the verification block, I verify:</p>
<ol>
<li>The view being rendered
<li>The returned type of the ViewData
<li>Properties on the ViewData </li>
</ol>
<p>Then I clean up the created message by deleting it from the database.</p>
<p><strong>Important:</strong></p>
<p>You must add your connection strings and membership definition in an app.config file in your test project. If you don&#8217;t then the default consrtuctor of your DataContext will fail to run because it looks for the connection string in the config file.</p>
<p>I am still wrapping my head around the concept of mocking, so any tips or advice will be appreciated.</p>
<p>Here are some good resources that I found during my struggle to get this to work.</p>
<h2>ASP.NET MVC Resources</h2>
<ol>
<li><a title="http://dotnetslackers.com/articles/aspnet/ASPNETMVCFrameworkPart2.aspx" href="http://dotnetslackers.com/articles/aspnet/ASPNETMVCFrameworkPart2.aspx">ASP.NET MVC Framework – Part 2: Testing</a>
<li><a href="http://www.hanselman.com/blog/ASPNETMVCSessionAtMix08TDDAndMvcMockHelpers.aspx">ASP.NET MVC Session at Mix08, TDD and MvcMockHelpers</a> </li>
</ol>
<h2>LINQ to SQL Resources</h2>
<ol>
<li><a href="http://iancooper.spaces.live.com/blog/cns!844BD2811F9ABE9C!397.entry">Being Ignorant with LINQ to SQL</a> </li>
</ol>
<h2>Testing and Mocking Resources</h2>
<ol>
<li><a href="http://www.hanselman.com/blog/MoqLinqLambdasAndPredicatesAppliedToMockObjects.aspx">Moq: Linq, Lambdas and Predicates applied to Mock Objects</a>
<li><a href="http://code.google.com/p/moq/">Moq</a>
<li><a href="http://www.ayende.com/projects/rhino-mocks.aspx">Rhino Mocks</a>
<li><a href="http://weblogs.asp.net/stephenwalther/archive/2008/03/19/tdd-test-driven-development-with-visual-studio-2008-unit-tests.aspx">TDD: Test-Driven Development with Visual Studio 2008 Unit Tests</a> </li>
</ol>
<div class="aizattos_related_posts"><span class="aizattos_related_posts_header" >Related Posts</span><ul><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/04/13/cmap-code-camp-2008-spring-edition/" rel="bookmark" title="Permanent Link: CMAP Code Camp 2008 Spring Edition" >CMAP Code Camp 2008 Spring Edition</a></span><div class="aizattos_related_posts_excerpt">Yesterday, I gave a talk at CMAP Code Camp about the asp.net mvc framework and AJAX using JQuery.  T...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/" rel="bookmark" title="Permanent Link: Improve LINQ Query Performance" >Improve LINQ Query Performance</a></span><div class="aizattos_related_posts_excerpt">I was writing a small utility for Outlook 2007 and was using LINQ to query Outlook Tasks.&#160; This...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/03/31/ajax-with-aspnet-mvc-framework-preview-2/" rel="bookmark" title="Permanent Link: Ajax with ASP.NET MVC Framework Preview 2" >Ajax with ASP.NET MVC Framework Preview 2</a></span><div class="aizattos_related_posts_excerpt">This is the updated version of the Nikhil's excellent example on how to use Ajax with ASP.net MVC.
...</div></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2008/08/27/mocking-and-dependency-injection-in-aspnet-mvc/" rel="bookmark" title="Permanent Link: Mocking and Dependency Injection in ASP.NET MVC" >Mocking and Dependency Injection in ASP.NET MVC</a></span></li><li><span class="aizattos_related_posts_title"><a href="http://www.emadibrahim.com/2009/08/18/asp-net-mvc-tdd-free-book-chapter/" rel="bookmark" title="Permanent Link: ASP.NET MVC &amp; TDD Free Book Chapter" >ASP.NET MVC &amp; TDD Free Book Chapter</a></span></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2008/04/04/unit-test-linq-to-sql-in-aspnet-mvc-with-moq/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->