<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Philippe Truche's Blog</title>
	<atom:link href="http://philippetruche.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://philippetruche.wordpress.com</link>
	<description>.NET development and related topics</description>
	<lastBuildDate>Thu, 22 Dec 2011 22:18:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='philippetruche.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Philippe Truche's Blog</title>
		<link>http://philippetruche.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://philippetruche.wordpress.com/osd.xml" title="Philippe Truche&#039;s Blog" />
	<atom:link rel='hub' href='http://philippetruche.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Throwing SOAP Faults in a WCF service being mindful of non-WCF clients</title>
		<link>http://philippetruche.wordpress.com/2011/08/20/throwing-soap-faults-in-a-wcf-service-being-mindful-of-non-wcf-clients/</link>
		<comments>http://philippetruche.wordpress.com/2011/08/20/throwing-soap-faults-in-a-wcf-service-being-mindful-of-non-wcf-clients/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 02:28:44 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[FaultException]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[SoapException]]></category>
		<category><![CDATA[Subcode]]></category>

		<guid isPermaLink="false">https://philippetruche.wordpress.com/?p=68</guid>
		<description><![CDATA[I was engaged recently to design and write a WCF service that is to be consumed by an ASP.NET 2.0 client.  While I was aware that with a WCF service and a WCF client, using a System.ServiceModel.FaultException&#60;TDetail&#62;  was ideal for handling exception conditions, I wasn’t sure how this was going to be handled by .NET [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=68&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was engaged recently to design and write a WCF service that is to be consumed by an ASP.NET 2.0 client.  While I was aware that with a WCF service and a WCF client, using a <a href="http://msdn.microsoft.com/en-us/library/ms576199.aspx" target="_blank">System.ServiceModel.FaultException&lt;TDetail&gt;</a>  was ideal for handling exception conditions, I wasn’t sure how this was going to be handled by .NET 2.0 since FaultException&lt;TDetail&gt; was introduced in .NET 3.0 – in .NET. 2.0, a SOAP faults are caught with  a <a href="http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapexception.aspx" target="_blank">System.Web.Services.Protocols.SoapException</a>.</p>
<p>So off to trial and error I went and here is what I proposed.</p>
<p>Firstly, it is important to write a WCF service that can be consumed by a WCF client as well as a non-WCF client.  To this end, throwing SOAP faults should be done in a manner that both WCF clients and non-WCF clients can understand.  My first step was to make sure I had a standard WCF service with a WCF client that could understand the SOAP faults.  I created a DataContract for the SOAP fault I wanted to throw when certain conditions were met:</p>
<p><pre class="brush: csharp;">
///&lt;summary&gt;
/// Thrown when no matching MPI is found.
/// &lt;/summary&gt;
[DataContract(Namespace = WcfConfiguration.XmlNamespace)]
public class MpiNotFoundFault
{
	private string _mpi;

	///&lt;summary&gt;
	/// Gets or sets the MPI.
	///&lt;/summary&gt;
	[DataMember]
	public string Mpi
	{
		get { return _mpi; }
		set { _mpi = value; }
	}
}
</pre></p>
<p>I  then specified my FaultContract on the service interface definition as follows:</p>
<p><pre class="brush: csharp;">
[ServiceContract]
public interface IMyPinService 
{
	[OperationContract] 
	[FaultContract(typeof(MpiNotFoundFault), Name =&quot;MpiNotFoundFault&quot;, Namespace = WcfConfiguration.XmlNamespace, Action = WcfConfiguration.XmlNamespace +&quot;/MpiNotFoundFault&quot;)] 
	bool RequestPin(string mpi, DateTime dob);
}
</pre></p>
<p>So far, so good.  Now, let’s see how we might throw this SOAP fault in the service implementation.  For the WCF client to work, I threw the exception as follows:</p>
<p><pre class="brush: csharp;">
public bool RequestPin(string mpi, DateTime dob) 
{
	// Code elided
	throw new FaultException&lt;MpiNotFoundFault&gt;(new MpiNotFoundFault() { Mpi = mpi });
}
</pre></p>
<p>Then, in the WCF client, all I have to do is this:</p>
<p><pre class="brush: csharp;">
// With a WCF client, we can catch specific exceptions and get to each fault contract&amp;quot;s 
// contents by accessing the ex.Details propery.
catch (FaultException&lt;MpiNotFoundFault&gt; ex)
{
	Console.WriteLine(“MPI {0} was not found.“, ex.Detail.Mpi);
}
</pre></p>
<p>Yes, WCF does a lot of work for us.  However, when your client is not WCF, SOAP faults get a little bit more complicated.  Fortunately, there is a SOAP specification that can be referred to.  The SOAP 1.2 specification on soap faults is located here: <a href="http://www.w3.org/TR/soap12-part1/#soapfault" target="_blank">http://www.w3.org/TR/soap12-part1/#soapfault</a>.  Notice I am introducing you to SOAP 1.2, not SOAP 1.1.  Yet, in the .NET 2.0 framework, when you use wsdl.exe to create a proxy class, the SOAP 1.1 protocol is defaulted.  That’s somewhat of a problem because is SOAP 1.1, faults may only have a faultcode and a faultstring.  It wasn’t until SOAP 1.2 that hierarchical codes and subcodes were defined.  To see the difference between the two, see <a href="http://hadleynet.org/marc/whatsnew.html#S3.1.4" target="_blank">http://hadleynet.org/marc/whatsnew.html#S3.1.4</a>.</p>
<p>Why is this important you ask?  Well, if in my ASP.NET client (that does not know anything about WCF) all I have is a SoapException, then I’d like to use the code and subcode of the faults to communicate detail about the exception (of course, my service consumer is a trusted source and will filter the information appropriately before passing it on to its users, but that’s another topic entirely).</p>
<p>Here is what I want to do. In my ASP.NET client, I want to check the code and subcode to understand what the nature of the problem was.  Here is what my ASP.NET catch statement looks like this:</p>
<p><pre class="brush: csharp;">
// In WCF we can catch specific exceptions by using FaultException&lt;T&gt; where T is one of the fault contracts 
// included in the service operation. In contrast, ASP.NET web services only allow for catching SoapException. 
// To get to the detail, use the SOAP Fault Code and Subcode as shown below. 
catch (SoapException ex)
{
	// The SOAP fault code always contains the string ‘CredentialValidationRequestFailed’
	Debug.WriteLine(ex.Code.Name); // prints the string &quot;CredentialValidationRequestFailed&quot;
	// The SOAP fault subcode contains the actual soap fault name without the Fault suffix
	Debug.WriteLine(ex.SubCode.Code.Name); // prints the string &quot;MpiNotFound&quot;
}
</pre></p>
<p>By doing this, I can see that my call failed because of a CredentialValidationRequestFailed code.  This code could occur for any number of reasons.  In this example, it occurred because of an MpiNotFound subcode, but I have another 3 subcodes that could have been the cause of the fault.</p>
<p>So what do I need to do to achieve this? Well I need to use SOAP 1.2 for sure.  On the service side, I configure the service using an HttpBinding.  By default, this binding uses SOAP 1.1. and it can&#8217;t be changed.  To use SOAP 1.2 for message encoding, I create a custom binding.  My configuration file now looks like this:</p>
<p><pre class="brush: xml;">
  &lt;system.serviceModel&gt;
    &lt;bindings&gt;
      &lt;customBinding&gt;
        &lt;binding name=&quot;basicHttpSoap12Binding&quot;&gt;
          &lt;textMessageEncoding messageVersion=&quot;Soap12&quot;/&gt;
          &lt;httpTransport/&gt;
        &lt;/binding&gt;
      &lt;/customBinding&gt;
    &lt;/bindings&gt;
    &lt;services&gt;
      &lt;service name=&quot;MySoap12Service&quot;&gt;
        &lt;endpoint address=&quot;&quot; binding=&quot;customBinding&quot; bindingConfiguration=&quot;basicHttpSoap12Binding&quot;
          bindingNamespace=&quot;MySoap12ServiceNamespace&quot;
          contract=&quot;MySoap12Service&quot;&gt;
        &lt;/endpoint&gt;
      &lt;/service&gt;
    &lt;/services&gt;
  &lt;/system.serviceModel&gt;
</pre></p>
<p>On the client side, I use wsdl.exe to generate the proxy class; instead of letting the default SOAP 1.1 protocol apply, I pass in the protocol switch to specify the SOAP 1.2 protocol should be used as follows:  wsdl.exe /protocol:SOAP12.  This causes the generated proxy to specify the SOAP 1.2 protocol in its constructor:</p>
<p><pre class="brush: csharp;">
public partial class MyService : System.Web.Services.Protocols.SoapHttpClientProtocol {
    // code elided
        
    public MyService() {
        this.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12;
        // code elided
    }
    
    // code elided
</pre></p>
<p>Then, I need to throw my SOAP faults with a bit more information.  Here is the revised code snippet for throwing a SOAP fault that can now be understood by non-WCF clients:</p>
<p><pre class="brush: csharp;">
throw new FaultException&lt;MpiNotFoundFault&gt;(new MpiNotFoundFault() { Mpi = mpi },
	String.Format(CultureInfo.InvariantCulture, “MPI ‘{0}’ not found.“, mpi),
	new FaultCode(“CredentialValidationRequestFailed“, new FaultCode(“MpiNotFound“, WcfConfiguration.XmlNamespace)));
</pre></p>
<p>That’s it.  I throw the FaultException&lt;MpiNotFoundFault&gt; exception, passing in a new MpiNotFoundFault object into the constructor, then I pass in the reason as the “MPI ‘xyz’ not found” string, and then I create my code and subcodes.  And voila, I have happy WCF clients and happy non-WCF clients.</p>
<p>On the wire, the SOAP fault looks like this:</p>
<p><pre class="brush: xml;">
&lt;s:Envelope xmlns:s=&quot;http://www.w3.org/2003/05/soap-envelope&quot;&gt;
  &lt;s:Header /&gt;
  &lt;s:Body&gt;
    &lt;s:Fault&gt;
      &lt;s:Code&gt;
        &lt;s:Value&gt;s:CredentialValidationRequestFailed&lt;/s:Value&gt;
        &lt;s:Subcode&gt;
          &lt;s:Value xmlns:a=&quot;MyNamespace&quot;&gt;a:MpiNotFound&lt;/s:Value&gt;
        &lt;/s:Subcode&gt;
      &lt;/s:Code&gt;
      &lt;s:Reason&gt;
        &lt;s:Text xml:lang=&quot;en-US&quot;&gt;MPI '123123' not found.&lt;/s:Text&gt;
      &lt;/s:Reason&gt;
      &lt;s:Detail&gt;
        &lt;MpiNotFoundFault xmlns=&quot;MyNamespace&quot; xmlns:i=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
          &lt;Mpi&gt;123123&lt;/Mpi&gt;
        &lt;/MpiNotFoundFault&gt;
      &lt;/s:Detail&gt;
    &lt;/s:Fault&gt;
  &lt;/s:Body&gt;
&lt;/s:Envelope&gt;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=68&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2011/08/20/throwing-soap-faults-in-a-wcf-service-being-mindful-of-non-wcf-clients/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
		<item>
		<title>Unit Testing 101 &#8211; Fundamentals of Unit Testing</title>
		<link>http://philippetruche.wordpress.com/2011/03/22/unit-testing-101-fundamentals-of-unit-testing/</link>
		<comments>http://philippetruche.wordpress.com/2011/03/22/unit-testing-101-fundamentals-of-unit-testing/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 01:40:00 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[course]]></category>
		<category><![CDATA[fundamentals]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">https://philippetruche.wordpress.com/?p=62</guid>
		<description><![CDATA[This post is my first of 3 posts on unit testing, as introduced in http://philippetruche.wordpress.com/2011/03/11/unit-testing-a-curriculum/.  Unit Testing 101 is targeted at audiences that have little to no familiarity with unit testing.  This might include junior developers and even managers in software development Table Of Contents What? Who? Why? Deciding what to test… …and more importantly, when [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=62&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post is my first of 3 posts on unit testing, as introduced in <a href="http://philippetruche.wordpress.com/2011/03/11/unit-testing-a-curriculum/">http://philippetruche.wordpress.com/2011/03/11/unit-testing-a-curriculum/</a>.  Unit Testing 101 is targeted at audiences that have little to no familiarity with unit testing.  This might include junior developers and even managers in software development</p>
<h2>Table Of Contents</h2>
<ul>
<li>What? Who? Why?</li>
<li>Deciding what to test…</li>
<li>…and more importantly, when to write the tests.</li>
<li>Popular unit testing frameworks available to .NET</li>
<li>Unit test prototype</li>
<li>Writing your first unit tests</li>
</ul>
<h2>What Is Unit Testing? Who Writes The Tests? Why Do It?</h2>
<p>The consensus is that Kent Beck introduced unit testing.  There are a number of definitions of unit testing – personally I like the definition from the book Pragmatic Unit Testing: “unit tests are performed to prove that a piece of code does what the developer thinks it should do.”  The key word is “developer.”  The developers get to write the unit test code.</p>
<p>This leads me to my next point.  Unit Testing isn’t a testing activity; in fact, RUP clearly identifies unit testing as belonging to the implementation discipline (see <a href="http://en.wikipedia.org/wiki/RUP">http://en.wikipedia.org/wiki/RUP</a>).</p>
<p>So if this is an activity that is performed as the source code is being developed, then what are some of the benefits that developers get from writing unit tests?</p>
<ul>
<li>They get living documentation of how the code works.</li>
<li>They get the ability to refactor code quickly and safely through automated regression tests.</li>
<li>It improves the low-level design of their classes.</li>
<li>It reduces risk. Writing tests helps drive the code quality up, thus reducing the number of bugs found much later in the software development lifecycle (SDLC).</li>
</ul>
<p>In fact, unit tests are such a part of development that Michael Feathers defined legacy code as any code that does not have tests (see <a href="http://www.objectmentor.com/resources/articles/WorkingEffectivelyWithLegacyCode.pdf">http://www.objectmentor.com/resources/articles/WorkingEffectivelyWithLegacyCode.pdf</a>)</p>
<h2>Deciding What To Test…</h2>
<p>“What should I test?”  This is an interesting question I get often enough from developers and managers who are new to unit testing.  The question in itself is disconcerting because it reveals just how little is understood about unit testing and often stands as a euphemism for “What is the minimal amount of testing that I can get away with?”</p>
<p>I don’t have a real easy answer to this question.  There are no hard and fast rules that I can provide someone with.  Rather, I prefer to remind developers that the more they write unit tests, the more they improve their design abilities and the better the software they write.</p>
<p>Would I test a class without behaviors?  Probably not.  But what if I have an entity on which I add validation attributes (using the EntLib Validation Block or Data Annotations)?  I would definitely test the validations to ensure that the validators attached to properties are behaving as expected.</p>
<p>So my general rule is to write unit test that focus on behaviors and where there is value in performing this activity.</p>
<h2>…And More Importantly, When To Write The Tests.</h2>
<p>This is definitely the more important question.</p>
<p>As a developer, you get the most value from creating the unit tests when creating the code.  In fact, rarely does it make sense to go back and write unit tests after the code has been written.  Instead, you should write your tests as you write the source code.  Do I sometime s write my test before the code?  Yes – when I have a good idea what I’d like the API to look like.  Sometimes I write the test after creating the initial source code.  Most often, I find that writing source code and unit tests is a bit of the chicken and the egg problem – which one came first?</p>
<p>When dealing with bugs identified by testing teams or customers, you should definitely write tests before fixing the bugs.  The reason for this is twofold:</p>
<ul>
<li>It helps reproduce the issue</li>
<li>It creates a test for a missing scenario</li>
</ul>
<h2>Popular Unit Testing Frameworks On The .NET Platform</h2>
<p>I often get the question: “Which unit testing framework do you use?”  There are a number of frameworks specifically for .NET – most are open source and one is Microsoft’s very own.  They are all fairly similar, and I think which one you use comes down to personal preference.</p>
<p>The more important point is not to confuse the tests runners and the testing framework.  For example, I can run MbUnit tests (part of Gallio) from within Microsoft Visual Studio, and vice versa, I can run Microsoft unit tests from the Gallio Icarius runner.</p>
<p>This being said, here is a list of unit testing frameworks.  It includes, but is not limited to:</p>
<ul>
<li>csUnit. <a href="http://www.csunit.org/">http://www.csunit.org/</a></li>
<li>MbUnit (V3 is part of Gallio). <a href="http://www.gallio.org/">http://www.gallio.org/</a></li>
<li>Nunit. <a href="http://www.nunit.org/">http://www.nunit.org/</a></li>
<li>Visual Studio Unit Testing Framework (Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll).</li>
<li>xUnit.net. <a href="http://xunit.codeplex.com/">http://xunit.codeplex.com/</a></li>
</ul>
<h2>Qualities of Unit Tests</h2>
<p>In preparing this course, I researched a few sites that would help establish a guideline as to what a good unit test should look like.  I ended up settling on a set of quality attributes that unit tests should have.  These quality attributes were presented by Peli De Halleux in an advanced unit testing session in Spain (see <a href="http://channel9.msdn.com/blogs/channel9spain/microsoft-pexmoles--advanced-unit-testing-aspects-13">http://channel9.msdn.com/blogs/channel9spain/microsoft-pexmoles&#8211;advanced-unit-testing-aspects-13</a>).  Of course, my own experience also shaped this list.</p>
<p>Unit tests should have the following quality attributes:</p>
<ul>
<li><strong>Atomic.</strong>
<ul>
<li>No dependencies between tests.  If test[i] must be run after test[j], you have an issue.  With some unit test frameworks (e.g. MbUnit), you can specify the order in which you want to run tests.  Still, it is something you should avoid.</li>
<li>Tests can be run in any order.</li>
<li>Tests can be run repeatedly.  I can’t tell you how many times I’ve seen tests that only work the second time and on subsequent runs.  That usually points to some initialization issues.  Fix them!</li>
<li>Tests can be run concurrently.  If you have thousands of tests and you are running a continuous integration process, this is rather important.  In general, when a test fails unless it is run on its own, there is some sort of shared state issue.  Fix it!</li>
</ul>
</li>
<li><strong>Trustworthy. </strong>
<ul>
<li>Tests should run every time on any machine.  “It works on my machine” is a team development killer.  The tests should run on any machine.  I have seen tests where a local resource from the user’s folder is used!!!  If doing a Get Latest on the solution does not get me all required dependencies, this is not going to work.   If there is one or more failing tests at any point in time, how can the tests be trusted?  What if you make some changes to the source code and there were 50 breaking tests before you started?  You make the change, run the tests, and there are still 50 breaking changes (which tests failed?  are they still the same ones?).  The fact is, you don’t know.  But when all tests pass and you make a change that leads to one or more failing tests, you can evaluate the impact of your changes and either fix the source or fix the tests.</li>
<li>Beware “integration” tests and separate them into their own projects with the word “integration” in them.  Unit tests have to run fast – tests that have dependencies on databases or are otherwise not self-contained should be separated out.  My personal preference is to put them into their own test projects.  I expect these tests will take longer.  At the same time, I expect that unit tests will run very fast.  This is really critical for continuous integration to be efficient.</li>
</ul>
</li>
<li><strong>Maintainable. </strong>
<ul>
<li>Test code is code also.  The same design principles we apply to source code should be applied to test code.  This is important because tests change over time to adjust for changing source code, so it is important that the tests be maintainable too.</li>
<li>Avoid repeating code.  You can use fixture setup and test setup methods to refactor otherwise repeating code.  You can also create helper classes to set up test data.</li>
</ul>
</li>
<li><strong>Readable. </strong>
<ul>
<li>This is really important.  I should be able to open any tests and understand them.  Otherwise, it is difficult to maintain the tests.</li>
<li>There are many ways to name the test methods.  I really like the suggestion I’d heard on a Podcast and explained here: <a href="http://osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html">http://osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html</a>.  It follows this pattern: &lt;Method_Being_Tested&gt;_&lt;Scenario&gt;_&lt;Expected Behavior&gt;.  It works pretty well for me; I encourage you to try it.</li>
</ul>
</li>
</ul>
<h2>A Unit Test Prototype</h2>
<p>I have been testing for many years, and I found a pattern repeated over and over.  I did not have a name for it, but once I started working with RhinoMocks (a mocking framework – I will introduce this in the 201 or 301 course), I learned a name that I thought described well what I’d seen in my tests and other people’s tests.</p>
<p>The pattern is named the Arrange-Act-Assert (AAA) pattern.</p>
<ul>
<li><strong>Arrange</strong>.  Populate any objects and/or create any necessary Mocks or Stubs required by your test.</li>
<li><strong>Act</strong>. Execute the code being tested.</li>
<li><strong>Assert</strong>.  Verify that expectations were met or report failure.</li>
</ul>
<p>Asserting is the critical step in any unit tests.  If you are not making an assertion, then you are not really unit testing.  How many assertions should there be you might ask?  Preferably one and only one.  On occasion I may have a couple of assertions is they are strongly related and it does not make sense to slit the test into two tests.  The problem with having too many assertions in a test is that when a test fails, it can be difficult to understand right away what the problem is (remember the single responsibility principle?).</p>
<h2>Writing Your First Unit Tests</h2>
<p>While I was teaching the class, I showed the students samples I’d put together in Visual Studio.  For the readers of this blog post, I encourage you to try the tutorials provided by the unit testing frameworks.  In particular, I find NUnit to be a good place to start because the tutorial is well written and easy to follow.  But that does not mean you can’t work through other tutorials.</p>
<p>Coming next, Unit Testing 201 and 301.</p>
<p>Until then, happy unit testing!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=62&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2011/03/22/unit-testing-101-fundamentals-of-unit-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
		<item>
		<title>Unit Testing &#8211; A Curriculum</title>
		<link>http://philippetruche.wordpress.com/2011/03/11/unit-testing-a-curriculum/</link>
		<comments>http://philippetruche.wordpress.com/2011/03/11/unit-testing-a-curriculum/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 20:36:00 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[course]]></category>
		<category><![CDATA[curriculum]]></category>
		<category><![CDATA[mocking framework]]></category>
		<category><![CDATA[test doubles]]></category>
		<category><![CDATA[test fakes]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">https://philippetruche.wordpress.com/2011/03/11/unit-testing-a-curriculum/</guid>
		<description><![CDATA[The subject of unit testing is one that comes over and over in my professional experience. I have been asked many times to teach developers how to unit test. It seems like the words “unit testing” somehow got some level of fame and everyone wants to claim that they are doing it. But to do [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=60&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The subject of unit testing is one that comes over and over in my professional experience. I have been asked many times to teach developers how to unit test. It seems like the words “unit testing” somehow got some level of fame and everyone wants to claim that they are doing it. But to do it well and to do it consistently seems elusive. Worse yet, there tends to be a dichotomy between development managers and the developers about what unit testing really is and why we unit test in the first place.</p>
<p>When asked to put a webinar together, I decided to break it down into 3 separate classes. My first one is called Unit Testing 101 and covers the fundamentals of unit testing. Though it focuses on concepts primarily, it also shows a basic unit test so as to get a flavor. I then created the second course: Unit Testing 201 – Intermediate Unit Testing. In this course, I look at techniques for handling dependencies and introduce basic concepts of test doubles and mocking frameworks. Finally, I reserved the most advanced techniques for Unit Testing 301 – Advanced Unit Testing: I cover topics on compiler techniques in Visual Studio to access members that aren’t public, how to address dependencies without necessarily resorting to using an IOC container, techniques for faking out the HttpContext, employing last-resort frameworks like Microsoft’s Moles to stub out System.DateTime for example, how to manipulate the configuration file, how to host WCF in process (I know, this is bordering on integration tests <a href="http://philippetruche.files.wordpress.com/2011/03/clip_image001.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="clip_image001" border="0" alt="clip_image001" src="http://philippetruche.files.wordpress.com/2011/03/clip_image001_thumb.png?w=23&#038;h=23" width="23" height="23" /></a>), and a basic overview of Microsoft Pex’s framework.</p>
<p>Yes, it sounds like there is a lot to know to write good unit tests. In fact, just like anything else – practice makes perfect.</p>
<p>In my next post, I will go through the contents of Unit Testing 101.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=60&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2011/03/11/unit-testing-a-curriculum/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>

		<media:content url="http://philippetruche.files.wordpress.com/2011/03/clip_image001_thumb.png" medium="image">
			<media:title type="html">clip_image001</media:title>
		</media:content>
	</item>
		<item>
		<title>How to sort projects alphabetically in Visual Studio</title>
		<link>http://philippetruche.wordpress.com/2010/06/29/how-to-sort-projects-alphabetically-in-visual-studio/</link>
		<comments>http://philippetruche.wordpress.com/2010/06/29/how-to-sort-projects-alphabetically-in-visual-studio/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 18:45:43 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://philippetruche.wordpress.com/2010/06/29/how-to-sort-projects-alphabetically-in-visual-studio/</guid>
		<description><![CDATA[This is really handy, especially when there are many projects in Visual Studio.&#160; From http://blog.catenalogic.com/post/2009/01/09/Sort-Visual-Studio-2008-Projects-alphabetically-inside-Solution-Folders.aspx, here is how you do it: Right-click on a project and select rename (or simple select a project, wait 1 second, and click it again or press F2). Don’t change the name, simply select another project with your mouse. This [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=57&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is really handy, especially when there are many projects in Visual Studio.&#160; From <a href="http://blog.catenalogic.com/post/2009/01/09/Sort-Visual-Studio-2008-Projects-alphabetically-inside-Solution-Folders.aspx">http://blog.catenalogic.com/post/2009/01/09/Sort-Visual-Studio-2008-Projects-alphabetically-inside-Solution-Folders.aspx</a>, here is how you do it:</p>
<ol>
<li>Right-click on a project and select rename (or simple select a project, wait 1 second, and click it again or press F2).</li>
<li>Don’t change the name, simply select another project with your mouse.</li>
</ol>
<p>This will cause Visual Studio to resort the projects.</p>
<p>I also highly recommend the <a href="http://code.msdn.microsoft.com/PowerCommands">PowerCommands for Visual Studio 2008</a> because it allows you to collapse all the projects in a solution with a single click.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=57&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2010/06/29/how-to-sort-projects-alphabetically-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
		<item>
		<title>How to get FxCop to take into account SuppressMessage attributes in your code</title>
		<link>http://philippetruche.wordpress.com/2010/06/15/how-to-get-fxcop-to-take-into-account-suppressmessage-attributes-in-your-code/</link>
		<comments>http://philippetruche.wordpress.com/2010/06/15/how-to-get-fxcop-to-take-into-account-suppressmessage-attributes-in-your-code/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 14:07:52 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://philippetruche.wordpress.com/2010/06/15/how-to-get-fxcop-to-take-into-account-suppressmessage-attributes-in-your-code/</guid>
		<description><![CDATA[Every so often, I forget that non-team editions of Visual Studio do not define the CODE_ANALYSIS constant by default.&#160; If you are wondering why FxCop seems to be ignoring your SuppressMessage attributes in your source code, this is probably the reason why.&#160; See FAQ: Why does FxCop ignore my in-code (SuppressMessageAttribute) suppressions? [David Kean] for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=55&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Every so often, I forget that non-team editions of Visual Studio do not define the CODE_ANALYSIS constant by default.&#160; If you are wondering why FxCop seems to be ignoring your SuppressMessage attributes in your source code, this is probably the reason why.&#160; See <a href="http://blogs.msdn.com/b/codeanalysis/archive/2006/03/23/faq-why-does-fxcop-ignore-my-in-code-suppressmessageattribute-suppressions-david-kean.aspx">FAQ: Why does FxCop ignore my in-code (SuppressMessageAttribute) suppressions? [David Kean]</a> for more information on this topic.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=55&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2010/06/15/how-to-get-fxcop-to-take-into-account-suppressmessage-attributes-in-your-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
		<item>
		<title>How to find which assembly is referencing a specific assembly</title>
		<link>http://philippetruche.wordpress.com/2010/02/16/how-to-find-which-assembly-is-referencing-a-specific-assembly/</link>
		<comments>http://philippetruche.wordpress.com/2010/02/16/how-to-find-which-assembly-is-referencing-a-specific-assembly/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 15:17:45 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://philippetruche.wordpress.com/?p=53</guid>
		<description><![CDATA[If you have ever worked with an application that has a large number of assemblies, it can be daunting at times to manage the entire set.&#160; In particular, you will find that developers may reference external assemblies that perhaps they should not be referencing.&#160; For instance, would you want to deploy an ASP.NET application where [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=53&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you have ever worked with an application that has a large number of assemblies, it can be daunting at times to manage the entire set.&#160; In particular, you will find that developers may reference external assemblies that perhaps they should not be referencing.&#160; For instance, would you want to deploy an ASP.NET application where developers reference and use types in System.Windows.Forms?</p>
<p>Here is how you can find those pesky references in your build output directory.&#160; From a command line in the path of your build’s binaries, type in the following command:</p>
<p>(FOR %i IN (*.dll) DO ILDASM /TEXT /PUBONLY /ITEM=Assembly %i | FINDSTR /L System.Windows.Forms) &gt; Output.txt</p>
<p>Then, open the Output.txt and search “.assembly extern System.Windows.Forms.” This will show you which assemblies are referencing System.Windows.Forms, if any.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=53&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2010/02/16/how-to-find-which-assembly-is-referencing-a-specific-assembly/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
		<item>
		<title>Day 3 &#8211; What&#8217;s New in WCF 4</title>
		<link>http://philippetruche.wordpress.com/2009/11/19/day-3-whats-new-in-wcf-4/</link>
		<comments>http://philippetruche.wordpress.com/2009/11/19/day-3-whats-new-in-wcf-4/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 19:02:47 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://philippetruche.wordpress.com/2009/11/19/day-3-whats-new-in-wcf-4/</guid>
		<description><![CDATA[Configuration is improved and is now similar to ASP.NET.&#160; Convention over configuration allows default endpoint configurations to be created by the framework.&#160; Those default endpoints will be very helpful for simple scenarios where you want to get going quickly without the overhead of the configuration. Empty binding names are defaults at the top of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=52&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Configuration is improved and is now similar to ASP.NET.&#160; </h2>
<ul>
<li>Convention over configuration allows default endpoint configurations to be created by the framework.&#160; Those default endpoints will be very helpful for simple scenarios where you want to get going quickly without the overhead of the configuration.</li>
<li>Empty binding names are defaults at the top of the config hierarchy.&#160; Nice!</li>
<li>Behaviors now follow config inheritance rules, just like ASP.NET configuration.</li>
<li>Config-based activation.&#160; SVC files are no longer required and can be replaced by config entries.&#160; This is really cool if you have a lot of SVC files to manage.&#160; As a result, you can replace 20 SVC files for example with a single config file.</li>
</ul>
<h2>Monitoring WCF Apps.</h2>
<ul>
<li>AppFabric is integral to monitoring.&#160; Search for Windows AppFabric to get an overview of this new product from Microsoft.&#160; A dashboard is integrated into the IIS 7 console.&#160; This is really nice and makes it easier to visualize than monitoring WCF performance counters in perfmon.&#160; This does not replace specialty tools like Avicode Intercept Studio or BMC AppSight, but is better than nothing.</li>
</ul>
<h2>Message Pump as a Service.</h2>
<ul>
<li>RoutingService is a new feature.&#160; You host it like any other service.&#160; It supports RequestReply, sessionful RequestReply, One Way, sessionful , and sessionful Duplex.&#160; You build a message filter table that get evaluated at runtime.&#160; The RoutingService then performs the actions as specified by matching filters.</li>
<li>The filter table can be replaced at runtime to respond to network changes for example.</li>
<li>Using a Routing Service enables scenarios like:</li>
<ul>
<li>Protocol bridging. Examples: net.tcp to basic http; soap 1.1. to soap 1.2.</li>
<li>Security bridging.</li>
<li>Alternate endpoints.&#160; You can use this for failover routing.&#160;&#160; <font color="#0000ff"><strong>This one got applauses.&#160; Very cool!</strong></font></li>
</ul>
</ul>
<h2>Discovery</h2>
<ul>
<li>Ad-hoc discovery.&#160; Clients can multicast probe messages to discover services on the network.&#160; Probe match messages are sent to the client in multicast.&#160; The scale is limited by the transport being used.</li>
<li>Managed discovery.&#160; A discovery proxy receives unicast hello messages from clients.&#160; Probe multicast messages are intercepted by the discovery proxy.&#160; Disco proxy sends unicast messages to the clients that send out probes, at which points those clients now switch to unicast messages to the proxy.&#160; </li>
<li>New classes to look for.&#160; ContractDescription, DynamicEndpoint, ServiceDiscoveryBehavior, AnnouncementService, UdpAnnouncementEndpoint, FindCriteria, and EndpointDiscoveryMetadata.</li>
<li>Demo.&#160; Client was able to respond to a service being taken down and re-discover where else it could go and start using a backup service that was brought online before taking down the primary service.&#160; This was really cool!</li>
</ul>
<p>It seems to me that managed discovery is the better model for enterprise discovery of services.&#160; I can see applicability of discovery in the projects I am currently working on and simply the hub-and-spoke model we are currently using.</p>
<p>It is interesting to me that this functionality is similar to what BizTalk can perform with some ESB toolkit.&#160;&#160; I can’t wait to see what models are going to emerge and what role BizTalk will play in a WCF 4 environment.</p>
<p><strong><font color="#0000a0">The demos on this got many applauses from the audience.&#160; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </font></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=52&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2009/11/19/day-3-whats-new-in-wcf-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
		<item>
		<title>Day 2 at the PDC &#8211; Impressions from the keynote</title>
		<link>http://philippetruche.wordpress.com/2009/11/18/day-2-at-the-pdc-impressions-from-the-keynote/</link>
		<comments>http://philippetruche.wordpress.com/2009/11/18/day-2-at-the-pdc-impressions-from-the-keynote/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 20:07:59 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://philippetruche.wordpress.com/2009/11/18/day-2-at-the-pdc-impressions-from-the-keynote/</guid>
		<description><![CDATA[Well, Microsoft never disappoints on the second day of the keynote.&#160; I was wondering why breakfasts had been suppressed and the traditional Universal Studios party taken away.&#160; This morning’s keynote gave the answer.&#160; All PDC attendees are receiving a brand new laptop, custom configured for developers.&#160; NICE!!!! Now on to my favorite talk.&#160; Scott Guthrie [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=51&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well, Microsoft never disappoints on the second day of the keynote.&#160; I was wondering why breakfasts had been suppressed and the traditional Universal Studios party taken away.&#160; This morning’s keynote gave the answer.&#160; All PDC attendees are receiving a brand new laptop, custom configured for developers.&#160; NICE!!!!</p>
<p>Now on to my favorite talk.&#160; Scott Guthrie spoke and showed Silverlight 4.&#160; I no longer have an excuse to delay getting up to speed on Silverlight.&#160; As far as business applications are concerned, there is a concerted effort to address typical concerns of business applications in Silverlight 4.&#160; It is now available as a beta, and was announced as planned on being released first half of 2010.&#160; Silverlight 4, here I come!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=51&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2009/11/18/day-2-at-the-pdc-impressions-from-the-keynote/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
		<item>
		<title>PDC08 &#8211; Day 1 Recap</title>
		<link>http://philippetruche.wordpress.com/2008/10/28/pdc08-day-1-recap/</link>
		<comments>http://philippetruche.wordpress.com/2008/10/28/pdc08-day-1-recap/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 20:37:02 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://philippetruche.wordpress.com/?p=43</guid>
		<description><![CDATA[Quite a few sessions were offered throughout the day.  I picked a few based on my interests, and wanted to share my take on some of my favorite sessions today (Monday 27 October 2008). Scott Henselman&#8217;s session (TL49 Microsoft .NET Framework: Overview and Applications for Babies).   This session was based on a set of demos [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=43&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:11pt;font-family:Calibri;"><span style="font-size:11pt;font-family:Calibri;">Quite a few sessions were offered throughout the day.  I picked a few based on my interests, and wanted to share my take on some of my favorite sessions today (Monday 27 October 2008).</span></span></p>
<ul>
<li>
<div style="margin-top:0;margin-bottom:0;vertical-align:middle;"><span style="font-size:11pt;font-family:Calibri;">Scott Henselman&#8217;s session (TL49 Microsoft .NET Framework: Overview and Applications for Babies).   This session was based on a set of demos centered around the BabySmash application; it ties into the current food court offerings of the .NET framework, and also included some elements of upcoming .NET 4.0 features.<span>  </span>OK - so what was so likeable about Scott&#8217;s delivery?<span>  </span>Well, he is used to speaking to audiences; after all, he hosts the Henselminutes podcast.<span>  </span>The other thing I really liked: he comes from the point of view that he is a develop who knows C#, but he is not an expert on Silverlight 2, the MS surface, or WPF for that matter.<span>  </span>And it is with this premise that he makes a convincing point that these technologies are not that hard to pick up.<span>  </span>Granted, he had some &#8220;insider&#8221; help.  Still, I could not help but think that he was rather convincing and effectively acting as an evangelist.<span>  </span>Great demos tying in a number of technologies, from WPF to Silverlight, and yes, even the Surface with its touch capabilities.  Thanks a bunch, Scott.</span></div>
</li>
<li><span style="font-size:11pt;font-family:Calibri;">Phil Haack on the ASP.NET MVC framework, with a segment on StackOverflow.com by Jeff Atwood (PC21 ASP.NET MVC: A New Framework for Building Web Applications).<span>  </span>This was a real good session too.<span>  </span>I have to admit I had not gotten a chance to look into ASP.NET MVC much, and this session filled my knowledge gap in no time.<span>  </span>I came to appreciate the ASP.NET MVC framework as another food vendor in the cafeteria; yes, it does not intend to replace the web form model, it only intends on providing an alternative model.<span>  </span>Effectively, this is an additional tool in the toolbox.<span>  </span>Use the Phillips head when you need a Phillips head.</span>
<ul>
<li><span style="font-size:11pt;font-family:Calibri;"><span>Here is what I liked </span>about it:</span>
<ul>
<li><span style="font-size:11pt;font-family:Calibri;">The developer has to know how HTTP works.<span>  </span>Not a bad thing in my book.<span>  </span>I have seen too many developers make mistakes in web forms because of their lack of understanding of HTTP.</span></li>
<li><span style="font-size:11pt;font-family:Calibri;">It is naturally &#8220;search engine optimized&#8221; because of its alignment on REST principles.</span></li>
<li><span style="font-size:11pt;font-family:Calibri;">Developers have to embrace HTML and in fact have complete control over the HTML being emitted.<span>  </span>I think Phil Haack&#8217;s analogy about transmissions is not bad at all.<span>  </span>Think of web forms as an automatic transmission, and think of ASP.NET MVC as a manual transmission.<span>  </span>Not a bad analogy indeed.</span></li>
</ul>
</li>
<li><span style="font-size:11pt;font-family:Calibri;">Here is where I think it falls short today:</span></li>
<li><span style="font-size:11pt;font-family:Calibri;">Lack of support for bi-directional data binding.<span>  </span>In my experience, developers spend too much time pushing data into the UI and coding the events for the changes made to the data by the user.<span>  Better bi-directional data binding is needed.  So it&#8217;s not there in ASP.NET MVC, but it is there in ASP.NET 2.0 and is also there in Spring.net.  </span>As far as I understood during the session, however, bi-directional data binding is planned in future versions of the ASP.NET MVC framework.</span></li>
</ul>
</li>
</ul>
<p><span style="font-size:11pt;font-family:Calibri;">Well, that&#8217;s it for day 1.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=43&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2008/10/28/pdc08-day-1-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
		<item>
		<title>PDC 08 Keynote &#8211; A Lukewarm Mood</title>
		<link>http://philippetruche.wordpress.com/2008/10/27/pdc-08-keynote-a-lukewarm-mood/</link>
		<comments>http://philippetruche.wordpress.com/2008/10/27/pdc-08-keynote-a-lukewarm-mood/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 18:30:04 +0000</pubDate>
		<dc:creator>Philippe Truche</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cloud computing]]></category>
		<category><![CDATA[Keynote]]></category>
		<category><![CDATA[Microsoft Professional Developers Conference]]></category>
		<category><![CDATA[PDC 2008]]></category>
		<category><![CDATA[PDC08]]></category>
		<category><![CDATA[Sofware + Services]]></category>

		<guid isPermaLink="false">http://philippetruche.wordpress.com/?p=40</guid>
		<description><![CDATA[Well, Here I am at my third PDC (I attended PDC03 and PDC05), and I have to say that the mood at the keynote was the most lukewarm I have seen in the last 3 PDCs.  Perhaps it had to do with the topic: cloud computing.  Not that developers don&#8217;t care about it, but I think [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=40&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well,</p>
<p>Here I am at my third PDC (I attended PDC03 and PDC05), and I have to say that the mood at the keynote was the most lukewarm I have seen in the last 3 PDCs.  Perhaps it had to do with the topic: cloud computing.  Not that developers don&#8217;t care about it, but I think it tends not to be foremost in developers&#8217; minds.  Now I think of the operations people I work with, and I think they would be impressed in the advances that are being made in manageability within the Microsoft platform.</p>
<p>It&#8217;s eratly in this PDC, but my take on this so far is that we are in a transition PDC.  Developers are still absorbing or getting educated on a large number of technologies like ASP.NET MVC, LINQ, Silverlight 2.0, etc&#8230; This PDC might jsut be incremental, showing a glimpse of the direction in which Microsoft is heading, with opportunities for feedback from the developer community.</p>
<p>The rest of this week will tell.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/philippetruche.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/philippetruche.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/philippetruche.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/philippetruche.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/philippetruche.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/philippetruche.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/philippetruche.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/philippetruche.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/philippetruche.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/philippetruche.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/philippetruche.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/philippetruche.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/philippetruche.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/philippetruche.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=philippetruche.wordpress.com&amp;blog=787098&amp;post=40&amp;subd=philippetruche&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://philippetruche.wordpress.com/2008/10/27/pdc-08-keynote-a-lukewarm-mood/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686900703f23d0634be2db0faa424253?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">philippetruche</media:title>
		</media:content>
	</item>
	</channel>
</rss>
