<?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: Given, when, then and examples for classes</title>
	<atom:link href="http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/feed/" rel="self" type="application/rss+xml" />
	<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/</link>
	<description>Software, Training, Coaching, Writing</description>
	<lastBuildDate>Wed, 08 Feb 2012 12:59:05 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Olof Bjarnason</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1315</link>
		<dc:creator>Olof Bjarnason</dc:creator>
		<pubDate>Fri, 12 Dec 2008 00:36:49 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1315</guid>
		<description>Liz! Thanks for shedding some more light to my BDD journey! The login example is much easier to understand, I&#039;m not a farmer haha :)

cya</description>
		<content:encoded><![CDATA[<p>Liz! Thanks for shedding some more light to my BDD journey! The login example is much easier to understand, I&#8217;m not a farmer haha <img src='http://lizkeogh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>cya</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1314</link>
		<dc:creator>Phil</dc:creator>
		<pubDate>Thu, 11 Dec 2008 03:12:58 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1314</guid>
		<description>In your second example...I think I am missing something.  Don&#039;t you need to inject the mock(Authenticator) into the controller?  I have not used this framework, so I may be missing something.  Thanks.

&lt;em&gt;Hmm, DI without the I. Fixed! Thanks - Liz&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>In your second example&#8230;I think I am missing something.  Don&#8217;t you need to inject the mock(Authenticator) into the controller?  I have not used this framework, so I may be missing something.  Thanks.</p>
<p><em>Hmm, DI without the I. Fixed! Thanks &#8211; Liz</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: liz</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1313</link>
		<dc:creator>liz</dc:creator>
		<pubDate>Thu, 11 Dec 2008 00:14:24 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1313</guid>
		<description>Since I can edit your comments, I&#039;ve thrown the &lt;code&gt; tags in - thank you, these are great!</description>
		<content:encoded><![CDATA[<p>Since I can edit your comments, I&#8217;ve thrown the &lt;code&gt; tags in &#8211; thank you, these are great!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1312</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 10 Dec 2008 17:58:41 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1312</guid>
		<description>opps sorry ... the types in the generics TestObjectFor BehaviorOf don&#039;t show in the post :(

&lt;em&gt;Fixed, I hope I got them right - Liz&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>opps sorry &#8230; the types in the generics TestObjectFor BehaviorOf don&#8217;t show in the post <img src='http://lizkeogh.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p><em>Fixed, I hope I got them right &#8211; Liz</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1311</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 10 Dec 2008 17:55:40 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1311</guid>
		<description>Hi Liz,

I just wanted to write that test with fluentspec (in c#) if you don&#039;t mind. 

&lt;code&gt;
public class CowhandTest : BehaviorOf&lt;Cowhand&gt; {

  public void shouldMilkTheCow() {
    var daisy = TestObjectFor&lt;Cow&gt;();
    
    Given.Shed.getCowByName(&quot;Daisy&quot;).Is(daisy);
    When.milkCow(&quot;Daisy&quot;);
    Then.Should(daisy).milk();
  }
}
&lt;/code&gt;

that was with fluent syntax an having Shed as a property in Cowhand
keeping it closer to the example with classic syntax would look like ..

&lt;code&gt;
public class CowhandTest {

  public void shouldMilkTheCow() {

    // Given a repository which knows about one cow
    var shed = Create.TestObjectFor&lt;CowRepository&gt;();
    var daisy = Create.TestObjectFor&lt;Cow&gt;();

    Given.That(shed).getCowByName(&quot;Daisy&quot;).Is(daisy);

    // Given a cowhand who knows where the cows are kept
    var cowhand = new Cowhand(shed);

    // When I ask the cowhand to milk the cow
    cowhand.milkCow(&quot;Daisy&quot;);

    // Then the cow should have been milked
    Then.Should(daisy).milk();
  }
}
&lt;/code&gt;

cheers
mike</description>
		<content:encoded><![CDATA[<p>Hi Liz,</p>
<p>I just wanted to write that test with fluentspec (in c#) if you don&#8217;t mind. </p>
<p><code><br />
public class CowhandTest : BehaviorOf<cowhand> {</p>
<p>  public void shouldMilkTheCow() {<br />
    var daisy = TestObjectFor<cow>();</p>
<p>    Given.Shed.getCowByName("Daisy").Is(daisy);<br />
    When.milkCow("Daisy");<br />
    Then.Should(daisy).milk();<br />
  }<br />
}<br />
</cow></cowhand></code></p>
<p>that was with fluent syntax an having Shed as a property in Cowhand<br />
keeping it closer to the example with classic syntax would look like ..</p>
<p><code><br />
public class CowhandTest {</p>
<p>  public void shouldMilkTheCow() {</p>
<p>    // Given a repository which knows about one cow<br />
    var shed = Create.TestObjectFor<cowrepository>();<br />
    var daisy = Create.TestObjectFor<cow>();</p>
<p>    Given.That(shed).getCowByName("Daisy").Is(daisy);</p>
<p>    // Given a cowhand who knows where the cows are kept<br />
    var cowhand = new Cowhand(shed);</p>
<p>    // When I ask the cowhand to milk the cow<br />
    cowhand.milkCow("Daisy");</p>
<p>    // Then the cow should have been milked<br />
    Then.Should(daisy).milk();<br />
  }<br />
}<br />
</cow></cowrepository></code></p>
<p>cheers<br />
mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel Schenker</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1310</link>
		<dc:creator>Gabriel Schenker</dc:creator>
		<pubDate>Wed, 10 Dec 2008 10:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1310</guid>
		<description>uuups, my angle brackets in the code have been eaten! Should be 

ICowRepository shed = MockRepository.CreateMock&lt;ICowRepository&gt;();
Cow daisy = MockRepository.CreateMock&lt;Cow&gt;();

&lt;em&gt;Fixed - I love that I can do that in Wordpress! - Liz&lt;/em&gt;

</description>
		<content:encoded><![CDATA[<p>uuups, my angle brackets in the code have been eaten! Should be </p>
<p>ICowRepository shed = MockRepository.CreateMock&lt;ICowRepository&gt;();<br />
Cow daisy = MockRepository.CreateMock&lt;Cow&gt;();</p>
<p><em>Fixed &#8211; I love that I can do that in Wordpress! &#8211; Liz</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel Schenker</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1309</link>
		<dc:creator>Gabriel Schenker</dc:creator>
		<pubDate>Wed, 10 Dec 2008 09:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1309</guid>
		<description>Liz, thanks a lot for all of your very insightful postings here and in the BDD mailing list! I tried to write down your sample for C# and Rhino.Mocks

&lt;code&gt;
[TestFixutre]
public class CowhandTest {
  [Test]
  public void shouldMilkTheCow() {

    // Given a repository which knows about one cow
    ICowRepository shed = MockRepository.CreateMock&lt;ICowRepository&gt;();
    Cow daisy = MockRepository.CreateMock&lt;Cow&gt;();
    shed.Stub(x=&gt;x.getCowByName(&quot;Daisy&quot;)).Return(daisy);

    // Given a cowhand who knows where the cows are kept
    Cowhand cowhand = new Cowhand(shed);

    // When I ask the cowhand to milk the cow
    cowhand.milkCow(&quot;Daisy&quot;);

    // Then the cow should have been milked
    daisy.AssertWasCalled(x=&gt;x.milk());
  }
}
&lt;/code&gt;

I try to even re-arrange my test further like this (gives me a clearer separation of concerns)

&lt;code&gt;
[TestFixture]
public class CowhandTest : SpecificationBase
{
  protected override void Context() {
    // Given a repository which knows about one cow
    ICowRepository shed = MockRepository.CreateMock&lt;ICowRepository&gt;();
    Cow daisy = MockRepository.CreateMock&lt;Cow&gt;();
    shed.Stub(x=&gt;x.getCowByName(&quot;Daisy&quot;)).Return(daisy);

    // Given a cowhand who knows where the cows are kept
    Cowhand cowhand = new Cowhand(shed);
  }
  
  protected override void Because() {
    // When I ask the cowhand to milk the cow
    cowhand.milkCow(&quot;Daisy&quot;);
  }
  
  [Test]
  public void shouldMilkTheCow() {
    // Then the cow should have been milked
    daisy.AssertWasCalled(x=&gt;x.milk());
  }
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Liz, thanks a lot for all of your very insightful postings here and in the BDD mailing list! I tried to write down your sample for C# and Rhino.Mocks</p>
<p><code><br />
[TestFixutre]<br />
public class CowhandTest {<br />
  [Test]<br />
  public void shouldMilkTheCow() {</p>
<p>    // Given a repository which knows about one cow<br />
    ICowRepository shed = MockRepository.CreateMock<icowrepository>();<br />
    Cow daisy = MockRepository.CreateMock<cow>();<br />
    shed.Stub(x=>x.getCowByName("Daisy")).Return(daisy);</p>
<p>    // Given a cowhand who knows where the cows are kept<br />
    Cowhand cowhand = new Cowhand(shed);</p>
<p>    // When I ask the cowhand to milk the cow<br />
    cowhand.milkCow("Daisy");</p>
<p>    // Then the cow should have been milked<br />
    daisy.AssertWasCalled(x=>x.milk());<br />
  }<br />
}<br />
</cow></icowrepository></code></p>
<p>I try to even re-arrange my test further like this (gives me a clearer separation of concerns)</p>
<p><code><br />
[TestFixture]<br />
public class CowhandTest : SpecificationBase<br />
{<br />
  protected override void Context() {<br />
    // Given a repository which knows about one cow<br />
    ICowRepository shed = MockRepository.CreateMock<icowrepository>();<br />
    Cow daisy = MockRepository.CreateMock<cow>();<br />
    shed.Stub(x=>x.getCowByName("Daisy")).Return(daisy);</p>
<p>    // Given a cowhand who knows where the cows are kept<br />
    Cowhand cowhand = new Cowhand(shed);<br />
  }</p>
<p>  protected override void Because() {<br />
    // When I ask the cowhand to milk the cow<br />
    cowhand.milkCow("Daisy");<br />
  }</p>
<p>  [Test]<br />
  public void shouldMilkTheCow() {<br />
    // Then the cow should have been milked<br />
    daisy.AssertWasCalled(x=>x.milk());<br />
  }<br />
}<br />
</cow></icowrepository></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tore Vestues</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1308</link>
		<dc:creator>Tore Vestues</dc:creator>
		<pubDate>Wed, 10 Dec 2008 09:19:04 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1308</guid>
		<description>Great! 

I guess this post was triggered by my questions on BDD and DDD posted here: http://groups.google.com/group/behaviordrivendevelopment/browse_thread/thread/90e864e69c2e72ef

This post puts it all together for me. Thank you for taking the time to explain this.

Now I see that BDD and DDD works nice together.

- Tore Vestues</description>
		<content:encoded><![CDATA[<p>Great! </p>
<p>I guess this post was triggered by my questions on BDD and DDD posted here: <a href="http://groups.google.com/group/behaviordrivendevelopment/browse_thread/thread/90e864e69c2e72ef" rel="nofollow">http://groups.google.com/group/behaviordrivendevelopment/browse_thread/thread/90e864e69c2e72ef</a></p>
<p>This post puts it all together for me. Thank you for taking the time to explain this.</p>
<p>Now I see that BDD and DDD works nice together.</p>
<p>- Tore Vestues</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olof Bjarnason</title>
		<link>http://lizkeogh.com/2008/12/10/given-when-then-and-examples-for-classes/comment-page-1/#comment-1307</link>
		<dc:creator>Olof Bjarnason</dc:creator>
		<pubDate>Wed, 10 Dec 2008 08:14:30 +0000</pubDate>
		<guid isPermaLink="false">http://lizkeogh.com/?p=393#comment-1307</guid>
		<description>Liz;

Could you please translate this to some less-abstract example than milking cows using software..? I just don&#039;t understand what your SUT is all about.

Maybe something including login-logic or some other more day-to-day software example.</description>
		<content:encoded><![CDATA[<p>Liz;</p>
<p>Could you please translate this to some less-abstract example than milking cows using software..? I just don&#8217;t understand what your SUT is all about.</p>
<p>Maybe something including login-logic or some other more day-to-day software example.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

