Skip to content

Instantly share code, notes, and snippets.

@cobysy
Created June 26, 2017 00:28
Show Gist options
  • Save cobysy/e8696e65617f24dd1ec3f24c69496076 to your computer and use it in GitHub Desktop.
Save cobysy/e8696e65617f24dd1ec3f24c69496076 to your computer and use it in GitHub Desktop.
AutoFixture notes
// In order to inject dependencies through constructor parameters,
// use greedy constructor selection (versus modest constructor query/ModestConstructorQuery)
// http://blog.ploeh.dk/2011/04/19/ConstructorstrategiesforAutoFixture/
//
// OmitAutoProperties to stop it from mocking out properties
// See https://github.com/AutoFixture/AutoFixture/issues/320 for combo of GreedyConstructorQuery and OmitAutoProperties
AutoFixture.Customize<T>(c => c.FromFactory(new MethodInvoker(new GreedyConstructorQuery())).OmitAutoProperties());
// Trace construction of objects
AutoFixture.Behaviors.Add(new TracingBehavior());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment