<?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>Adventures of an aspiring agile developer in a not-quite agile world</title><link>http://blogs.msdn.com/agilemonkey/default.aspx</link><description /><dc:language>en-CA</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>One step past Assert.Throws&lt;&gt;</title><link>http://blogs.msdn.com/agilemonkey/archive/2008/07/29/one-step-past-assert-throws.aspx</link><pubDate>Tue, 29 Jul 2008 19:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8789288</guid><dc:creator>casper</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/8789288.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=8789288</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=8789288</wfw:comment><description>&lt;P&gt;If you’re not using &lt;A class="" href="http://codeplex.com/xunit" mce_href="http://codeplex.com/xunit"&gt;xUnit&lt;/A&gt; (and you should be), at least consider adopting the practices they have for dealing with exceptions in unit tests. From the very first release, they moved us from this:&lt;/P&gt;&lt;CODE&gt;[ExpectedException(typeof(InvalidOperationException))] &lt;BR&gt;public void WithdrawingMoreThanBalanceThrows() &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account account = new Account(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; account.Deposit(100); &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; account.Widthraw(200); &lt;BR&gt;}&lt;/CODE&gt; 
&lt;P&gt;to the far-better:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;public void WithdrawingMoreThanBalanceThrows() &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account account = new Account(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; account.Deposit(100); &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.Throws&amp;lt;InvalidOperationException&amp;gt;(delegate &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; account.Widthraw(200);&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/CODE&gt;&lt;CODE&gt; &lt;BR&gt;}&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;But we’re still not following the 3 As pattern. Recently (not sure exactly when) they took us one step further to this (in 3.5 syntax):&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;public void WithdrawingMoreThanBalanceThrows() &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account account = new Account(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; account.Deposit(100); &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exception ex = Record.Exception(() =&amp;gt; account.Widthraw(200)); &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ex.ShouldBeType&amp;lt;InvalidOperationException&amp;gt;();&lt;/CODE&gt;&lt;CODE&gt; &lt;BR&gt;}&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;and now we are exactly where we should be :)&lt;/P&gt;
&lt;P&gt;(I was just told that &lt;CODE&gt;() =&amp;gt;&lt;/CODE&gt; is called the ‘crotch operator’ today. Can’t wait to use that in a code review.)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8789288" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/EDD_2F00_TDD/default.aspx">EDD/TDD</category><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/xUnit.net/default.aspx">xUnit.net</category></item><item><title>Can you take the single responsibility principle too far?</title><link>http://blogs.msdn.com/agilemonkey/archive/2008/03/28/can-you-take-the-srp-too-far.aspx</link><pubDate>Fri, 28 Mar 2008 12:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8341299</guid><dc:creator>casper</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/8341299.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=8341299</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=8341299</wfw:comment><description>
&lt;p&gt;This morning, I had a conversation with a colleague of mine who has recently started using EDD about "exposing things just for the purpose of testing." Although I have run across the odd occasion where I may need to add a get property to a class in order to verify a value, usually I find this means that the class is doing too much. &lt;/p&gt;

&lt;p&gt;Here's the scenario:&lt;/p&gt;

&lt;p&gt;Imagine a command-line application that needs to perform several actions. Each action is responsible for parsing and validating the parameters for itself. One possible structure looks like this:&lt;/p&gt;
&lt;pre&gt;public class PourWaterAction : IAction &lt;br&gt;{&lt;br&gt;  PourWaterAction(string[] args)&lt;br&gt;  {&lt;br&gt;  }&lt;br&gt; &lt;br&gt;  public bool ValidateParamters() &lt;br&gt;  {&lt;br&gt;     // throws if invalid &lt;br&gt;  } &lt;br&gt;&lt;br&gt;  public void Perform() &lt;br&gt;  { &lt;br&gt;    // do real stuff here &lt;br&gt;  }&lt;br&gt;}&lt;/pre&gt;
&lt;p&gt;Now we've got tests that will assert if &lt;code&gt;ValidateParameters&lt;/code&gt; throws, but how do we write a test that determines if the parameters are properly parsed when &lt;code&gt;ValidateParameters&lt;/code&gt; doesn't throw?&lt;/p&gt;

&lt;p&gt;This is where the interesting conversation starts: my feeling was that the &lt;code&gt;PourWaterAction&lt;/code&gt; class shouldn't be doing two things, and validation should be delegated to a different class. Perhaps something like this:&lt;/p&gt;
&lt;pre&gt;public static class PourWaterActionValidator&lt;br&gt;{&lt;br&gt;  public static PourWaterData Validate()  &lt;br&gt;  {&lt;br&gt;    // Either throw or return a populated structure&lt;br&gt;  }&lt;br&gt;}&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;public class PourWaterActionValidator : IActionValidator&lt;br&gt;{&lt;br&gt;  public PourWaterData Validate()  &lt;br&gt;  {&lt;br&gt;    // Either throw or return a populated structure&lt;br&gt;  }&lt;br&gt;}&lt;/pre&gt;
&lt;p&gt;Now we can move the validation tests to the new class, and easily write a test for passing conditions as well as failing ones. Straightforward enough, right?&lt;/p&gt;

&lt;p&gt;Possibly not. My colleague was of the opinion that:&amp;nbsp; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This was creating extra classes unnecessarily which, when taken to the extreme, would mean tons of different files in the project. &lt;/li&gt;

&lt;li&gt;Even if another class was created, it should be visible only to &lt;code&gt;PourWaterAction&lt;/code&gt; which means it wouldn't be possible to test either. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means that the only way to test it was to add get properties to &lt;code&gt;PourWaterAction&lt;/code&gt; so the tests could verify that the parsing had been performed correctly — "adding things just for the sake of testing"&lt;/p&gt;

&lt;p&gt;So, what would you do in this situation? And do you believe that classes should always strive to do one thing and one thing only?&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8341299" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/EDD_2F00_TDD/default.aspx">EDD/TDD</category></item><item><title>Gatineau Beta upgrade goes live!</title><link>http://blogs.msdn.com/agilemonkey/archive/2008/03/04/gatineau-beta-2-goes-live.aspx</link><pubDate>Tue, 04 Mar 2008 10:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7943670</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/7943670.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=7943670</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=7943670</wfw:comment><description>&lt;P&gt;The main reason for my lack of blogs posts recently has been the final push to get Gatineau (adCenter Analytics)&amp;nbsp;out the door and I'm happy to say that it's gone live :) I'll try to get a few screenshots up next week. You'll need an adCenter account to see our stuff, but the main site is here: &lt;A href="http://adcenter.microsoft.com/" mce_href="http://adcenter.microsoft.com"&gt;http://adcenter.microsoft.com&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Note: The $5 sign-up fee has been removed! You can find details on how to enlist here: &lt;A href="http://adcenterblog.spaces.live.com/default.aspx?wa=wsignin1.0"&gt;http://adcenterblog.spaces.live.com/default.aspx?wa=wsignin1.0&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7943670" width="1" height="1"&gt;</description></item><item><title>Le Web 3 (Day one)</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/12/11/le-web-3-day-one.aspx</link><pubDate>Tue, 11 Dec 2007 18:18:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6735804</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/6735804.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=6735804</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=6735804</wfw:comment><description>&lt;p&gt;&lt;strong&gt;Dark Side of the Web&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Panel with Jaewoong Lee (Daum), Dan Rose (Facebook), Chris Alden (SixApart) and a lawyer.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Anonymity allows people to be expressive/rude; if you're rude in real life you probably will be online too. South Korea developed government-run program for Internet identity which is used by top 35 websites. However, 80,000 identities were stolen earlier this year. Keeping history on a site-by-site basis is probably the best way for people to 'behave' and still maintain privacy as it's decentralized. Strangely enough, Korea is outsourcing its community moderation (censorship?) to China. &lt;/li&gt;    &lt;li&gt;Facebook's value comes from using your real identity. There isn't really any spam on Facebook either because your friends won't spam you. &lt;/li&gt;    &lt;li&gt;Having said that, Facebook messed up with Beacon. They didn't respond quickly enough to give users control, and users expected it because everything previously had been controllable. There was also a lack of communication about the project initially (they claim it wasn't to do with advertising, but just coincidence it was launched simultaneously.) &lt;/li&gt;    &lt;li&gt;Targeted advertising: obviously no PII, but more social advertising. Friends can 'advertise' to each other. Ads should appear the same way as content, and not be intrusive. &lt;/li&gt;    &lt;li&gt;90% of UGC (user-generated content) is crap, but 99% of TV is crap. Internet is winning; content is usually relevant to *someone*. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Persistent Communication&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Talk from Evan Williams (Twitter)&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Everyone is using Twitter. Well, at least everyone at this conference is using it. &lt;/li&gt;    &lt;li&gt;Adding constraint to a product can help users. (&lt;em&gt;Obviously, look at Apple&lt;/em&gt;) &lt;/li&gt;    &lt;li&gt;What can we take away to create something new? &lt;/li&gt;    &lt;li&gt;Twitter = Blogger MINUS comments MINUS post titles MINUS pictures MINUS template MINUS formatting PLUS 140 character limit. &lt;/li&gt;    &lt;li&gt;Twitter actually started with the mobile interface first, which forced the web UI to maintain simplicity. &lt;/li&gt;    &lt;li&gt;API was also kept simple, and so people built apps to fill in the gaps. &lt;/li&gt;    &lt;li&gt;Human interface cognitive load is proportional to the number of clicks/keystrokes/gestures. The usability of an interface is inversely geometrically proportional to its cognitive load. - Tantek Celik &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;What can we create by taking away?&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Only post one photo per day (fotolog). Ended up with average of 11 comments/photo (very high) and very high quality. Compare to flickr. &lt;/li&gt;    &lt;li&gt;Only upload a picture and add a yes/no button. Compare to most dating sites. &lt;/li&gt;    &lt;li&gt;Restrict social network to 20 friends. Compare to myspace. (Actually, this is what the 'top friends' application does on Facebook, and it's the most popular application) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Why books and school lectures still exist&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Hans Rosling (the man behind Gapminder)&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;He actually wanted to present remotely, but they wouldn't let him. &lt;/li&gt;    &lt;li&gt;Does some very nice real-time presentations using Gapminder. He made two striking points about Africa      &lt;ol&gt;       &lt;li&gt;Africa has advanced extremely quickly. He used a graph of life expectancy vs GDP. Below is the current situation vs. Sweden throughout the years. &lt;/li&gt;        &lt;li&gt;The current state of advancement within African countries is massive (~200 years). You cannot treat them as all being in the same range.          &lt;br /&gt;          &lt;br /&gt;          &lt;table cellspacing="2" cellpadding="2" width="273" border="1"&gt;&lt;tbody&gt;             &lt;tr&gt;               &lt;td valign="top" width="116"&gt;Sierra Leone&lt;/td&gt;                &lt;td valign="top" width="149"&gt;Sweden 1709&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="118"&gt;Mozambique&lt;/td&gt;                &lt;td valign="top" width="149"&gt;Sweden 1810&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="119"&gt;Uganda&lt;/td&gt;                &lt;td valign="top" width="149"&gt;Sweden 1877&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="119"&gt;India&lt;/td&gt;                &lt;td valign="top" width="149"&gt;Sweden 1910&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="119"&gt;Guatemala&lt;/td&gt;                &lt;td valign="top" width="149"&gt;Sweden 1933&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="119"&gt;Brazil&lt;/td&gt;                &lt;td valign="top" width="149"&gt;Sweden 1953&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="119"&gt;South Korea&lt;/td&gt;                &lt;td valign="top" width="149"&gt;Sweden 1983&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="119"&gt;Japan&lt;/td&gt;                &lt;td valign="top" width="149"&gt;Sweden 2004 (equal)&lt;/td&gt;             &lt;/tr&gt;           &lt;/tbody&gt;&lt;/table&gt;       &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;Another illustration is Singapore vs. France in terms of Mortality Rate and GDP compared from 1931 to 2007. In 1931 Singapore was far behind in both areas, now it has completely overtaken France. &lt;/li&gt;    &lt;li&gt;Having said all that, none of these facts &amp;amp; figures work without having storytellers. And watching Rosling, it's obviously true. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;What is social about design&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Philippe Starck. Very interesting guy but difficult talk to summarize. His main points revolve around responsible products and responsible business. Creating products that solve problems rather than (just) make money is important. Other topics covered with eco-friendliness, organic products, and ubiquitous/miniaturization of computers.&lt;/p&gt;  &lt;p&gt;Perhaps the best part was at the end when Scoble got up on stage and asked him to review the Kindle. &amp;quot;It's almost modern&amp;quot; was his response.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Technology impact on corporate culture (Google)&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Drivers of change: ubiquitous connectivity, democratization of the tools of production, falling cost of storage/increase of processing power. We double storage capability every 13 months; by 2020 a device the size of an iPod could store all the content ever created.&lt;/li&gt;    &lt;li&gt;At Google, revenue and profitability are an afterthought. First they try to identify customer needs and address them as fast as possible.&lt;/li&gt;    &lt;li&gt;Cultural innovation - Dublin (reliability), London (apps for mobile), Zurich (search, geo infrastructure), Munich (apps for mobile), Trondheim (infrastructure, news), Haifa (localisation, ads, search quality)&lt;/li&gt;    &lt;li&gt;Empowerment: 20% slack time. Small teams.&lt;/li&gt;    &lt;li&gt;Speed - Fast is better than slow. Don't waste time making 2-year business plans. Release early, release often. Get feedback from customers. It's not about big beating small, but rather who is faster. &lt;em&gt;Change your development approach to bring things to market as quickly as possible&lt;/em&gt;. (emphasis added)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Storytelling and technology - evolution of society&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;June Cohen from TED. Good talk. Basically pointing out that technology is returning us to the traditional (old) ways of communication. TV, newspaper, etc. and mass media are actually _new_ ways, not old. Big media is due to become smaller. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Personalization .. 2.0 .. 3.0&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Jonathan Medved - Vringo&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Mobile content will become richer and needs to catch up to the web quickly&lt;/li&gt;    &lt;li&gt;Look for video, animations, avatars, and photos to become more prominent&lt;/li&gt;    &lt;li&gt;UGC will also take off just like it did on the web&lt;/li&gt;    &lt;li&gt;Visual ringtones: need to be symmetrical and it plays on the called party's phone. Needs to be frequently changed as video gets old quickly. Could be purchased or uploaded by users.&lt;/li&gt;    &lt;li&gt;The future of mobile personalization will be around straddling a call or SMS&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Before call: viral ad, avatar, photo, licensed or UGC content&lt;/li&gt;      &lt;li&gt;During call: enterprise ad, yellow pages, consumer-pushed content, ad-supported calls&lt;/li&gt;      &lt;li&gt;After call: branding ad, e-commerce, call to action, voting game&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6735804" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/Conferences/default.aspx">Conferences</category></item><item><title>XAML : XAMLPad :: LINQ : ?</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/11/19/xaml-xamlpad-linq.aspx</link><pubDate>Mon, 19 Nov 2007 09:31:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6390438</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/6390438.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=6390438</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=6390438</wfw:comment><description>&lt;p&gt;One of my teammates just sent a link to &lt;a href="http://www.linqpad.net/"&gt;LINQPad&lt;/a&gt;, a small application written by the authors of &lt;a href="http://www.amazon.com/gp/product/0596527578?ie=UTF8&amp;amp;tag=cinanu-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0596527578"&gt;C# 3.0 in a Nutshell&lt;/a&gt;. Looks like a great tool for anyone that wants to learn LINQ or needs to execute queries on a regular basis.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6390438" width="1" height="1"&gt;</description></item><item><title>Now you can fool your xUnit tests</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/11/12/now-you-can-fool-your-xunit-tests.aspx</link><pubDate>Mon, 12 Nov 2007 11:27:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6131369</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/6131369.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=6131369</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=6131369</wfw:comment><description>&lt;p&gt;Back in the 'early days' of xUnit, I &lt;a href="http://blogs.msdn.com/agilemonkey/archive/2007/09/27/weaving-with-xunit-net.aspx"&gt;posted an example&lt;/a&gt; of how to use the &lt;code&gt;BeforeAfterTestAttribute&lt;/code&gt; to modify a test's current identity. Now that there is an official &lt;a href="http://www.codeplex.com/xunitext"&gt;xUnit.net Extensions project&lt;/a&gt;, I've cleaned it up and submitted the code in &lt;a href="http://www.codeplex.com/xunitext/SourceControl/DirectoryView.aspx?SourcePath=&amp;amp;changeSetId=7569"&gt;change set 7569&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;I'm looking forward to seeing what the community will contribute to this project - I'm sure we can get some really handy extensions written.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6131369" width="1" height="1"&gt;</description></item><item><title>Task Parallel Library goes public</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/10/18/task-parallel-library-goes-public.aspx</link><pubDate>Thu, 18 Oct 2007 13:23:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5506555</guid><dc:creator>casper</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/5506555.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=5506555</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=5506555</wfw:comment><description>&lt;p&gt;If you're interested in taking advantage of multiple processors and code in .NET with a minimal amount of effort then this is the library for you. The introductory MSDN article is &lt;a href="http://msdn.microsoft.com/msdnmag/issues/07/10/Futures/default.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Long live &lt;code&gt;Parallel.For()&lt;/code&gt; :)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5506555" width="1" height="1"&gt;</description></item><item><title>The cool stuff is starting to surface (introducing Graffiti)</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/10/18/the-cool-stuff-is-starting-to-surface-introducing-graffiti.aspx</link><pubDate>Thu, 18 Oct 2007 09:53:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5505296</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/5505296.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=5505296</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=5505296</wfw:comment><description>&lt;p&gt;It's been tough not being able to write about anything that we work on here in Dublin, but slowly the details are starting to come out. Ian's &lt;a href="http://www.liesdamnedlies.com/2007/10/the-skinny-on-g.html"&gt;latest post&lt;/a&gt; on what we presented at e-Metrics includes a demo video of Graffiti, an automatic tagging module that's included in Gatineau Beta 2. It was completely designed, developed, and tested here and we're quite proud of it.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5505296" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/Gatineau/default.aspx">Gatineau</category></item><item><title>Come join us!</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/10/16/come-join-us.aspx</link><pubDate>Tue, 16 Oct 2007 08:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5467508</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/5467508.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=5467508</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=5467508</wfw:comment><description>&lt;p&gt;Our team here in Dublin has launched a recruiting site at &lt;a href="http://www.joinmicrosofteurope.com/?c=jbref" mce_href="http://www.joinmicrosofteurope.com/?c=jbref"&gt;http://www.joinmicrosofteurope.com/&lt;/a&gt;. It's got information on what it's like to work here, some of the many benefits, and first-hand interviews with members of our team. As well, we're starting a MSDN blog at &lt;a href="http://blogs.msdn.com/gpde" mce_href="http://blogs.msdn.com/gpde"&gt;http://blogs.msdn.com/gpde&lt;/a&gt;. Go check them out!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5467508" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/Microsoft/default.aspx">Microsoft</category></item><item><title>ReSharper and xUnit.net</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/10/03/playing-tricks-on-resharper.aspx</link><pubDate>Wed, 03 Oct 2007 10:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5256357</guid><dc:creator>casper</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/5256357.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=5256357</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=5256357</wfw:comment><description>
&lt;p&gt;Those of you who have switched over to xUnit.Net may have a received a nasty surprise with the 'type members layout' feature of ReSharper: it doesn't respect method attributes. Namely, you can tell it to not reorder methods in an NUnit fixture like this:&amp;nbsp; &lt;/p&gt;

&lt;pre&gt;&amp;lt;Pattern&amp;gt;&amp;nbsp;&amp;nbsp; &lt;br&gt; &amp;lt;Match&amp;gt;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;HasAttribute CLRName="NUnit.Framework.TestFixture"/&amp;gt;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp; &amp;lt;/Match&amp;gt;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;lt;/Pattern&amp;gt;&lt;/pre&gt;
&lt;p&gt;But you &lt;b&gt;cannot&lt;/b&gt; tell it to not reorder your xUnit methods like this:&amp;nbsp;&amp;nbsp; &lt;/p&gt;

&lt;pre&gt;&amp;lt;Pattern&amp;gt; &lt;br&gt;    &amp;nbsp;&amp;nbsp; &amp;lt;Match&amp;gt; &lt;br&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;And Weight="100"&amp;gt; &lt;br&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Kind Is="method"/&amp;gt; &lt;br&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;HasAttribute CLRName="Xunit.TestAttribute" Inherit="false"/&amp;gt; &lt;br&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/And&amp;gt; &lt;br&gt;    &amp;nbsp;&amp;nbsp; &amp;lt;/Match&amp;gt; &lt;br&gt;&amp;lt;/Pattern&amp;gt;
&lt;/pre&gt;Apparently it will only look for attributes on classes and interfaces. In the meantime, I think the simplest solution is to just create a fake attribute you can add to your fixture.&amp;nbsp; 
&lt;pre&gt;public class ReSharperNoReorderAttribute : Attribute &lt;br&gt;{ &lt;br&gt;}
&lt;/pre&gt;And the appropriate pattern match to ReSharper: 
&lt;pre&gt;&amp;lt;Pattern&amp;gt;&lt;br&gt;     &amp;nbsp; &amp;lt;Match&amp;gt; &lt;br&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;HasAttribute CLRName="ReSharperNoReorder"/&amp;gt; &lt;br&gt;    &amp;nbsp; &amp;lt;/Match&amp;gt; &lt;br&gt;&amp;lt;/Pattern&amp;gt;&lt;/pre&gt;All should be well after that.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5256357" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/xUnit.net/default.aspx">xUnit.net</category></item><item><title>Weaving with xUnit.net</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/09/27/weaving-with-xunit-net.aspx</link><pubDate>Thu, 27 Sep 2007 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5164441</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/5164441.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=5164441</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=5164441</wfw:comment><description>&lt;p&gt;There has been mixed reaction to the removal of &lt;code&gt;[SetUp]&lt;/code&gt; and &lt;code&gt;[TearDown]&lt;/code&gt; in xUnit.net. Personally, I think it's great as it helps to raise unit test 'smells', particularly around how classes interact with each another. Here's a small example of how we can use the &lt;code&gt;BeforeAfterTestAttribute&lt;/code&gt; in xUnit to remove duplicate code. (It's based on the security workaround I talked about &lt;a href="http://blogs.msdn.com/agilemonkey/archive/2007/09/26/faking-out-principalpermission.aspx" mce_href="http://blogs.msdn.com/agilemonkey/archive/2007/09/26/faking-out-principalpermission.aspx"&gt;yesterday&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;Instead of repeating three lines of code in each unit test to update the current identity, we can just define an attribute like &lt;code&gt;[AssumeIdentity]&lt;/code&gt; that will take care of things for us. Here's the little fixture I wrote to test it.&lt;/p&gt;&lt;pre&gt;&lt;p&gt;public class AssumeIdentityAttributeFixture &lt;br&gt;{ &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test] &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void CallingSecuredMethodWillThrow() &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.Throws&amp;lt;SecurityException&amp;gt;(delegate &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SecuredMethod(); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test, AssumeIdentity("Munchkin")] &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void CallingSecuredMethodWithAssumedIdentityPasses() &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.DoesNotThrow(delegate &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SecuredMethod(); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [PrincipalPermission(SecurityAction.Demand, Role = "Munchkin")] &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void SecuredMethod() {} &lt;br&gt;} &lt;/p&gt;&lt;br&gt;public class AssumeIdentityAttribute : BeforeAfterTestAttribute &lt;br&gt;&lt;p&gt;{&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public AssumeIdentityAttribute(string name) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.name = name; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public override void Before(MethodInfo methodUnderTest) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; originalPrincipal = Thread.CurrentPrincipal; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GenericIdentity identity = new GenericIdentity("boo"); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GenericPrincipal principal = &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new GenericPrincipal(identity, new string[] { name }); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.CurrentPrincipal = principal; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/p&gt;&lt;p&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public override void After(MethodInfo methodUnderTest) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.CurrentPrincipal = originalPrincipal; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/p&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; readonly string name; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPrincipal originalPrincipal; &lt;br&gt;} &lt;/pre&gt;
&lt;p&gt;As you can see, before each test it executed, we update the current thread's identity, and then reset it after the test has run. It doesn't get much simpler than that :)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5164441" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/xUnit.net/default.aspx">xUnit.net</category></item><item><title>Faking out [PrincipalPermission]</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/09/26/faking-out-principalpermission.aspx</link><pubDate>Wed, 26 Sep 2007 15:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5143315</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/5143315.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=5143315</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=5143315</wfw:comment><description>
&lt;p&gt;Depending on how your unit tests are setup, you may not be running as the proper user and won't have the necessary permissions to invoke a method. If this happens, you can easily alter the principle thread's identity with the following code.&lt;/p&gt;
  
&lt;p&gt;For instance, if you user needs to belong to a certain role (or group) called 'DesiredGroup', this would emulate that fact.&lt;/p&gt;
 &lt;pre&gt;&lt;p&gt;GenericIdentity identity = new GenericIdentity("boo");      &lt;br&gt;GenericPrincipal principal =       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new GenericPrincipal(identity, new string[] {"DesiredGroup"});       &lt;br&gt;      &lt;br&gt;Thread.CurrentPrincipal = principal; &lt;/p&gt;&lt;/pre&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5143315" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/xUnit.net/default.aspx">xUnit.net</category></item><item><title>xUnit.net goes live!</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/09/21/xunit-net-goes-live.aspx</link><pubDate>Fri, 21 Sep 2007 09:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5026124</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/5026124.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=5026124</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=5026124</wfw:comment><description>NUnit is dead! Long live xUnit.net!

&lt;p&gt;There are several cool features, including aspect-like extensibility for tests, but the two changes that will immediately make a difference in my day-to-day coding&amp;nbsp;are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;[ExpectedException]&lt;/code&gt; is gone. In its place is &lt;code&gt;Assert.Throws&amp;lt;T&amp;gt;( delegate ... )&lt;/code&gt;. Not only much easier to read, but no longer can a test throw in an unexpected place and still pass. &lt;/li&gt;

&lt;li&gt;No more &lt;code&gt;SetUp/TearDown&lt;/code&gt;. This makes maintaining state between tests a bit more difficult. Having to add static variables to a test fixture should probably signal warning flags about the code under test. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For anyone wondering if it actually works, the answer is a resounding 'Yes'. It's already been integrated into sections of the &lt;a href="http://www.liesdamnedlies.com/2007/07/microsoft-gatin.html" mce_href="http://www.liesdamnedlies.com/2007/07/microsoft-gatin.html"&gt;project I'm currently working on&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It's available for download here: &lt;a href="http://codeplex.com/xunit" mce_href="http://codeplex.com/xunit"&gt;http://codeplex.com/xunit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, be sure to read Jim Newkirk's &lt;a href="http://jamesnewkirk.typepad.com/posts/2007/09/announcing-xuni.html" mce_href="http://jamesnewkirk.typepad.com/posts/2007/09/announcing-xuni.html"&gt;official announcement&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5026124" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/EDD_2F00_TDD/default.aspx">EDD/TDD</category><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/xUnit.net/default.aspx">xUnit.net</category></item><item><title>Dropping multiple tables in SQL Server 2005</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/09/19/dropping-multiple-tables-in-sql-server-2005.aspx</link><pubDate>Wed, 19 Sep 2007 09:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4992945</guid><dc:creator>casper</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/4992945.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=4992945</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=4992945</wfw:comment><description>
&lt;p&gt;I'm currently working on a project that has a Cache database that stores query results, and so naturally there are times when I'm playing inside of Management Studio that I want to delete the cache. However, I don't want to drop the entire database (because then I'd have to re-run the create script), nor do I want to delete all the tables in it (there is one table that needs to remain).&lt;/p&gt;

&lt;p&gt;In case it's of use to anyone, or I need to do this again, here's a snippet of T-SQL that will drop an arbitrary list of tables from a database.&lt;/p&gt;

&lt;pre&gt;&lt;p&gt;DECLARE @id varchar(255) &lt;br&gt;DECLARE @dropCommand varchar(255) &lt;/p&gt;&lt;p&gt;DECLARE tableCursor CURSOR FOR &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT name FROM sys.tables WHERE name &amp;lt;&amp;gt; 'CacheManager' &lt;/p&gt;&lt;p&gt;OPEN tableCursor &lt;br&gt;FETCH next FROM tableCursor INTO @id &lt;/p&gt;&lt;p&gt;WHILE @@fetch_status=0 &lt;br&gt;BEGIN &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET @dropcommand = N'drop table ' + @id &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXECUTE(@dropcommand) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FETCH next FROM tableCursor INTO @id &lt;br&gt;END &lt;/p&gt;&lt;p&gt;CLOSE tableCursor &lt;br&gt;DEALLOCATE tableCursor&lt;/p&gt;
&lt;/pre&gt;
&lt;p&gt;I wish there was a 'Copy as HTML' function or something similar I could use to get the nicely formatted text from Management Studio into a blog posting.&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4992945" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/SQL/default.aspx">SQL</category></item><item><title>The one where Toby finds a dependency injection container</title><link>http://blogs.msdn.com/agilemonkey/archive/2007/09/10/the-one-where-toby-finds-a-dependency-injection-container.aspx</link><pubDate>Tue, 11 Sep 2007 00:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4861198</guid><dc:creator>casper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/agilemonkey/comments/4861198.aspx</comments><wfw:commentRss>http://blogs.msdn.com/agilemonkey/commentrss.aspx?PostID=4861198</wfw:commentRss><wfw:comment>http://blogs.msdn.com/agilemonkey/rsscomments.aspx?PostID=4861198</wfw:comment><description>Toby is less than happy. Due to some &lt;a href="http://upload.wikimedia.org/wikipedia/en/c/cb/Impact_event.jpg" mce_href="http://upload.wikimedia.org/wikipedia/en/c/cb/Impact_event.jpg"&gt;unforeseen circumstances&lt;/a&gt;, he recently lost all the code he'd been working on for the EDM project. For some unknown reason, he'd never bothered to setup a source control server and vows to not make the same mistake twice.
  
&lt;p&gt;Desperate to kick-start his excitement on the project again, he remembers &lt;a href="http://blogs.msdn.com/agilemonkey/archive/2007/09/01/tony-and-the-step-backwards.aspx#Conclusion" mce_href="http://blogs.msdn.com/agilemonkey/archive/2007/09/01/tony-and-the-step-backwards.aspx#Conclusion"&gt;coming to the conclusion&lt;/a&gt; that he'd need some sort of dependency injection container. Although initially he was &lt;a href="http://blogs.msdn.com/agilemonkey/archive/2007/06/06/toby-and-the-user-stories.aspx#CAB" mce_href="http://blogs.msdn.com/agilemonkey/archive/2007/06/06/toby-and-the-user-stories.aspx#CAB"&gt;contemplating using CAB&lt;/a&gt;, he realised that what he really wanted was just part of the container functionality from WorkItem. After a bit of searching, he found that the current version of &lt;a href="http://codeplex.com/ObjectBuilder" mce_href="http://codeplex.com/ObjectBuilder"&gt;ObjectBuilder&lt;/a&gt; ships with the &lt;a href="http://www.codeplex.com/ObjectBuilder/SourceControl/DirectoryView.aspx?SourcePath=%24%2fObjectBuilder%2fSamples%2fCodePlexContainer&amp;amp;changeSetId=26238" mce_href="http://www.codeplex.com/ObjectBuilder/SourceControl/DirectoryView.aspx?SourcePath=%24%2fObjectBuilder%2fSamples%2fCodePlexContainer&amp;amp;changeSetId=26238"&gt;sample container from Codeplex&lt;/a&gt;. Deciding that it would be nice to shift gears for a while, he fires up Visual Studio and starts writing some tests.&lt;/p&gt;
 &lt;pre&gt;&lt;p&gt;[TestFixture]      &lt;br&gt;public class Injection       &lt;br&gt;{       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test]       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void CanInjectService()       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DependencyContainer container = new DependencyContainer();       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; container.RegisterSingletonInstance&amp;lt;IUserService&amp;gt;(new UserService()); &lt;/p&gt;&lt;p&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Project newProject = container.Get&amp;lt;Project&amp;gt;();
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.NotNull(newProject.UserService);      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.Equal("casper", newProject.UserService.CurrentUser);       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test]      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void InjectedServiceIsReallyTheSameOneWeThinkItIs()       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DependencyContainer container = new DependencyContainer();       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UserService userService = new UserService();       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; container.RegisterSingletonInstance&amp;lt;IUserService&amp;gt;(userService);       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Project newProject = container.Get&amp;lt;Project&amp;gt;(); 
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; userService.CurrentUser = "B-rad";    
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.Equal("B-rad", newProject.UserService.CurrentUser);      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class Project      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Dependency]       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IUserService UserService       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return userService; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { userService = value; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private IUserService userService;      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; interface IUserService      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string CurrentUser { get; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class UserService : IUserService      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string CurrentUser       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return currentUser; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { currentUser = value; }       &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private string currentUser = "casper";      &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }       &lt;br&gt;}&lt;/p&gt;&lt;/pre&gt;
 So, nothing too fancy, but the start of how we can &lt;a href="http://en.wikipedia.org/wiki/Separation_of_concerns" mce_href="http://en.wikipedia.org/wiki/Separation_of_concerns"&gt;separate concerns&lt;/a&gt; in the project. And Toby has learned his lesson, and will soon start posting code on &lt;a href="http://codeplex.com" mce_href="http://codeplex.com"&gt;Codeplex&lt;/a&gt;.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4861198" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/EDD_2F00_TDD/default.aspx">EDD/TDD</category><category domain="http://blogs.msdn.com/agilemonkey/archive/tags/The+adventures+of+Toby/default.aspx">The adventures of Toby</category></item></channel></rss>