<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Effects Of Encapsulation On Unit Tests &#8211; EnumerableAssert</title>
	<atom:link href="http://lostechies.com/joeybeninghove/2007/10/11/effects-of-encapsulation-on-unit-tests-enumerableassert/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/joeybeninghove/2007/10/11/effects-of-encapsulation-on-unit-tests-enumerableassert/</link>
	<description>Just another LosTechies site</description>
	<lastBuildDate>Fri, 15 Oct 2010 23:08:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Joe Ocampo</title>
		<link>http://lostechies.com/joeybeninghove/2007/10/11/effects-of-encapsulation-on-unit-tests-enumerableassert/#comment-60</link>
		<dc:creator>Joe Ocampo</dc:creator>
		<pubDate>Fri, 12 Oct 2007 03:28:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/joeydotnet/archive/2007/10/11/effects-of-encapsulation-on-unit-tests-enumerableassert.aspx#comment-60</guid>
		<description>I know you knew I had to throw in some BDD flare to your example. LOL

    [TestFixture]
    public class When_Adding_an_item_to_a_basket
    {
        [Test]
        public void Should_add_item_to_basket()
        {
            IBasket basket = new Basket();
            IBasketItem basketItem = new BasketItem();

            basket.AddItemToBasket(basketItem);

            //EnumerableAssert.Contains(basket.Items, basketItem);
            Specify.That(basket.Items).Contains(basketItem);
            
        }
    }

    public class EnumerableAssert&lt;T&gt;
    {
        private IEnumerable&lt;T&gt; myList;

        public EnumerableAssert(IEnumerable&lt;T&gt; enumerable)
        {
            myList = enumerable;
        }

        public void Contains(T actual)
        {
            CollectionAssert.Contains(new List&lt;T&gt;(myList), actual);
        }
    }

    public class Specify
    {
        public static EnumerableAssert&lt;T&gt; That&lt;T&gt;(IEnumerable&lt;T&gt; enumerable)
        {
            return new EnumerableAssert&lt;T&gt;(enumerable);
        }
    }</description>
		<content:encoded><![CDATA[<p>I know you knew I had to throw in some BDD flare to your example. LOL</p>
<p>    [TestFixture]<br />
    public class When_Adding_an_item_to_a_basket<br />
    {<br />
        [Test]<br />
        public void Should_add_item_to_basket()<br />
        {<br />
            IBasket basket = new Basket();<br />
            IBasketItem basketItem = new BasketItem();</p>
<p>            basket.AddItemToBasket(basketItem);</p>
<p>            //EnumerableAssert.Contains(basket.Items, basketItem);<br />
            Specify.That(basket.Items).Contains(basketItem);</p>
<p>        }<br />
    }</p>
<p>    public class EnumerableAssert<t><br />
    {<br />
        private IEnumerable</t><t> myList;</p>
<p>        public EnumerableAssert(IEnumerable</t><t> enumerable)<br />
        {<br />
            myList = enumerable;<br />
        }</p>
<p>        public void Contains(T actual)<br />
        {<br />
            CollectionAssert.Contains(new List</t><t>(myList), actual);<br />
        }<br />
    }</p>
<p>    public class Specify<br />
    {<br />
        public static EnumerableAssert</t><t> That</t><t>(IEnumerable</t><t> enumerable)<br />
        {<br />
            return new EnumerableAssert</t><t>(enumerable);<br />
        }<br />
    }</t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joeyDotNet</title>
		<link>http://lostechies.com/joeybeninghove/2007/10/11/effects-of-encapsulation-on-unit-tests-enumerableassert/#comment-59</link>
		<dc:creator>joeyDotNet</dc:creator>
		<pubDate>Thu, 11 Oct 2007 18:47:34 +0000</pubDate>
		<guid isPermaLink="false">/blogs/joeydotnet/archive/2007/10/11/effects-of-encapsulation-on-unit-tests-enumerableassert.aspx#comment-59</guid>
		<description>Yeah, but at least with this little wrapper, you never have to create the list in your actual test method.

I peeked in Reflector on MbUnit and basically the reason their CollectionAssert requires an ICollection is because they&#039;re just newing up an ArrayList (which only takes an ICollection) and calling Contains on it.</description>
		<content:encoded><![CDATA[<p>Yeah, but at least with this little wrapper, you never have to create the list in your actual test method.</p>
<p>I peeked in Reflector on MbUnit and basically the reason their CollectionAssert requires an ICollection is because they&#8217;re just newing up an ArrayList (which only takes an ICollection) and calling Contains on it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy Bogard</title>
		<link>http://lostechies.com/joeybeninghove/2007/10/11/effects-of-encapsulation-on-unit-tests-enumerableassert/#comment-58</link>
		<dc:creator>Jimmy Bogard</dc:creator>
		<pubDate>Thu, 11 Oct 2007 18:35:04 +0000</pubDate>
		<guid isPermaLink="false">/blogs/joeydotnet/archive/2007/10/11/effects-of-encapsulation-on-unit-tests-enumerableassert.aspx#comment-58</guid>
		<description>That&#039;s cool, though it still sucks you have to create another list.  I wonder why MbUnit requires ICollection?</description>
		<content:encoded><![CDATA[<p>That&#8217;s cool, though it still sucks you have to create another list.  I wonder why MbUnit requires ICollection?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
