Shouldly - Presentation slides

28 views
Skip to first unread message

Uri Goldstein

unread,
May 18, 2015, 2:37:11 PM5/18/15
to altnet...@googlegroups.com
Hi Everyone,

Thanks for attending today's session. Here are the slides: http://www.slideshare.net/UriGoldstein2/shouldly .

Here's a link to Fluent Assertions which we also mentioned: https://github.com/dennisdoomen/FluentAssertions .

And please do visit Up For Grabs: http://www.up-for-grabs.net .



Cheers,
Uri (@urig)

Ken Egozi

unread,
May 18, 2015, 2:46:41 PM5/18/15
to altnet...@googlegroups.com
Thanks for sharing the session and accompanying links so quickly.

Personally I'm not crazy about the fluent syntax (extension methods on objects), but I like the useful methods, and *love* the readability part!


Would probably look into using it next time I'm doing anything with .NET


--
You received this message because you are subscribed to the Google Groups "altnetisrael" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altnetisrael...@googlegroups.com.
To post to this group, send email to altnet...@googlegroups.com.
Visit this group at http://groups.google.com/group/altnetisrael.
For more options, visit https://groups.google.com/d/optout.

Igal Tabachnik

unread,
May 18, 2015, 2:47:50 PM5/18/15
to altnet...@googlegroups.com

Couldn't be there today, but I hope your presentation chucked a wobbly :)

E Rudavsky

unread,
May 18, 2015, 5:47:50 PM5/18/15
to altnet...@googlegroups.com
Great talk!

For anybody wondering how does it resolve all the names for its error messages, it's by walking up the stack and then reading the actual source code lines.

Here's a short snippet from https://github.com/dahvyd/shouldly-1/blob/master/src/Shouldly/ShouldlyMessage.cs:
private static string GenerateShouldMessage(object actual, object expected)
{
 
var environment = GetStackFrameForOriginatingTestMethod();
 
var codePart = "The provided expression";

 
if (environment.DeterminedOriginatingFrame)
 
{
   
var possibleCodeLines = File.ReadAllLines(environment.FileName)
                                           
.Skip(environment.LineNumber).ToArray();

   
var codeLines = possibleCodeLines.DelimitWith("\n");

   
var shouldMethodIndex = codeLines.IndexOf(environment.ShouldMethod);
    codePart
= shouldMethodIndex > -1 ?
                    codeLines
.Substring(0, shouldMethodIndex - 1).Trim() :
                    possibleCodeLines
[0];
 
}

   
return CreateActualVsExpectedMessage(actual, expected, environment, codePart);
}


Uri Goldstein

unread,
May 19, 2015, 10:50:34 AM5/19/15
to altnet...@googlegroups.com
Thanks Ken. Missed you at the event :)

This might be a good opportunity to start an elaborate and verbose religious war for and against fluent interfaces.

What is it about fluent interfaces that you dislike? Is it the static methods?


Cheers,
Uri
Reply all
Reply to author
Forward
0 new messages