Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Shouldly testing library

X-BeenThere: altnetseattle@googlegroups.com
Received: by 10.114.214.33 with SMTP id m33ls1139203wag.0.p; Tue, 09 Feb 2010 
	08:50:29 -0800 (PST)
Received: by 10.114.188.40 with SMTP id l40mr718564waf.21.1265734222450;
        Tue, 09 Feb 2010 08:50:22 -0800 (PST)
Received: by 10.114.188.40 with SMTP id l40mr718563waf.21.1265734222371;
        Tue, 09 Feb 2010 08:50:22 -0800 (PST)
Return-Path: <neal.sh...@gmail.com>
Received: from mail-iw0-f183.google.com (mail-iw0-f183.google.com [209.85.223.183])
        by gmr-mx.google.com with ESMTP id 18si61399pzk.13.2010.02.09.08.50.21;
        Tue, 09 Feb 2010 08:50:21 -0800 (PST)
Received-SPF: pass (google.com: domain of neal.sh...@gmail.com designates 209.85.223.183 as permitted sender) client-ip=209.85.223.183;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of neal.sh...@gmail.com designates 209.85.223.183 as permitted sender) smtp.mail=neal.sh...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by iwn13 with SMTP id 13so8294610iwn.25
        for <altnetseattle@googlegroups.com>; Tue, 09 Feb 2010 08:50:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:mime-version:received:in-reply-to:references
         :date:message-id:subject:from:to:content-type;
        bh=nSIHR9qqgodse/UkV19yzwVUGYCVJTRfREg+gFz3UB4=;
        b=THll7npn+/A8C5JHgC5en/n9PBXKDcSu/BZBrx3yXUjzh278vlze82lF7myjdhusIA
         Ao4nnTgBl7xEtX75EW+gWOxVJs2KBo+wRpPNf0CO5aNbsWLc3jfG2a1+9dIVL5rTYCaV
         S0lkhvaYER2HWySACQaTD5I6Dj/rjSv/qhks0=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        b=UqmkngGo2OwW3BFzHqNfJ6+c9CEbeDdYoIuF8zEQq8L2WRom8SYvh3kUbg9MhJN4hg
         3wu1PZFDNwJhBqoN3kBeR/oA5CcIOR+plcrbfWCKFrdGSdzgJRJge7NcVTuVo8WjK6Be
         iJuSP6Kp8rGXFBG1o4TLOVwgsjjCjdkKbWWAM=
MIME-Version: 1.0
Received: by 10.231.150.74 with SMTP id x10mr47855ibv.97.1265734215823; Tue, 
	09 Feb 2010 08:50:15 -0800 (PST)
In-Reply-To: <4b0258d71002090434s1c2c1516id1fcbbaa0fdf9...@mail.gmail.com>
References: <0b315092-b2a1-41c5-8ab4-f0fbc3d70...@s25g2000prd.googlegroups.com>
	 <00da01caa94e$44988570$7c1f670a@ferrari>
	 <4b0258d71002082226k2f78e83fx6ee927027a12f...@mail.gmail.com>
	 <2f24adcf1002090349x5e9d6d1bwed1ee4a410469...@mail.gmail.com>
	 <45FB7197-F96F-4874-A73A-737FE2E83...@gmail.com>
	 <4b0258d71002090434s1c2c1516id1fcbbaa0fdf9...@mail.gmail.com>
Date: Tue, 9 Feb 2010 08:50:15 -0800
Message-ID: <7d4858e81002090850h39f189f7t5dc81deff12ce...@mail.gmail.com>
Subject: Re: Shouldly testing library
From: Shawn Neal <neal.sh...@gmail.com>
To: altnetseattle@googlegroups.com
Content-Type: multipart/alternative; boundary=0016e68dd282507383047f2db6ce

--0016e68dd282507383047f2db6ce
Content-Type: text/plain; charset=ISO-8859-1

You could get access to the AST if you used an Expression<T>, but it doesn't
allow for the easier reading Should() extension method syntax.

[Test]
public void Shoudly()
{
    int points = 1445;

    // Message is: Expected: 333  But was:  1445
    //Assert.That(() => points, Is.EqualTo(333));

    // Message is: points should be <equal 333> but was 1445
    AssertEx.That(() => points, Is.EqualTo(333));
}

public static class AssertEx
{
    public static void That<T>(Expression<Func<T>> expression,
EqualConstraint equalTo)
    {
        T val = expression.Compile().Invoke();
        if (!equalTo.Matches(val))
        {
            throw new Exception(
                string.Format(
                    "{0} should be {1} but was {2}",
                    GetParamName(expression),
                    equalTo,
                    val));
        }
    }


    private static string GetParamName<T>(Expression<Func<T>> expression)
    {
        var memberExpression = expression.Body as MemberExpression;
        if (memberExpression != null)
        {
            return memberExpression.Member.Name;
        }
        return "";
    }
}

On Tue, Feb 9, 2010 at 4:34 AM, Dave Newman <ddanger...@gmail.com> wrote:

> It's just more context. Especially when you get a failing test in CI if
> you've got:
>     Expected "Hungry" but was "Shuffling aimlessly"
>
> then you have to do a bit of investigation (maybe you have several
> "asserts" in one test, shocking I know :)
>
> but if you had
> zombie.Mood should be "Hungry" but was "Shuffling aimlessly"
>
> you can narrow in a bit quicker. Also the ability to do easy IEnumerable
> asserts:
>
>     myArray.ShouldBe(1,2,3)
>
> this will give you:
>
>     myArray should be [1,2,3] but was [2,3,4]
>
> which is nice
>
> On Tue, Feb 9, 2010 at 10:54 PM, David Foley <davidmfo...@gmail.com>wrote:
>
>> On parsing the source code, or even reflecting... I'm curious: what is the
>> benefit of this?
>> It seems like "expected Foo but got Bar", combined with the name of the
>> test that is failing, is sufficient.
>>
>>
>> On Feb 9, 2010, at 7:49 PM, Erick Thompson wrote:
>>
>> Dave,
>>
>> Instead of parsing source code, is there any reason you would use reflect
>> to inspect the stack? That should give you the funciton entry point without
>> having to need access to the source code (however, the source code includes
>> goodies like comments and such).
>>
>> Erick
>>
>> On Mon, Feb 8, 2010 at 10:26 PM, Dave Newman <ddanger...@gmail.com>wrote:
>>
>>> Hey Charlie,
>>>
>>> I'm happy to contribute patches to NUnit! At the moment I'm experimenting
>>> with syntax and I make some assumptions that I'm not sure the majority will
>>> agree with.
>>>
>>> It's definitely less flexible than the current Assert.That and involves
>>> mixing methods into Object something like:
>>>
>>>  public static void ShouldBe(this object actual, object expected)
>>> {
>>>     Assert.That(actual, Is.EqualTo(expected));
>>> }
>>>
>>> If you're happy to have that in nUnit I can create a patch with:
>>>
>>> ShouldBe
>>> ShouldNotBe
>>>  ShouldBeGreaterThan
>>> ShouldBeLessThan
>>> ShouldContain
>>> ShouldNotContain
>>>
>>> etc.
>>>
>>> On the contextual error messages though, I'm pretty sure people won't
>>> want that in nUnit core as it involves parsing the code file that was
>>> compiled into the running test. In the future I'll also be evaluating
>>> variables on the stack. These kinds of things are only for those with strong
>>> stomachs and loose morals!
>>>
>>> Just as an aside, contributing to nUnit would be much easier if it was on
>>> github ; )
>>>
>>> On Tue, Feb 9, 2010 at 5:08 PM, Charlie Poole <char...@nunit.com> wrote:
>>>
>>>> Hi Dave,
>>>>
>>>> It's cool...
>>>>
>>>> but how come you aren't involved in helping us get this sort of
>>>> syntax into NUnit? *
>>>>
>>>> Charlie
>>>>
>>>> * which we are doing, but maybe it will be less cool without you!
>>>>
>>>> > -----Original Message-----
>>>> > From: altnetseattle@googlegroups.com
>>>> > [mailto:altnetseattle@googlegroups.com] On Behalf Of Dave Newman
>>>> > Sent: Monday, February 08, 2010 6:14 PM
>>>> > To: Seattle area Alt.Net
>>>> > Subject: Shouldly testing library
>>>> >
>>>> > Hey Guys,
>>>> >
>>>> > I'm playing around with a new "should" style of testing with
>>>> > a focus on better error messages. Or error messages with context!
>>>> > It's based on NUnit and RhinoMocks, so for comparison this is
>>>> > the current Assert way:
>>>> >
>>>> >     Assert.That(contestant.Points, Is.EqualTo(1337));
>>>> >
>>>> > For your troubles, you get this message, when it fails:
>>>> >
>>>> >     Expected 1337 but was 0
>>>> >
>>>> > With Shouldly:
>>>> >
>>>> >     contestant.Points.ShouldBe(1337);
>>>> >
>>>> > Which is just syntax, so far, but the message when it fails:
>>>> >
>>>> >     contestant.Points should be 1337 but was 0
>>>> >
>>>> > It might be easy to underestimate how useful this is. Another
>>>> > example, side by side:
>>>> >
>>>> >     Assert.That(map.IndexOfValue("boo"), Is.EqualTo(2));    // ->
>>>> > Expected 2 but was 1
>>>> >     map.IndexOfValue("boo").ShouldBe(2);                    // ->
>>>> > map.IndexOfValue("boo") should be 2 but was 1
>>>> >
>>>> > Shouldly uses the source code at the ShouldBe statement to
>>>> > report on errors, which makes diagnosing easier.
>>>> >
>>>> > With RhinoMocks, it gives clearer messages about expectation failures.
>>>> > Here's the message without Shouldly:
>>>> >
>>>> >     Rhino.Mocks.Exceptions.ExpectationViolationException:
>>>> >     IContestant.PlayGame("Shouldly"); Expected #1, Actual #0
>>>> >
>>>> > Shouldly's message:
>>>> >
>>>> >     Expected:
>>>> >         IContestant.PlayGame("Shouldly");
>>>> >     Recorded:
>>>> >         IContestant.PlayGame("Debugging");
>>>> >         IContestant.PlayGame("Logging");
>>>> >         IContestant.PlayGame("Drinking coffee");
>>>> >         IContestant.PlayGame("Commenting out test");
>>>> >
>>>> > More at: http://snappyco.de/articles/2010-02-02-shouldly
>>>> > Source at: http://github.com/snappycode/shouldly
>>>> >
>>>> > Hit me up for any questions, feature requests or even better fork it!
>>>> >
>>>> > --
>>>> > You received this message because you are subscribed to the
>>>> > Google Groups "Seattle area Alt.Net" group.
>>>> > To post to this group, send email to altnetseattle@googlegroups.com.
>>>> > To unsubscribe from this group, send email to
>>>> > altnetseattle+unsubscribe@googlegroups.com<altnetseattle%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> > For more options, visit this group at
>>>> > http://groups.google.com/group/altnetseattle?hl=en.
>>>> >
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Seattle area Alt.Net" group.
>>>> To post to this group, send email to altnetseattle@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> altnetseattle+unsubscribe@googlegroups.com<altnetseattle%2Bunsubscribe@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/altnetseattle?hl=en.
>>>>
>>>>
>>>
>>>
>>> --
>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>> Dave Newman | @whatupdave | http://snappyco.de
>>>
>>> --
>>>  You received this message because you are subscribed to the Google
>>> Groups "Seattle area Alt.Net" group.
>>> To post to this group, send email to altnetseattle@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> altnetseattle+unsubscribe@googlegroups.com<altnetseattle%2Bunsubscribe@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/altnetseattle?hl=en.
>>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Seattle area Alt.Net" group.
>> To post to this group, send email to altnetseattle@googlegroups.com.
>> To unsubscribe from this group, send email to
>> altnetseattle+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/altnetseattle?hl=en.
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Seattle area Alt.Net" group.
>> To post to this group, send email to altnetseattle@googlegroups.com.
>> To unsubscribe from this group, send email to
>> altnetseattle+unsubscribe@googlegroups.com<altnetseattle%2Bunsubscribe@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/altnetseattle?hl=en.
>>
>
>
>
> --
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Dave Newman | @whatupdave | http://snappyco.de
>
> --
> You received this message because you are subscribed to the Google Groups
> "Seattle area Alt.Net" group.
> To post to this group, send email to altnetseattle@googlegroups.com.
> To unsubscribe from this group, send email to
> altnetseattle+unsubscribe@googlegroups.com<altnetseattle%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/altnetseattle?hl=en.
>

--0016e68dd282507383047f2db6ce
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

You could get access to the AST if you used an Expression&lt;T&gt;, but it =
doesn&#39;t allow for the easier reading Should() extension method syntax.<=
div><br></div><div><div>[Test]</div><div>public void Shoudly()</div><div>
{</div><div>=A0=A0 =A0int points =3D 1445;</div><div><br></div><div>=A0=A0 =
=A0// Message is:=A0Expected:=A0333=A0=A0But=A0was:=A0=A01445</div><div>=A0=
=A0 =A0//Assert.That(() =3D&gt; points, Is.EqualTo(333));</div><div><br></d=
iv><div>=A0=A0 =A0// Message is: points should be &lt;equal 333&gt; but was=
 1445</div>
<div>=A0=A0 =A0AssertEx.That(() =3D&gt; points, Is.EqualTo(333));</div><div=
>}</div></div><div><br></div><div><div><div>public static class AssertEx</d=
iv><div>{</div><div>=A0=A0 =A0public static void That&lt;T&gt;(Expression&l=
t;Func&lt;T&gt;&gt; expression, EqualConstraint equalTo)</div>
<div>=A0=A0 =A0{</div><div>=A0=A0 =A0 =A0 =A0T val =3D expression.Compile()=
.Invoke();</div><div>=A0=A0 =A0 =A0 =A0if (!equalTo.Matches(val))</div><div=
>=A0=A0 =A0 =A0 =A0{</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0throw new Exceptio=
n(</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0string.Format(</div>
<div>=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&quot;{0} should be {1} but =
was {2}&quot;,</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0GetParam=
Name(expression),</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0equal=
To,</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0val)); =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0</div>
<div>=A0=A0 =A0 =A0 =A0}</div><div>=A0=A0 =A0}</div><div><br></div><div><br=
></div><div>=A0=A0 =A0private static string GetParamName&lt;T&gt;(Expressio=
n&lt;Func&lt;T&gt;&gt; expression)</div><div>=A0=A0 =A0{</div><div>=A0=A0 =
=A0 =A0 =A0var memberExpression =3D expression.Body as MemberExpression;</d=
iv>
<div>=A0=A0 =A0 =A0 =A0if (memberExpression !=3D null)</div><div>=A0=A0 =A0=
 =A0 =A0{</div><div>=A0=A0 =A0 =A0 =A0 =A0 =A0return <a href=3D"http://memb=
erExpression.Member.Name">memberExpression.Member.Name</a>;</div><div>=A0=
=A0 =A0 =A0 =A0}</div><div>=A0=A0 =A0 =A0 =A0return &quot;&quot;;</div>
<div>=A0=A0 =A0}</div><div>}</div></div><br><div class=3D"gmail_quote">On T=
ue, Feb 9, 2010 at 4:34 AM, Dave Newman <span dir=3D"ltr">&lt;<a href=3D"ma=
ilto:ddanger...@gmail.com">ddanger...@gmail.com</a>&gt;</span> wrote:<br><b=
lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px =
#ccc solid;padding-left:1ex;">
It&#39;s just more context. Especially when you get a failing test in CI if=
 you&#39;ve got:<div>=A0=A0 =A0Expected &quot;Hungry&quot; but was &quot;Sh=
uffling aimlessly&quot;</div><div><br></div><div>then you have to do a bit =
of investigation (maybe you have several &quot;asserts&quot; in one test, s=
hocking I know :)</div>

<div><br></div><div>but if you had</div><div>zombie.Mood should be &quot;Hu=
ngry&quot; but was &quot;Shuffling aimlessly&quot;</div><div><br></div><div=
>you can narrow in a bit quicker. Also the ability to do easy IEnumerable a=
sserts:</div>

<div><br></div><div>=A0=A0 =A0myArray.ShouldBe(1,2,3)</div><div><br></div><=
div>this will give you:</div><div><br></div><div>=A0=A0 =A0myArray should b=
e [1,2,3] but was [2,3,4]</div><div><br></div><div>which is nice =A0=A0</di=
v><div><div>
</div><div class=3D"h5"><div><br><div class=3D"gmail_quote">
On Tue, Feb 9, 2010 at 10:54 PM, David Foley <span dir=3D"ltr">&lt;<a href=
=3D"mailto:davidmfo...@gmail.com" target=3D"_blank">davidmfo...@gmail.com</=
a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0=
 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style=3D"word-wrap:break-word">On parsing the source code, or even ref=
lecting... I&#39;m curious: what is the benefit of this?=A0<div>It seems li=
ke &quot;expected Foo but got Bar&quot;, combined with the name of the test=
 that is failing, is sufficient.<div>

<div></div><div><div><br><div><br></div><div><div><div>On Feb 9, 2010, at 7=
:49 PM, Erick Thompson wrote:</div><br><blockquote type=3D"cite"><div>Dave,=
</div>
<div>=A0</div>
<div>Instead of parsing source code, is there any reason you would use refl=
ect to inspect the stack? That should give you the funciton entry point wit=
hout having to need access to the source code (however, the source code inc=
ludes goodies like comments and such).</div>



<div>=A0</div>
<div>Erick<br><br></div>
<div class=3D"gmail_quote">On Mon, Feb 8, 2010 at 10:26 PM, Dave Newman <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:ddanger...@gmail.com" target=3D"_blank=
">ddanger...@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style=3D"border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;pa=
dding-left:1ex" class=3D"gmail_quote">Hey Charlie,=20
<div><br></div>
<div>I&#39;m happy to contribute patches to NUnit! At the moment I&#39;m ex=
perimenting with syntax and I make some assumptions that I&#39;m not sure t=
he majority will agree with.=A0</div>
<div><br></div>
<div>It&#39;s definitely less flexible than the current Assert.That and inv=
olves mixing methods into Object something like:</div>
<div><br></div>
<div>
<div>public static void ShouldBe(this object actual, object expected)</div>
<div>{</div>
<div>=A0=A0 =A0Assert.That(actual, Is.EqualTo(expected));</div>
<div>}</div>
<div><br></div></div>
<div>If you&#39;re happy to have that in nUnit I can create a patch with:</=
div>
<div><br></div>
<div><span style=3D"font-family:Monaco, consolas, monospace;white-space:pre=
;color:rgb(51,51,51);font-size:14px"><span style=3D"color:rgb(102,0,102)">S=
houldBe</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"co=
lor:rgb(102,0,102)"><span style=3D"color:rgb(51,51,51)"><span style=3D"colo=
r:rgb(102,0,102)">ShouldNotBe</span><span style=3D"color:rgb(0,0,0)"><br>


</span></span></span></span></div>
<div><span style=3D"font-family:Monaco, consolas, monospace;white-space:pre=
;color:rgb(51,51,51);font-size:14px"><span style=3D"color:rgb(102,0,102)">S=
houldBeGreaterThan</span><span style=3D"color:rgb(0,0,0)"><br></span><span =
style=3D"color:rgb(102,0,102)">ShouldBeLessThan</span><span style=3D"color:=
rgb(0,0,0)"><br>


</span><span style=3D"color:rgb(102,0,102)">ShouldContain</span><span style=
=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,0,102)">Shoul=
dNotContain</span></span></div>
<div><br>
<div class=3D"gmail_quote">etc.</div>
<div class=3D"gmail_quote"><br></div>
<div class=3D"gmail_quote">On the contextual error messages though, I&#39;m=
 pretty sure people won&#39;t want that in nUnit core as it involves parsin=
g the code file that was compiled into the running test. In the future I&#3=
9;ll also be evaluating variables on the stack. These kinds of things are o=
nly for those with strong stomachs and loose morals!</div>



<div class=3D"gmail_quote"><br></div>
<div class=3D"gmail_quote">Just as an aside, contributing to nUnit would be=
 much easier if it was on github ; )</div>
<div>
<div></div>
<div>
<div class=3D"gmail_quote"><br></div>
<div class=3D"gmail_quote">On Tue, Feb 9, 2010 at 5:08 PM, Charlie Poole <s=
pan dir=3D"ltr">&lt;<a href=3D"mailto:char...@nunit.com" target=3D"_blank">=
char...@nunit.com</a>&gt;</span> wrote:<br>
<blockquote style=3D"border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;pa=
dding-left:1ex" class=3D"gmail_quote">Hi Dave,<br><br>It&#39;s cool...<br><=
br>but how come you aren&#39;t involved in helping us get this sort of<br>


syntax into NUnit? *<br><br>Charlie<br><br>* which we are doing, but maybe =
it will be less cool without you!<br>
<div>
<div></div>
<div><br>&gt; -----Original Message-----<br>&gt; From: <a href=3D"mailto:al=
tnetseattle@googlegroups.com" target=3D"_blank">altnetseattle@googlegroups.=
com</a><br>&gt; [mailto:<a href=3D"mailto:altnetseattle@googlegroups.com" t=
arget=3D"_blank">altnetseattle@googlegroups.com</a>] On Behalf Of Dave Newm=
an<br>


&gt; Sent: Monday, February 08, 2010 6:14 PM<br>&gt; To: Seattle area <a hr=
ef=3D"http://Alt.Net" target=3D"_blank">Alt.Net</a><br>&gt; Subject: Should=
ly testing library<br>&gt;<br>&gt; Hey Guys,<br>&gt;<br>&gt; I&#39;m playin=
g around with a new &quot;should&quot; style of testing with<br>


&gt; a focus on better error messages. Or error messages with context!<br>&=
gt; It&#39;s based on NUnit and RhinoMocks, so for comparison this is<br>&g=
t; the current Assert way:<br>&gt;<br>&gt; =A0 =A0 Assert.That(contestant.P=
oints, Is.EqualTo(1337));<br>


&gt;<br>&gt; For your troubles, you get this message, when it fails:<br>&gt=
;<br>&gt; =A0 =A0 Expected 1337 but was 0<br>&gt;<br>&gt; With Shouldly:<br=
>&gt;<br>&gt; =A0 =A0 contestant.Points.ShouldBe(1337);<br>&gt;<br>&gt; Whi=
ch is just syntax, so far, but the message when it fails:<br>


&gt;<br>&gt; =A0 =A0 contestant.Points should be 1337 but was 0<br>&gt;<br>=
&gt; It might be easy to underestimate how useful this is. Another<br>&gt; =
example, side by side:<br>&gt;<br>&gt; =A0 =A0 Assert.That(map.IndexOfValue=
(&quot;boo&quot;), Is.EqualTo(2)); =A0 =A0// -&gt;<br>


&gt; Expected 2 but was 1<br>&gt; =A0 =A0 map.IndexOfValue(&quot;boo&quot;)=
.ShouldBe(2); =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// -&gt;<br>&gt; map.I=
ndexOfValue(&quot;boo&quot;) should be 2 but was 1<br>&gt;<br>&gt; Shouldly=
 uses the source code at the ShouldBe statement to<br>


&gt; report on errors, which makes diagnosing easier.<br>&gt;<br>&gt; With =
RhinoMocks, it gives clearer messages about expectation failures.<br>&gt; H=
ere&#39;s the message without Shouldly:<br>&gt;<br>&gt; =A0 =A0 Rhino.Mocks=
.Exceptions.ExpectationViolationException:<br>


&gt; =A0 =A0 IContestant.PlayGame(&quot;Shouldly&quot;); Expected #1, Actua=
l #0<br>&gt;<br>&gt; Shouldly&#39;s message:<br>&gt;<br>&gt; =A0 =A0 Expect=
ed:<br>&gt; =A0 =A0 =A0 =A0 IContestant.PlayGame(&quot;Shouldly&quot;);<br>=
&gt; =A0 =A0 Recorded:<br>


&gt; =A0 =A0 =A0 =A0 IContestant.PlayGame(&quot;Debugging&quot;);<br>&gt; =
=A0 =A0 =A0 =A0 IContestant.PlayGame(&quot;Logging&quot;);<br>&gt; =A0 =A0 =
=A0 =A0 IContestant.PlayGame(&quot;Drinking coffee&quot;);<br>&gt; =A0 =A0 =
=A0 =A0 IContestant.PlayGame(&quot;Commenting out test&quot;);<br>


&gt;<br>&gt; More at: <a href=3D"http://snappyco.de/articles/2010-02-02-sho=
uldly" target=3D"_blank">http://snappyco.de/articles/2010-02-02-shouldly</a=
><br>&gt; Source at: <a href=3D"http://github.com/snappycode/shouldly" targ=
et=3D"_blank">http://github.com/snappycode/shouldly</a><br>


&gt;<br>&gt; Hit me up for any questions, feature requests or even better f=
ork it!<br>&gt;<br>&gt; --<br>&gt; You received this message because you ar=
e subscribed to the<br>&gt; Google Groups &quot;Seattle area <a href=3D"htt=
p://Alt.Net" target=3D"_blank">Alt.Net</a>&quot; group.<br>


&gt; To post to this group, send email to <a href=3D"mailto:altnetseattle@g=
ooglegroups.com" target=3D"_blank">altnetseattle@googlegroups.com</a>.<br>&=
gt; To unsubscribe from this group, send email to<br>&gt; <a href=3D"mailto=
:altnetseattle%2Bunsubscribe@googlegroups.com" target=3D"_blank">altnetseat=
tle+unsubscribe@googlegroups.com</a>.<br>


&gt; For more options, visit this group at<br>&gt; <a href=3D"http://groups=
.google.com/group/altnetseattle?hl=3Den" target=3D"_blank">http://groups.go=
ogle.com/group/altnetseattle?hl=3Den</a>.<br>&gt;<br>&gt;<br><br><br><br>--=
<br>


You received this message because you are subscribed to the Google Groups &=
quot;Seattle area <a href=3D"http://Alt.Net" target=3D"_blank">Alt.Net</a>&=
quot; group.<br>To post to this group, send email to <a href=3D"mailto:altn=
etseattle@googlegroups.com" target=3D"_blank">altnetseat...@googlegroups.co=
m</a>.<br>


To unsubscribe from this group, send email to <a href=3D"mailto:altnetseatt=
le%2Bunsubscribe@googlegroups.com" target=3D"_blank">altnetseattle+unsubscr=
ibe@googlegroups.com</a>.<br>For more options, visit this group at <a href=
=3D"http://groups.google.com/group/altnetseattle?hl=3Den" target=3D"_blank"=
>http://groups.google.com/group/altnetseattle?hl=3Den</a>.<br>


<br></div></div></blockquote></div><br><br clear=3D"all"><br></div></div>--=
 <br>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - =
- -<br>Dave Newman | @whatupdave | <a href=3D"http://snappyco.de/" target=
=3D"_blank">http://snappyco.de</a><br>


</div><div><br></div>-- <br>
<div>
<div></div>
<div>You received this message because you are subscribed to the Google Gro=
ups &quot;Seattle area <a href=3D"http://Alt.Net" target=3D"_blank">Alt.Net=
</a>&quot; group.<br>To post to this group, send email to <a href=3D"mailto=
:altnetseattle@googlegroups.com" target=3D"_blank">altnetseattle@googlegrou=
ps.com</a>.<br>


To unsubscribe from this group, send email to <a href=3D"mailto:altnetseatt=
le%2Bunsubscribe@googlegroups.com" target=3D"_blank">altnetseattle+unsubscr=
ibe@googlegroups.com</a>.<br>For more options, visit this group at <a href=
=3D"http://groups.google.com/group/altnetseattle?hl=3Den" target=3D"_blank"=
>http://groups.google.com/group/altnetseattle?hl=3Den</a>.<br>


</div></div></blockquote></div><br><div><br></div>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;Seattle area <a href=3D"http://Alt.Net" target=3D"_blank">Alt.Net</a>&=
quot; group.<br>
To post to this group, send email to <a href=3D"mailto:altnetseattle@google=
groups.com" target=3D"_blank">altnetseattle@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:altnetseatt=
le+unsubscribe@googlegroups.com" target=3D"_blank">altnetseattle+unsubscrib=
e@googlegroups.com</a>.<br>

For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/altnetseattle?hl=3Den" target=3D"_blank">http://groups.google.com/grou=
p/altnetseattle?hl=3Den</a>.<br>


</blockquote></div><br></div></div></div></div></div></div>

<p></p>

-- <br><div><div></div><div>
You received this message because you are subscribed to the Google Groups &=
quot;Seattle area Alt.Net&quot; group.<br>
To post to this group, send email to <a href=3D"mailto:altnetseattle@google=
groups.com" target=3D"_blank">altnetseattle@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:altnetseatt=
le%2Bunsubscribe@googlegroups.com" target=3D"_blank">altnetseattle+unsubscr=
ibe@googlegroups.com</a>.<br>

For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/altnetseattle?hl=3Den" target=3D"_blank">http://groups.google.com/grou=
p/altnetseattle?hl=3Den</a>.<br>


</div></div></blockquote></div><br><br clear=3D"all"><br>-- <br>- - - - - -=
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br> Dave New=
man | @whatupdave | <a href=3D"http://snappyco.de" target=3D"_blank">http:/=
/snappyco.de</a><br>


</div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;Seattle area Alt.Net&quot; group.<br>
To post to this group, send email to <a href=3D"mailto:altnetseattle@google=
groups.com" target=3D"_blank">altnetseattle@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:altnetseatt=
le%2Bunsubscribe@googlegroups.com" target=3D"_blank">altnetseattle+unsubscr=
ibe@googlegroups.com</a>.<br>

For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/altnetseattle?hl=3Den" target=3D"_blank">http://groups.google.com/grou=
p/altnetseattle?hl=3Den</a>.<br>


</div></div></blockquote></div><br></div>

--0016e68dd282507383047f2db6ce--