Snippets for FakeItEasy in SideWaffle

The SideWaffle extension adds a bunch of useful Snippets, Project- and Item Templates to Visual Studio, which you download through "Extensions and Updates..." under Tools in Visual Studio.

It includes eight code snippets for FakeItEasy. Use them by writing snippet shortcut + Tab, for example afake + Tab.


Shortcut: afake

var fake = A.Fake<ITypeToFake>();

Fake - Strict

Shortcut: afakestrict

var fake = A.Fake<ITypeToFake>(x => x.Strict());

Call To

Shortcut: acall

A.CallTo(() => fake.Method()).Returns("something");

Call To - Must Have Happened One Or More Times

Shortcut: acallmust

A.CallTo(() => fake.Method()).MustHaveHappened();

Call To - Must Have Happened Exactly Once

Shortcut: acallmust1

A.CallTo(() => fake.Method()).MustHaveHappenedOnceExactly();

Call To - Must Have Happened Exactly Twice

Shortcut: acallmust2

A.CallTo(() => fake.Method()).MustHaveHappenedTwiceExactly();

Call To - Must Have Happened Exactly Times

Shortcut: acallmustx

A.CallTo(() => fake.Method()).MustHaveHappened(3, Times.Exactly);

Call To - Must Not Have Happened

Shortcut: acallmustnot

A.CallTo(() => fake.Method()).MustNotHaveHappened();