Skip to content

Instantly share code, notes, and snippets.

@kmorcinek
Last active August 29, 2015 14:23
Show Gist options
  • Save kmorcinek/46e02fbd2e29bfaf5bc5 to your computer and use it in GitHub Desktop.
Save kmorcinek/46e02fbd2e29bfaf5bc5 to your computer and use it in GitHub Desktop.
Autofixture stuff
http://stackoverflow.com/questions/10032535/can-autofixture-execute-a-delegate-at-object-creation-time?rq=1 :
fixture.Customize<MyClass>(c => c.Without(x => x.SomeWeirdText));
public static ObjectBuilder<User> BuildUser(this Fixture f)
{
return f.Build<User>().With(u => u.IsDeleted, false); // Probably you do not want code like this, explanation in above link.
}
http://megakemp.com/2013/04/16/general-purpose-customizations-with-autofixture/ :
CookbookAutoDataAttribute
Use:
[Test]
[AutoData]
instead of:
[Test, AutoData]
When more attributes will come (i.e. from CodeAnalysis SupressMessages) they will use current convention and first one is clearer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment