6
Vote

Add Because() extension

description

The syntax with the title (or message in MSTest) in the should looks a bit strange to me. In MSTest I get asserts which looks like this:

viewModel.IsBusy.Should("because it should be set to false to indicate that the model is no longer busy").Be.False();

I think it would look better when I could write

viewModel.IsBusy.Should().Be.False().Because("it should be set to false to indicate that the model is no longer busy");

Anybody agree with this, or not?

comments

fabiomaulo wrote Feb 5, 2010 at 11:34 AM

interesting, but for C# reasons should look as
viewModel.IsBusy.Because("the model is no longer busy").Should().Be.False();
and the failure message will look like
true Should Be False. because the model is no longer busy

vansha wrote Mar 20, 2010 at 4:08 PM

I vote too :). Cause this may resolve the problem I've complained in http://sharptestex.codeplex.com/Thread/View.aspx?ThreadId=81812

MattHowells wrote Apr 21, 2010 at 11:51 PM

How about:

Because.It("should be set to false to indicate that the model is no longer busy",
viewModel.IsBusy.Should().Be.False());

citykid wrote Apr 25, 2011 at 5:52 PM

full aggreement, would be nice to see that.