Sunday, December 27, 2009

Argument validation in FakeItEasy

I created two more screencasts on FakeItEasy, these two are on the subject on argument validation, I’ve increased the font size and put some compressor on the audio to improve the quality a bit.

 

Saturday, December 26, 2009

The basics of FakeItEasy

I thought I’d take a stab at screencasts so here’s my first attempt, it’s a quick overview of the FakeItEasy framework:

(I would highly recommend that you watch it in HD-quality, otherwise the text will not be readable.)

Saturday, December 19, 2009

Configuring any call to an object

I’ve just updated the way to configure any call to faked objects in FakeItEasy, the syntax is new and also you can now configure return values.

Let’s say you have an interface providing localized text resources like this:

public interface ILocalizedResources
{
    string SomeText { get; }
    string SomeOtherText { get; }
}

When you fake this interface any of the properties would return null when not configured but you might have several tests that are dependant on that the values are non null strings but still you don’t want to have to configure each individual property in the set up of you fixture. Now you can do exactly that:

var resources = A.Fake<ILocalizedResources>();
Any.CallTo(resources).WithReturnType<string>().Returns("");

Of course you can still configure any call to do anything you want just as before, for example:

var resources = A.Fake<ILocalizedResources>();
Any.CallTo(resources).Throws(new Exception());

 

Technorati-taggar: ,,,,,,

Thursday, December 10, 2009

T4

No, not that crappy movie but Text Template Transformation Toolkit.

I’ve played around with T4 every now and then over the last year but I’ve struggled to find any really good source for learning more. I guess the man who stands out from the crowd is Oleg Sych who has blogged about it en masse.

I’m watching a new screen cast by him on Channel 9 right now and it’s really good so please check it out.