<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Joe Feser</title>
    <description>My experiences with Linq, .NET and Testing</description>
    <link>http://joefeser.com/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.Net Syndication Generator 1.0.0.0 (http://dotnetblogengine.net/)</generator>
    <language>en-US</language>
    <blogChannel:blogRoll>http://joefeser.com/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>Joe Feser</dc:creator>
    <dc:title>Joe Feser</dc:title>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/JoeFeser" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <title>TechEd 2008 in Orlando</title>
      <description>&lt;p&gt;
It has been a long time since I have made a blog entry. We just closed on our home last week in Greenville SC. I can&amp;#39;t tell you how happy I am to not have any more 600 mile trips to Cleveland on the weekend. :) I will have more time to blog about Linq and C# by mid June.&lt;br /&gt;
&lt;br /&gt;
I will be working at the NCover booth at TechEd this week.&amp;nbsp;Stop by&amp;nbsp;and say hi.&lt;br /&gt;
&lt;br /&gt;
The booth number is 1327.
&lt;/p&gt;
</description>
      <link>http://feedproxy.google.com/~r/JoeFeser/~3/jediyI2-7HU/post.aspx</link>
      <author>joe.feser</author>
      <comments>http://joefeser.com/post/TechEd-2008-in-Orlando.aspx#comment</comments>
      <guid isPermaLink="false">http://joefeser.com/post.aspx?id=4c279c5e-ba9c-4005-a092-f76ab3a43a7c</guid>
      <pubDate>Mon, 02 Jun 2008 11:00:00 -0500</pubDate>
      <category>NCover</category>
      <category>Stuff</category>
      <dc:publisher>joe.feser</dc:publisher>
      <pingback:server>http://joefeser.com/pingback.axd</pingback:server>
      <pingback:target>http://joefeser.com/post.aspx?id=4c279c5e-ba9c-4005-a092-f76ab3a43a7c</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://joefeser.com/trackback.axd?id=4c279c5e-ba9c-4005-a092-f76ab3a43a7c</trackback:ping>
      <wfw:comment>http://joefeser.com/post/TechEd-2008-in-Orlando.aspx#comment</wfw:comment>
      <wfw:commentRss>http://joefeser.com/syndication.axd?post=4c279c5e-ba9c-4005-a092-f76ab3a43a7c</wfw:commentRss>
    <feedburner:origLink>http://joefeser.com/post.aspx?id=4c279c5e-ba9c-4005-a092-f76ab3a43a7c</feedburner:origLink></item>
    <item>
      <title>Linq To NCover Part 2</title>
      <description>&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;I can&amp;rsquo;t begin to explain how excited I get when working with Linq. Until now, there were times that you needed to write a large amount of code to do the same basic operations like determining a child object had certain properties set, or determine the count of how many times a property is set to true. &lt;/font&gt;
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;You would have to declare a bunch of variables like &amp;ldquo;&lt;/font&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;bool&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; found&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span&gt;;&amp;rdquo;&lt;/span&gt; and then you would perform a &lt;/font&gt;&lt;/font&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;foreach&lt;/span&gt;&lt;font face="Calibri" size="3"&gt; loop on your objects, checking for certain conditions. Since you did the same thing over and over, you would go and find a code block that was close and modify it to fit your needs. Now there is a much more precise, easy to read syntax to perform the basic crud tasks, and they call it Linq.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;With the power of Linq, you no longer have to write long winded code to walk all the items in a collection only to realize two or three of the twenty items are valid. You can now filter or select the objects that you would like to work with, with straight forward query syntax.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;a href="http://www.ncover.com" target="_blank" title="NCover"&gt;&lt;font face="Calibri" size="3" color="#800080"&gt;NCover&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; stores the coverage file in an xml document. In that document is all the information needed to determine what classes are in a namespace, what methods are contained in a class and so forth. You can think of these as relationships or &amp;ldquo;joins&amp;rdquo;. Once this information is loaded into memory, you could perform a &lt;/font&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;foreach&lt;/span&gt;&lt;font face="Calibri" size="3"&gt; loop against every single class in every single namespace until you found a match or you could query the data for exactly what you are looking for.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;A typical query against an NCover coverage file could look like this:&lt;/font&gt; &lt;br /&gt;
&lt;span style="font-size: 10pt; color: #2b91af; font-family: 'Courier New'"&gt;&lt;font face="Verdana" size="3" color="#000000"&gt;&lt;br /&gt;
&lt;/font&gt;CodeCoverage&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; c = &lt;span style="color: #2b91af"&gt;CodeCoverage&lt;/span&gt;.Load(file);&lt;font color="#0000ff"&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&lt;br /&gt;
var&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; retVal =&lt;span style="color: blue"&gt;from&lt;/span&gt; mod &lt;span style="color: blue"&gt;in&lt;/span&gt; c.Modules&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; cls &lt;span style="color: blue"&gt;in&lt;/span&gt; mod.Classes&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/span&gt; method &lt;span style="color: blue"&gt;in&lt;/span&gt; cls.Methods&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span style="color: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&lt;/span&gt; method.Name == &lt;span style="color: #a31515"&gt;&amp;quot;.ctor&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&lt;/span&gt; method;&lt;br /&gt;
&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;&lt;br /&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;In the above example each collection is aliased with a name, which can be used in the &lt;/font&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;where&lt;/span&gt;&lt;font face="Calibri" size="3"&gt; clause with full Intellisense. You could easily add an additional &lt;/font&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;where&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; &lt;/span&gt;&lt;font face="Calibri" size="3"&gt;statements to only find .ctors (constructors) in a class that start with &amp;ldquo;GCheckout&amp;rdquo;. This syntax would look like this:&lt;br /&gt;
&lt;/font&gt;&lt;span style="font-size: 10pt; color: #2b91af; font-family: 'Courier New'"&gt;&lt;br /&gt;
CodeCoverage&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; c = &lt;span style="color: #2b91af"&gt;CodeCoverage&lt;/span&gt;.Load(file);&lt;span style="color: blue"&gt; &lt;br /&gt;
&lt;br /&gt;
var&lt;/span&gt; retVal =&lt;span style="color: blue"&gt;from&lt;/span&gt; mod &lt;span style="color: blue"&gt;in&lt;/span&gt; c.Modules&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; cls &lt;span style="color: blue"&gt;in&lt;/span&gt; mod.Classes&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;from&lt;/span&gt; method &lt;span style="color: blue"&gt;in&lt;/span&gt; cls.Methods&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; color: green; font-family: 'Courier New'"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//only list classes in the GCheckout Namespace&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;where&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; cls.NameSpace == &lt;span style="color: #a31515"&gt;&amp;quot;GCheckout&amp;quot;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span style="color: blue"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;where&lt;/span&gt; cls.Name.StartsWith(&lt;span style="color: #a31515"&gt;&amp;quot;Request&amp;quot;&lt;/span&gt;)&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;where&lt;/span&gt; method.Name == &lt;span style="color: #a31515"&gt;&amp;quot;.ctor&amp;quot;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span style="color: blue"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;select&lt;/span&gt; method;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;You may notice that there are multiple instances where clauses in the Linq query. You could have just as easily replaced the second &lt;/font&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;where&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; &lt;/span&gt;&lt;font face="Calibri" size="3"&gt;keyword with &amp;amp;&amp;amp; (in c#). I personally feel it is easier to read the intention of the statement by spelling out where on every &amp;ldquo;filter&amp;rdquo;.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;My thought was the majority of people were going to want to perform queries against the classes and methods. I rolled up all the classes and methods on the &lt;/font&gt;&lt;span style="font-size: 10pt; color: #2b91af; font-family: 'Courier New'"&gt;CodeCoverage&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; &lt;/span&gt;&lt;font face="Calibri" size="3"&gt;class in order to remove the need to reference the relationships between the modules and the classes and the methods.&lt;/font&gt; 
&lt;/p&gt;
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;br /&gt;
&lt;span style="font-size: 10pt; color: #2b91af; font-family: 'Courier New'"&gt;CodeCoverage&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; c = &lt;span style="color: #2b91af"&gt;CodeCoverage&lt;/span&gt;.Load(file);&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;var&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; retVal =&lt;span style="color: blue"&gt;from&lt;/span&gt; method &lt;span style="color: blue"&gt;in&lt;/span&gt; c.Methods&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;from&lt;/span&gt; param &lt;span style="color: blue"&gt;in&lt;/span&gt; method.Parameters&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;where&lt;/span&gt; param.FullType == &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: blue"&gt;decimal&lt;/span&gt;).ToString()&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;orderby&lt;/span&gt; method.Name&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;select&lt;/span&gt; method;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;Download the sample code and tell me what you think.&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a rel="enclosure" href="http://joefeser.com/file.axd?file=LinqToNCover.zip"&gt;LinqToNCover.zip (94.82 kb)&lt;/a&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;The next article will talk about how a Linq query was used to calculate the return value of a property.&lt;br /&gt;
&lt;br /&gt;
&lt;/font&gt;
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blog.joefeser.com/post/Linq-To-NCover-Part-2.aspx&amp;amp;title=Linq%20To%20NCover%20Part%202" target="_blank"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blog.joefeser.com/post/Linq-To-NCover-Part-2.aspx" border="0" alt="kick it on DotNetKicks.com" width="82" height="18" /&gt; &lt;/a&gt;&lt;/font&gt;
&lt;/p&gt;
</description>
      <link>http://feedproxy.google.com/~r/JoeFeser/~3/OD3_jSSQ1XU/post.aspx</link>
      <author>joe.feser</author>
      <comments>http://joefeser.com/post/Linq-To-NCover-Part-2.aspx#comment</comments>
      <guid isPermaLink="false">http://joefeser.com/post.aspx?id=10417242-905c-4993-89e0-7ce2141c8355</guid>
      <pubDate>Wed, 27 Feb 2008 06:51:00 -0500</pubDate>
      <category>.NET</category>
      <category>Linq</category>
      <category>NCover</category>
      <dc:publisher>joe.feser</dc:publisher>
      <pingback:server>http://joefeser.com/pingback.axd</pingback:server>
      <pingback:target>http://joefeser.com/post.aspx?id=10417242-905c-4993-89e0-7ce2141c8355</pingback:target>
      <slash:comments>7</slash:comments>
      <trackback:ping>http://joefeser.com/trackback.axd?id=10417242-905c-4993-89e0-7ce2141c8355</trackback:ping>
      <wfw:comment>http://joefeser.com/post/Linq-To-NCover-Part-2.aspx#comment</wfw:comment>
      <wfw:commentRss>http://joefeser.com/syndication.axd?post=10417242-905c-4993-89e0-7ce2141c8355</wfw:commentRss>
    <feedburner:origLink>http://joefeser.com/post.aspx?id=10417242-905c-4993-89e0-7ce2141c8355</feedburner:origLink></item>
    <item>
      <title>Linq To NCover Part 1</title>
      <description>&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;Back in August of 2007, I was assigned an enhancement request for the .Net sample code to integrate with &lt;/font&gt;&lt;a href="http://code.google.com/p/google-checkout-dotnet-sample-code/" target="_blank"&gt;&lt;font face="Calibri" size="3"&gt;Google Checkout&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;. The enhancement stated that we only had 31% code coverage and we needed to improve our code coverage to 50%. The tool used to determine this code coverage was&amp;nbsp;&lt;a href="http://www.ncover.com" target="_blank" title="NCover"&gt;NCover&lt;/a&gt;&lt;/font&gt;&lt;font face="Calibri" size="3"&gt;. &lt;/font&gt;
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;I started playing around with it and was quickly able to realize what sections of the code had never been tested. We wanted to put more faith into our customers that our implementation was production quality so I spent the next week, after work, refining the unit tests until I obtained almost 70% code coverage.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;After using the tool for a few days I realized that there were a few patterns throughout my code: The first one was I was writing code for conditions that never had test cases; &lt;/font&gt;
&lt;/p&gt;
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;The other one was my overloaded constructors were rarely tested - Why would I test them, they should just work right? &lt;/font&gt;
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;Using the NCoverExplorer tool, I quickly began to notice that my branch coverage was on the weak side. I was able to visually see the exact reason why my code was not fully tested, my unit tests were only accounting for a few of the conditions that the code segment was meant to process.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;Once you run NCover against your code, a coverage file is generated containing a large amount of very useful information, including the assemblies, namespaces, class names, the methods of those classes and the sequence points (enterprise version only). All of this information is stored in an xml document that can be reloaded for additional analysis. &lt;/font&gt;
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;One day I was sitting around trying to think of a sample project to build using some of the really cool new C# 3.0 language features and I thought to myself, &amp;lsquo;why not create a way to query the NCover coverage file using Linq&amp;rsquo;. You have to admit, it would be really cool to be able to find all methods in your application that take in a decimal data type or find all the methods that take a parameter with the name of description.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;So I sat down one evening and looked at how I could make the information in the coverage file friendlier to search. I did not want to take the Linq to Xml approach at this time. &lt;span&gt;&amp;nbsp;&lt;/span&gt;I enhanced the output of xsd.exe to support generic lists instead of arrays. Then I visited the coverage data and link up all the parent child data to allow people to file all methods that are contained in a class called &amp;ldquo;foo&amp;rdquo; that take in a string as a type.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;Imagine being able to search all your code for all methods that are not constructors, and that have at least one parameter of type decimal. This is an example of how that statement would look using Linq To NCover:&lt;/font&gt; 
&lt;/p&gt;
&lt;span style="font-size: 10pt; color: #2b91af; font-family: 'Courier New'"&gt;&lt;font face="Calibri" size="3" color="#000000"&gt;&lt;br /&gt;
&lt;/font&gt;CodeCoverage&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; c = &lt;span style="color: #2b91af"&gt;CodeCoverage&lt;/span&gt;.Load(file);&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: blue"&gt;var&lt;/span&gt; retVal = &lt;span style="color: blue"&gt;from&lt;/span&gt; method &lt;span style="color: blue"&gt;in&lt;/span&gt; c.Methods&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;from&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; param &lt;span style="color: blue"&gt;in&lt;/span&gt; method.Parameters&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;where&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; method.Name != &lt;span style="color: #a31515"&gt;&amp;quot;.ctor&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: black"&gt;&amp;amp;&amp;amp; &lt;/span&gt;param.FullType == &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: blue"&gt;decimal&lt;/span&gt;).ToString()&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New'"&gt;orderby&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt; method.Name&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'"&gt;&lt;span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;select&lt;/span&gt; method;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;&lt;br /&gt;
Over the next few days, I will continue to expand this article to include releasing the source code.&lt;/font&gt; 
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;As a side note, NCover is such a great tool; I am moving to Greenville, SC next week to begin working for this amazing company. &lt;/font&gt;
&lt;/p&gt;
&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p style="margin: 0in 0in 0pt" class="MsoNormal"&gt;
&lt;font face="Calibri" size="3"&gt;More to come&lt;br /&gt;
&lt;br /&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blog.joefeser.com/post/LinqToNCover-Part-1.aspx&amp;amp;title=LinqToNCover%20Part%201" target="_blank"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blog.joefeser.com/post/LinqToNCover-Part-1.aspx" border="0" alt="kick it on DotNetKicks.com" width="82" height="18" /&gt; &lt;/a&gt;
</description>
      <link>http://feedproxy.google.com/~r/JoeFeser/~3/Qoqqmfsd08c/post.aspx</link>
      <author>joe.feser</author>
      <comments>http://joefeser.com/post/LinqToNCover-Part-1.aspx#comment</comments>
      <guid isPermaLink="false">http://joefeser.com/post.aspx?id=abc29f8a-12fd-404f-9fcb-db6ca41b1501</guid>
      <pubDate>Tue, 26 Feb 2008 21:30:00 -0500</pubDate>
      <category>.NET</category>
      <category>Google Checkout</category>
      <category>Linq</category>
      <category>NCover</category>
      <dc:publisher>joe.feser</dc:publisher>
      <pingback:server>http://joefeser.com/pingback.axd</pingback:server>
      <pingback:target>http://joefeser.com/post.aspx?id=abc29f8a-12fd-404f-9fcb-db6ca41b1501</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://joefeser.com/trackback.axd?id=abc29f8a-12fd-404f-9fcb-db6ca41b1501</trackback:ping>
      <wfw:comment>http://joefeser.com/post/LinqToNCover-Part-1.aspx#comment</wfw:comment>
      <wfw:commentRss>http://joefeser.com/syndication.axd?post=abc29f8a-12fd-404f-9fcb-db6ca41b1501</wfw:commentRss>
    <feedburner:origLink>http://joefeser.com/post.aspx?id=abc29f8a-12fd-404f-9fcb-db6ca41b1501</feedburner:origLink></item>
  </channel>
</rss>
