<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Dariusz quatscht : Testing</title><link>http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx</link><description>Tags: Testing</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>TechTalk Dezember 2009: Anwendungsentwicklung mit Visual Studio 2010</title><link>http://blogs.msdn.com/dparys/archive/2009/07/31/techtalk-dezember-2009-anwendungsentwicklung-mit-visual-studio-2010.aspx</link><pubDate>Fri, 31 Jul 2009 12:05:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9854259</guid><dc:creator>dparys</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9854259.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9854259</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9854259</wfw:comment><description>&lt;p&gt;Erst im Juni habe ich einen TechTalk hinter mir und schon steht mein nächster an. Dieses mal jedoch nicht über einen Monat gezogen sondern in einer Woche werden 5 Städte besucht und mein Kollege &lt;a href="http://blogs.msdn.com/cbinder"&gt;Christian Binder&lt;/a&gt; wird auch mit von der Partie sein.&lt;/p&gt;  &lt;p&gt;In Visual Studio 2010 kommen so viele neue Elemente dazu das wir einfach in &lt;a href="http://www.microsoft.com/germany/msdn/techtalk/aktuell/default.mspx"&gt;diesem TechTalk&lt;/a&gt; verschiedene Aspekte live im Coding demonstrieren wollen und auf hoffentlich viele Fragen eingehen dürfen. Ganz nach dem Motto: “Keine Slides! Nur Code!”&lt;/p&gt;  &lt;p&gt;Hier der Auszug von der MSDN TechTalk Anmeldeseite:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;Der letzte MSDN TechTalk in diesem Jahr nimmt Sie mit auf eine Reise zur nächsten Version von Visual Studio: Visual Studio 2010. Dabei werden Christian Binder und Dariusz Parys die interessantesten Aspekte der neuen Entwicklungsumgebung vorstellen: von Verbesserungen in den einzelnen Frameworks bis hin zu neuen Möglichkeiten in den Application Lifecycle Management Tools, die das Testen und die Entwicklung im Team einfacher machen, wird dieser TechTalk die verschiedenen Aspekte mit Hilfe von Live Codings demonstrieren. Das heißt ganz klar: Keine Slides! Nur Code!&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;h4&gt;Die Termine:&lt;/h4&gt; &lt;/blockquote&gt;  &lt;ul&gt;   &lt;ul&gt;     &lt;li&gt;&lt;a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032422667&amp;amp;Culture=de-DE"&gt;30.11. Karlsruhe&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032422668&amp;amp;Culture=de-DE"&gt;01.12. Köln&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032422669&amp;amp;Culture=de-DE"&gt;02.12. Hamburg&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032422671&amp;amp;Culture=de-DE"&gt;03.12. Berlin&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;&lt;a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032422672&amp;amp;Culture=de-DE"&gt;04.12. München&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;An manchen Terminen werden wir vermutlich deutlich überziehen, das dürfte Karlsruhe, Berlin und München sein. In Köln und Hamburg sind wir leider an die Öffnungszeiten des Microsoft Office gebunden.&lt;/p&gt;  &lt;p&gt;Ich freue mich schon auf viele Teilnehmer und Fragen, bis dann!&lt;/p&gt;  &lt;p&gt;Link: &lt;a href="http://www.microsoft.com/germany/msdn/techtalk/aktuell/default.mspx"&gt;Offizielle TechTalk Anmeldeseite&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9854259" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/Connected+Systems/default.aspx">Connected Systems</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2B002B002F00_CLI/default.aspx">C++/CLI</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WF/default.aspx">WF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/VSTS_2F00_TFS/default.aspx">VSTS/TFS</category><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Coding4Fun/default.aspx">Coding4Fun</category><category domain="http://blogs.msdn.com/dparys/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/dparys/archive/tags/MSDN/default.aspx">MSDN</category><category domain="http://blogs.msdn.com/dparys/archive/tags/VSTS/default.aspx">VSTS</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Events/default.aspx">Events</category><category domain="http://blogs.msdn.com/dparys/archive/tags/TechTalk/default.aspx">TechTalk</category><category domain="http://blogs.msdn.com/dparys/archive/tags/.NET+Framework/default.aspx">.NET Framework</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/PLINQ/default.aspx">PLINQ</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Tools/default.aspx">Tools</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Data+Access/default.aspx">Data Access</category><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Services/default.aspx">Services</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Dynamic+Languages/default.aspx">Dynamic Languages</category><category domain="http://blogs.msdn.com/dparys/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Community/default.aspx">Community</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Coding/default.aspx">Coding</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>Tech-Ed 2009 vom 09.11 – 13.11 in Berlin</title><link>http://blogs.msdn.com/dparys/archive/2009/06/22/tech-ed-2009-vom-09-11-13-11-in-berlin.aspx</link><pubDate>Mon, 22 Jun 2009 17:54:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9797738</guid><dc:creator>dparys</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9797738.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9797738</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9797738</wfw:comment><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/TechEd2009vom09.1113.11inBerlin_EDB7/banner-home1_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="banner-home1" border="0" alt="banner-home1" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/TechEd2009vom09.1113.11inBerlin_EDB7/banner-home1_thumb.jpg" width="729" height="221" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Nach langer Pause dürfen wir die Tech-Ed endlich wieder in Deutschland begrüßen. Dieses Mal ist Berlin Gastgeber. Es werden zahlreiche neue Technologien vorgestellt und nach Jahrelanger Trennung von IT-Pros und Developern wieder ein einwöchiger Event für beide veranstaltet. Themen werden unter anderem Windows 7, Windows Server 2008 R2, Windows Azure und Visual Studio 2010 sein.&lt;/p&gt;  &lt;p&gt;Frühbucherrabatte gibt es auf der entsprechenden Webseite&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.microsoft.com/europe/teched/" href="http://www.microsoft.com/europe/teched/"&gt;http://www.microsoft.com/europe/teched/&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9797738" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WF/default.aspx">WF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/VSTS_2F00_TFS/default.aspx">VSTS/TFS</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Dev+Tools/default.aspx">Dev Tools</category><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Conference/default.aspx">Conference</category><category domain="http://blogs.msdn.com/dparys/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Windows+Server/default.aspx">Windows Server</category><category domain="http://blogs.msdn.com/dparys/archive/tags/VSTS/default.aspx">VSTS</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Events/default.aspx">Events</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Windows+Live/default.aspx">Windows Live</category><category domain="http://blogs.msdn.com/dparys/archive/tags/.NET+Framework/default.aspx">.NET Framework</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/PLINQ/default.aspx">PLINQ</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Data+Access/default.aspx">Data Access</category><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Services/default.aspx">Services</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Virtualization/default.aspx">Virtualization</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Dynamic+Languages/default.aspx">Dynamic Languages</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://blogs.msdn.com/dparys/archive/tags/.NET+Services/default.aspx">.NET Services</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Azure+Services/default.aspx">Azure Services</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Live+Services/default.aspx">Live Services</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Community/default.aspx">Community</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>Projekt Blog Poll – Entity Framework Repository</title><link>http://blogs.msdn.com/dparys/archive/2009/05/25/projekt-blog-poll-entity-framework-repository.aspx</link><pubDate>Mon, 25 May 2009 11:08:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9640098</guid><dc:creator>dparys</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9640098.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9640098</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9640098</wfw:comment><description>&lt;p&gt;Im 4. Teil der Serie zum Projekt Blog Poll geht es nun in die erste Implementierung. Ein Repository soll erstellt werden. Die erste Technologie die ich benutze ist das Entity Framework. Und wie mit jeder neuen Technologie ist auch bei dieser die ein oder andere Fragestellung zu lösen.&lt;/p&gt; &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="320" height="240"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/vp09_04_23.xap" /&gt; &lt;param name="initParams" value="m=http://mschnlnine.vo.llnwd.net/d1/ch9/5/5/4/5/6/4/pbpteil4_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://mschnlnine.vo.llnwd.net/d1/ch9/5/5/4/5/6/4/pbpteil4_large_ch9.png, postid=465455" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9640098" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Coding4Fun/default.aspx">Coding4Fun</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Data+Access/default.aspx">Data Access</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Coding/default.aspx">Coding</category></item><item><title>Visual Studio 2010 – Historical Debugging</title><link>http://blogs.msdn.com/dparys/archive/2009/05/20/visual-studio-2010-historical-debugging.aspx</link><pubDate>Wed, 20 May 2009 17:13:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9632238</guid><dc:creator>dparys</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9632238.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9632238</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9632238</wfw:comment><description>&lt;p&gt;Ein weiteres cooles Feature ist die Möglichkeit sich nach dem Testen einer Anwendung in der IDE sich die Debugger Informationen nachträglich zeigen zu lassen. So kann man in aller Ruhe die Exceptions im Nachhinein analysieren und dazu sich die lokalen Zustände anzeigen lassen.&lt;/p&gt;  &lt;p&gt;Hier ein Beispiel der Debug History&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/VisualStudio2010HistoricalDebugging_E3FB/shot1_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot1" border="0" alt="shot1" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/VisualStudio2010HistoricalDebugging_E3FB/shot1_thumb.png" width="608" height="491" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Selektiert man eine Zeile im Fenster wird der entsprechende Source-Code Bereich angezeigt. Klickt man dann auf die “Related Views” erhält man die Zustände zum Zeitpunkt der Exception im Variablen Fenster angezeigt&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/VisualStudio2010HistoricalDebugging_E3FB/shot2_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot2" border="0" alt="shot2" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/VisualStudio2010HistoricalDebugging_E3FB/shot2_thumb.png" width="602" height="174" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In den Einstellungsoptionen kann man sich noch mehr Informationen sammeln lassen, was sich natürlich auf die Performance der Anwendung auswirkt. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/VisualStudio2010HistoricalDebugging_E3FB/shot4_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot4" border="0" alt="shot4" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/VisualStudio2010HistoricalDebugging_E3FB/shot4_thumb.png" width="582" height="347" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Zum Fehlersuchen auf jeden Fall ein hilfreiches Tool. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9632238" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>Improving Entity Framework Performance</title><link>http://blogs.msdn.com/dparys/archive/2009/04/06/improving-entity-framework-performance.aspx</link><pubDate>Mon, 06 Apr 2009 10:48:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9533322</guid><dc:creator>dparys</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9533322.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9533322</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9533322</wfw:comment><description>&lt;p&gt;I was really shocked when I saw this blog post: &lt;a href="http://toomanylayers.blogspot.com/2009/01/entity-framework-and-linq-to-sql.html"&gt;Entity Framework and LINQ to SQL Performance&lt;/a&gt;. I decided to download the performance test solution and try the tests myself. I did not changed any of the tests so far, I just added for my own interest NHibernate into the game as I think that it is the choice of Frameworks for Domain Driven Design.&lt;/p&gt;  &lt;p&gt;So, I was shocked again, as I saw my numbers in the chart:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/ImprovingEntityFrameworkPerformance_89CD/shot1_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot1" border="0" alt="shot1" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/ImprovingEntityFrameworkPerformance_89CD/shot1_thumb.png" width="540" height="313" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The elapsed time was 4 times higher than with plain SqlDataReader. But more worse was the fact the the elapsed processor time was nearly 8 times higher. NHibernate was really good in performance compared to Entity Framework, but LINQ to SQL was still better.&lt;/p&gt;  &lt;p&gt;What was wrong? I couldn’t imagine that we had such an issue in data access using the Entity Framework. I took a look at the code. All test runs are looping 10000 times over the access method to retrieve the customers data. In this loop, each time a connection will be created and closed. Linq to SQL and Linq to Entities are using compiled queries, so, this optimization was already done. I also added in my tests a pre-generated Entity Framework view (using edmgen.exe) to enhance startup performance. Still those poor results.&lt;/p&gt;  &lt;p&gt;Here is the original code from the tests:&lt;/p&gt;  &lt;div&gt;   &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; List&amp;lt;CustomerResults&amp;gt; GetCustomers()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (NorthwindEntities ne = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; NorthwindEntities())&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; GetCustomersQuery(ne).ToList();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Func&amp;lt;NorthwindEntities, IQueryable&amp;lt;CustomerResults&amp;gt;&amp;gt; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     GetCustomersQuery = CompiledQuery.Compile(&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         (NorthwindEntities ne) =&amp;gt; from c &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; ne.Customers&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;                                   select &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; CustomerResults&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;                                   {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;                                       CustomerID = c.CustomerID,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;                                       CompanyName = c.CompanyName,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;                                       ContactName = c.ContactName,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;                                       ContactTitle = c.ContactTitle,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;                                       City = c.City,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;                                       Country = c.Country&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;                                   });&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;My guess was that the instantiation of the connection string could be the problem. Why? Because several things happen here. First, the EntityConnection which is created when not specifying any argument in the constructor of the typed object context class NorthwindEntities, has to read from the config file. I/O cost. Second, it has to read the metadata information, which is stored by default in the assembly as resource. Second performance cost. Here is my optimization approach. One of the overload constructors is taking an EntityConnection object. Guess what, you probably just use this one connection object during the whole life time of your application, so why not create it once and give it into the constructor. This does not mean that I open the connection beforehand, no, I just create the type EntityConnection and retrieve the meta information in the first call. From that, I reuse this instance, so no need anymore to retrieve the metadata information again.&lt;/p&gt;

&lt;p&gt;Here is the optimization in my code base:&lt;/p&gt;

&lt;div&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; EntityConnection entityConnection;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; InitializeConnectionString()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     SqlConnectionStringBuilder sqlBuilder = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SqlConnectionStringBuilder();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     sqlBuilder.DataSource = &lt;span style="color: #006080"&gt;@&amp;quot;(local)\sqlexpress&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     sqlBuilder.InitialCatalog = &lt;span style="color: #006080"&gt;&amp;quot;NorthwindPerfTest&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     sqlBuilder.IntegratedSecurity = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     sqlBuilder.MultipleActiveResultSets = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;     EntityConnectionStringBuilder builder = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EntityConnectionStringBuilder();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     builder.Provider = &lt;span style="color: #006080"&gt;&amp;quot;System.Data.SqlClient&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;     builder.Metadata = &lt;span style="color: #006080"&gt;&amp;quot;res://*/Customers.csdl|&amp;quot;&lt;/span&gt; +&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;                        &lt;span style="color: #006080"&gt;&amp;quot;res://*/Customers.ssdl|&amp;quot;&lt;/span&gt; +&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;                        &lt;span style="color: #006080"&gt;&amp;quot;res://*/Customers.msl&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;     builder.ProviderConnectionString = sqlBuilder.ToString();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;     &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;     entityConnection = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EntityConnection(builder.ToString());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;I have a static variable entityConnection which holds the reference on the object. In the constructor I just pass this reference:&lt;/p&gt;

&lt;div&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; List&amp;lt;CustomerResults&amp;gt; GetCustomers()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (NorthwindEntities ne = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; NorthwindEntities(entityConnection))&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; GetCustomersQuery(ne).ToList();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Now I have difference numbers to show in my chart:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/ImprovingEntityFrameworkPerformance_89CD/shot2_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot2" border="0" alt="shot2" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/ImprovingEntityFrameworkPerformance_89CD/shot2_thumb.png" width="540" height="308" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;For this specific test scenario I cutted performance cost two times for the elapsed time and four times for the process elapsed time. Hope that helps.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9533322" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/English+Posts/default.aspx">English Posts</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Data+Access/default.aspx">Data Access</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Entity+Framework/default.aspx">Entity Framework</category></item><item><title>Behavior Driven Development, Contexts und Specifications</title><link>http://blogs.msdn.com/dparys/archive/2009/03/26/behavior-driven-development-contexts-und-specifications.aspx</link><pubDate>Thu, 26 Mar 2009 18:33:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9511107</guid><dc:creator>dparys</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9511107.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9511107</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9511107</wfw:comment><description>&lt;p&gt;Ich glaube es ist kein Geheimnis, das ich mich immer schwer getan habe Unit Tests konsequent anzuwenden. Die Vorteile wie von vielen Leuten angepriesen sind mir nicht wirklich als solche Erschienen. Mein Problem war immer das ich kein Gefühl dafür entwickelt habe was und vor allem, bis in welche Tiefe ich testen sollte. Ich habe mich dabei ertappt Unit Tests zu schreiben die mittlerweile komplexer waren als das eigentliche Projekt. Selbst das Lesen verschiedener Bücher wie z.B. &lt;a href="http://www.amazon.de/xUnit-Test-Patterns-Refactoring-Signature/dp/0131495054/ref=sr_1_1?ie=UTF8&amp;amp;s=books-intl-de&amp;amp;qid=1238079429&amp;amp;sr=8-1"&gt;xUnit Test Patterns: Refactoring Test Code&lt;/a&gt; hat mir nichts gebracht. &lt;em&gt;(Anmerkung: Das Buch kann ich absolut nicht empfehlen, nicht mal als Nachschlagewerk)&lt;/em&gt;. Kurz, ich hatte kein Gefühl dafür was ein guter Unit Test ist und was nicht. &lt;/p&gt;  &lt;p&gt;Insofern habe ich mir einfach mal Zeit genommen und einen Haufen anderen Test-Code angeschaut. Vielmehr durch Zufall bin ich von den Test-Code des Projektes &lt;a href="http://code.google.com/p/masstransit/"&gt;Mass Transit&lt;/a&gt; zu verschiedenen Blog Posts gestolpert und siehe da, es gab da etwas was mein Interesse geweckt hat. Behavior Driven Development, genauer gesagt wie dort mit Tests verfahren wird. &lt;/p&gt;  &lt;p&gt;Hier die Blog Posts die ich meine:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://codebetter.com/blogs/jean-paul_boodhoo/archive/2007/11/29/getting-started-with-bdd-style-context-specification-base-na.aspx"&gt;Getting started with BDD style Context/Specification base naming&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://elegantcode.com/2008/10/25/refining-contextspecification-bdd-using-rhino-mocks-35/"&gt;Refining Context / Specification BDD using Rhino Mocks 3.5&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Jan van Ryswyck’s Implementierung habe ich nun als Grundlage genommen um das ganze mal an einem kleinen Demo Projekt zu testen.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/BehaviorDrivenDevelopmentContextsundSpec_E8BD/shot1_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot1" border="0" alt="shot1" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/BehaviorDrivenDevelopmentContextsundSpec_E8BD/shot1_thumb.png" width="519" height="305" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Die Tests lassen sich nun folgendermaßen lesen:&lt;/p&gt;  &lt;p&gt;When_retrieving_customer_orders_from_repository_for_customer_ALFKI&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Then_should_have_at_least_one_order&lt;/li&gt;    &lt;li&gt;Then_should_be_able_to_get_a_list_of_all_products&lt;/li&gt;    &lt;li&gt;Then_should_be_able_to_add_a_new_order_with_positions_and_persist_it&lt;/li&gt;    &lt;li&gt;Then_should_be_able_to_update_an_existing_order&lt;/li&gt;    &lt;li&gt;Then_should_be_able_to_delete_the_first_order&lt;/li&gt;    &lt;li&gt;Then_should_be_able_to_update_company_name&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Um die Ansicht von Klasse (Context) und TestMethode hierarchisch zu bekommen, muss man in Visual Studio nach der Spalte Class Name gruppieren.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/BehaviorDrivenDevelopmentContextsundSpec_E8BD/shot2_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot2" border="0" alt="shot2" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/BehaviorDrivenDevelopmentContextsundSpec_E8BD/shot2_thumb.png" width="532" height="173" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Mittlerweile hat die Beta von Resharper 4.5 auch eine direkte Integration von MSTest.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/BehaviorDrivenDevelopmentContextsundSpec_E8BD/shot3_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot3" border="0" alt="shot3" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/BehaviorDrivenDevelopmentContextsundSpec_E8BD/shot3_thumb.png" width="240" height="137" /&gt;&lt;/a&gt; &lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/BehaviorDrivenDevelopmentContextsundSpec_E8BD/shot4_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot4" border="0" alt="shot4" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/BehaviorDrivenDevelopmentContextsundSpec_E8BD/shot4_thumb.png" width="492" height="316" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Das Schreiben der Tests in Bezug auf das Verhalten und dessen Kontext wird nun etwas sein was ich versuchen werde auf meinen zukünftigen Code anzuwenden. Mal schauen wie praktikabel das auf Dauer sein wird.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9511107" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category></item><item><title>Test Reviews by Roy Osherove</title><link>http://blogs.msdn.com/dparys/archive/2009/03/25/test-reviews-by-roy-osherove.aspx</link><pubDate>Wed, 25 Mar 2009 14:06:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9507164</guid><dc:creator>dparys</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9507164.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9507164</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9507164</wfw:comment><description>&lt;p&gt;&lt;a href="http://weblogs.asp.net/rosherove/default.aspx"&gt;Roy Osherove&lt;/a&gt; hat auf seinem Blog angefangen Projekte, genauer gesagt deren Unit Tests, zu analysieren und zu bewerten. Besonders ans Herz legen möchte ich einfach mal &lt;a href="http://weblogs.asp.net/rosherove/archive/2009/03/20/test-review-1-nerddinner.aspx"&gt;Test Review #1&lt;/a&gt;. Hier geht es um das ASP.NET MVC Beispiel NerdDinner. Es lohnt reinzuschauen.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9507164" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category></item><item><title>PEX – Automatisierter Testansatz</title><link>http://blogs.msdn.com/dparys/archive/2008/12/17/pex-automatisierter-testansatz.aspx</link><pubDate>Wed, 17 Dec 2008 12:52:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9230551</guid><dc:creator>dparys</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9230551.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9230551</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9230551</wfw:comment><description>&lt;p&gt;Ich selbst habe &lt;a href="http://research.microsoft.com/pex"&gt;PEX&lt;/a&gt; das erste Mal auf der PDC 2008 kennengelernt. PEX ist die Abkürzung für Programming EXplorations und ist ein Projekt von &lt;a href="http://research.microsoft.com"&gt;Microsoft Research&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Wo kann PEX helfen? Schreibt man Unit Tests so macht man dies in erster Linie um das Objektmodell zu formen, um gängige Abläufe abzubilden und um besondere Fehlererwartungen zu testen. Hat man sich eine Testsuite erstellt so kann man jegliche Änderungen am Code schnell überprüfen und durch Fehlerhafte Tests ist das Feedback eindeutig wo die Probleme aufgetaucht sind. &lt;/p&gt;  &lt;p&gt;Ob man nun allerdings den Code in seiner komplettheit testet sei mal dahingestellt. Mechanismen wie Code Coverage helfen einem dabei zu sehen wieviel Prozent der eigentlichen Code Basis getestet worden sind. Ein Wert von 80% ist eine gute Basis um den Code in die Versionsverwaltung einzuchecken. In der Regel ist es jedoch so, das die Unit Tests die man schreibt, oft nur die Ansätze wiederspiegeln, die man beim Design im Kopf hatte. Was noch fehlt ist das lästige suchen nach Fehlern wie Sie in der Regel durch ein “gutmütiges” Nutzen des Objektmodells nicht vorkommen. Die ideale Testabdeckung von Code ist 100%.&lt;/p&gt;  &lt;p&gt;Genau hier kann PEX helfen. PEX analysiert den Code und such dediziert nach verschiedenen Fehlerquellen für jeden Programmpfad. Dabei werden die Eingabeparameter für Methoden mit teilweise exotischen Werten ausgestattet um Fehler zu produzieren auf die man normalerweise nicht kommt.&lt;/p&gt;  &lt;p&gt;Wie funktioniert PEX?&lt;/p&gt;  &lt;p&gt;PEX ist ein Addon für Visual Studio 2010. Für Visual Studio 2008 gibt es auch eine Version, auf Basis einer akademischen Lizenz.&lt;/p&gt;  &lt;p&gt;Folgender Sourcecode als Basis:&lt;/p&gt;  &lt;div&gt;   &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; Validate( CardType cardType, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; creditCardNumber )&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Fast path some validation&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( creditCardNumber.Length &amp;gt; _maxLength )&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Credit card to validate&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;int&lt;/span&gt;[] number = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt;[ _maxLength ];&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; length = 0;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; ( &lt;span style="color: #0000ff"&gt;char&lt;/span&gt; c &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; creditCardNumber.ToCharArray() )&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;.IsDigit( c ) )&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;         {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;             number[ length++ ] = ( &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; ) c - &lt;span style="color: #006080"&gt;'0'&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Validate based on card type&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;switch&lt;/span&gt; ( cardType )&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; CardType.MasterCard:&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;             {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( length != 16 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  34:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( number[ 0 ] != 5 || number[ 1 ] == 0 || number[ 1 ] &amp;gt; 5 )&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  35:&lt;/span&gt;                      &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  36:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  37:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  38:&lt;/span&gt;             }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  39:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  40:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; CardType.BankCard:&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  41:&lt;/span&gt;             {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  42:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( length != 16 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  43:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  44:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( number[ 0 ] != 5 || number[ 1 ] != 6 || number[ 2 ] &amp;gt; 1 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  45:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  46:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  47:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  48:&lt;/span&gt;             }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  49:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  50:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; CardType.Visa:&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  51:&lt;/span&gt;             {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  52:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( length != 16 &amp;amp;&amp;amp; length != 13 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  53:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  54:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( number[ 0 ] != 4 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  55:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  56:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  57:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  58:&lt;/span&gt;             }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  59:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  60:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; CardType.AMEX:&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  61:&lt;/span&gt;             {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  62:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( length != 15 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  63:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  64:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( number[ 0 ] != 3 || number[ 1 ] != 4 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  65:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  66:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  67:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  68:&lt;/span&gt;             }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  69:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  70:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; CardType.Discover:&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  71:&lt;/span&gt;             {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  72:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( length != 16 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  73:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  74:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( number[ 0 ] != 6 || number[ 1 ] != 0 &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  75:&lt;/span&gt;                     || number[ 2 ] != 1 || number[ 3 ] != 1 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  76:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  77:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  78:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  79:&lt;/span&gt;             }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  80:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  81:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; CardType.DinersClub:&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  82:&lt;/span&gt;             {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  83:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (length != 14) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  84:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  85:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (number[0] != 3 || number[1] != 0 &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  86:&lt;/span&gt;                     &amp;amp;&amp;amp; number[1] != 6 &amp;amp;&amp;amp; number[1] != 8) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  87:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  88:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  89:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  90:&lt;/span&gt;             }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  91:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  92:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; CardType.JCB:&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  93:&lt;/span&gt;             {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  94:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( length != 16 &amp;amp;&amp;amp; length != 15 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  95:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  96:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( number[ 0 ] != 3 ) &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  97:&lt;/span&gt;                     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  98:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  99:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 100:&lt;/span&gt;             }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 101:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 102:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 103:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 104:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Use the Luhn algorithm to validate the integrity of the number itself&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 105:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 106:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; sum = 0;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 107:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 108:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; ( &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = length - 1; i &amp;gt;= 0; i-- )&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 109:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 110:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ( i % 2 == length % 2 )&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 111:&lt;/span&gt;         {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 112:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; n = number[ i ] * 2;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 113:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 114:&lt;/span&gt;             sum += ( n / 10 ) + ( n % 10 );&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 115:&lt;/span&gt;         }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 116:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 117:&lt;/span&gt;         {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 118:&lt;/span&gt;             sum += number[ i ];&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 119:&lt;/span&gt;         }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 120:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 121:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 122:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; ( sum % 10 ) == 0;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt; 123:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Und der CardType Enum&lt;/p&gt;

&lt;div&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;enum&lt;/span&gt; CardType&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     MasterCard = 1,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     BankCard = 2,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     Visa = 3,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     AMEX = 4,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     Discover = 5,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     DinersClub = 6,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     JCB = 7,&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Diese Routine möchte ich nun mit Unit Tests ausstatten. Ich habe welche in meinem Projekt und erreiche eine Abdeckung über Data-Driven Tests von ca. 67%, noch einige Prozentpunke entfernt von dem selbstgesetzten Ziel von 80%.&lt;/p&gt;

&lt;p&gt;Nun benutze ich PEX um den Code zu analysieren und mir eine Test-Suite zu erstellen und dabei auch noch Fehler zu finden die ich vielleicht übersehen habe und nicht Teil meiner bisherigen Test-Suite sind.&lt;/p&gt;

&lt;p&gt;Dazu rufe ich PEX über das Kontext-Menü im Source Editor auf:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot1_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot1" border="0" alt="shot1" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot1_thumb.png" width="515" height="335" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Danach startet PEX einen Prozess und instanziert die zu testenden Klassen und ruft systematisch in die einzelnen Methoden rein.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot2_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot2" border="0" alt="shot2" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot2_thumb.png" width="427" height="308" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Das Ergebnis sind 262 Aufrufe mit einem gefunden Fehler und 40 erstellten Unit Tests.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot3_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot3" border="0" alt="shot3" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot3_thumb.png" width="491" height="666" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot4_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot4" border="0" alt="shot4" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot4_thumb.png" width="482" height="163" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Und zur Komplettheit noch der generierte Unit Test der für diesen Fehlerfall erzeugt wurde.&lt;/p&gt;

&lt;div&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; [TestMethod]&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; [PexRaisedException(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(NullReferenceException))]&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; [PexGeneratedBy(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(LuhnValidatorTest))]&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Validate02()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     LuhnValidator luhnValidator;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; b;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     luhnValidator = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; LuhnValidator();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     b = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Validate(luhnValidator, CardType.BankCard, (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;)&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Des Weiteren gibt PEX einem die Möglichkeit , gleich eine Pre-Condition in den Code einzubauen die die Kreditkartennummer auf &lt;em&gt;null&lt;/em&gt; prüft und eine &lt;em&gt;ArgumentNullException&lt;/em&gt; wirft.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot5_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot5" border="0" alt="shot5" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot5_thumb.png" width="547" height="399" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Und mein Ziel 80% Code Coverage zu erreichen?&lt;/p&gt;

&lt;p&gt;Die Tests lassen sich abspeichern und entsprechend in die dafür vorgesehene BVT Suite (BVT = Build Verification Tests) integrieren.&lt;/p&gt;

&lt;p&gt;Und nach einem weiteren Testlauf im Test View von Visual Studio 2008 mit aktivierter Code Coverage erscheint nun folgendes Resultat für die Validate Methode:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot6_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="shot6" border="0" alt="shot6" src="http://blogs.msdn.com/blogfiles/dparys/WindowsLiveWriter/PEXAutomatisierterTestansatz_98B5/shot6_thumb.png" width="532" height="184" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Wow, 100%, mehr als ich wollte. Ein Tool das einen Blick Wert ist!&lt;/p&gt;

&lt;p&gt;Die Webseite von PEX und die entsprechenden Downloads findet man &lt;a href="http://research.microsoft.com/pex"&gt;hier&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9230551" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Was sind relevante Themen in der Softwareentwicklung für Sie?</title><link>http://blogs.msdn.com/dparys/archive/2008/12/03/was-sind-relevante-themen-in-der-softwareentwicklung-f-r-sie.aspx</link><pubDate>Wed, 03 Dec 2008 19:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9170644</guid><dc:creator>dparys</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/dparys/comments/9170644.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=9170644</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=9170644</wfw:comment><description>&lt;P&gt;Lange Zeit bevor ich bei Microsoft war, habe ich schon in diversen Firmen eigentlich immer aus eigenem Antrieb heraus recht schnell Technologie adaptiert und auch während laufender Projekte reingebracht. Den Mehraufwand hat man gerne selbst getragen (oder tragen lassen, Entschuldigung schon mal an dieser Stelle, Ihr wisst wer gemeint ist) um das Projekt / Produkt auf eine neue technische Ebene zu heben. Meist hat sich der Aufwand auch gelohnt.&lt;/P&gt;
&lt;P&gt;Seit ich bei Microsoft bin, liegt hier mein Fokus natürlich verstärkt auf die Microsoft Technologie. Ich möchte mal sagen das ich nicht diesen &lt;A href="http://ralfw.blogspot.com/2008/05/microsoftdmmerung.html" mce_href="http://ralfw.blogspot.com/2008/05/microsoftdmmerung.html"&gt;Bias&lt;/A&gt; habe über den Ralf Westphal geschrieben hat, aber mein "Abdriften" in andere Technologie Welten ist definitiv geringer geworden. &lt;/P&gt;
&lt;P&gt;Warum schreibe ich das eigentlich? Ganz einfach, nach dem Auswerten der Technical Summit Feedbacks ist mir aufgefallen das die Themen kaum Relevanz für die Teilnehmer hatten und ich nicht von mir ausgehen möchte was relevant ist. Was ich wirklich Cool finden würde, wären Kommentare was für &lt;STRONG&gt;&lt;EM&gt;Sie relevante Softwareentwicklungsthemen &lt;/EM&gt;&lt;/STRONG&gt;sind.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9170644" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/XPSP2/default.aspx">XPSP2</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Connected+Systems/default.aspx">Connected Systems</category><category domain="http://blogs.msdn.com/dparys/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/dparys/archive/tags/CodeClips/default.aspx">CodeClips</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Software+Factories/default.aspx">Software Factories</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/dparys/archive/tags/VPC/default.aspx">VPC</category><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2B002B002F00_CLI/default.aspx">C++/CLI</category><category domain="http://blogs.msdn.com/dparys/archive/tags/HPC/default.aspx">HPC</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WF/default.aspx">WF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/VSTS_2F00_TFS/default.aspx">VSTS/TFS</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Dev+Tools/default.aspx">Dev Tools</category><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/dparys/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Coding4Fun/default.aspx">Coding4Fun</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Dies+und+Das/default.aspx">Dies und Das</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Conference/default.aspx">Conference</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Web+2.0/default.aspx">Web 2.0</category><category domain="http://blogs.msdn.com/dparys/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Vista/default.aspx">Vista</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/dparys/archive/tags/MSDN/default.aspx">MSDN</category><category domain="http://blogs.msdn.com/dparys/archive/tags/MFC/default.aspx">MFC</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Windows+Server/default.aspx">Windows Server</category><category domain="http://blogs.msdn.com/dparys/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Open+XML/default.aspx">Open XML</category><category domain="http://blogs.msdn.com/dparys/archive/tags/VSTS/default.aspx">VSTS</category><category domain="http://blogs.msdn.com/dparys/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Events/default.aspx">Events</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WDF/default.aspx">WDF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/TechTalk/default.aspx">TechTalk</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Windows+Live/default.aspx">Windows Live</category><category domain="http://blogs.msdn.com/dparys/archive/tags/.NET+Framework/default.aspx">.NET Framework</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/PLINQ/default.aspx">PLINQ</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Tools/default.aspx">Tools</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Data+Access/default.aspx">Data Access</category><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Games/default.aspx">Games</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Services/default.aspx">Services</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Virtualization/default.aspx">Virtualization</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Dynamic+Languages/default.aspx">Dynamic Languages</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Windows/default.aspx">Windows</category><category domain="http://blogs.msdn.com/dparys/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Mein+Senf/default.aspx">Mein Senf</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Concurrency/default.aspx">Concurrency</category><category domain="http://blogs.msdn.com/dparys/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://blogs.msdn.com/dparys/archive/tags/PDC2008/default.aspx">PDC2008</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Windows+Azure/default.aspx">Windows Azure</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Model+Driven+Development/default.aspx">Model Driven Development</category><category domain="http://blogs.msdn.com/dparys/archive/tags/.NET+Services/default.aspx">.NET Services</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Azure+Services/default.aspx">Azure Services</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Live+Services/default.aspx">Live Services</category></item><item><title>Mock it up!</title><link>http://blogs.msdn.com/dparys/archive/2007/11/28/mock-it-up.aspx</link><pubDate>Wed, 28 Nov 2007 13:30:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6574439</guid><dc:creator>dparys</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/dparys/comments/6574439.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dparys/commentrss.aspx?PostID=6574439</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dparys/rsscomments.aspx?PostID=6574439</wfw:comment><description>Gestern hatte ich eine Veranstaltung zu Visual Studio Team System und dem Team Foundation Server. Während wir über Unit-Testing gesprochen haben, stellte mir ein Teilnehmer die Frage, ob wir ein Mocking Framework zur Verfügung stellen. Nach einem klaren...(&lt;a href="http://blogs.msdn.com/dparys/archive/2007/11/28/mock-it-up.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6574439" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dparys/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/dparys/archive/tags/VSTS/default.aspx">VSTS</category><category domain="http://blogs.msdn.com/dparys/archive/tags/Testing/default.aspx">Testing</category></item></channel></rss>