Sometimes you might want to set up rules for sample items that will be generated later. One reason for this might be to stub out a method that creates different items with each call.

// Somewhere in startup

          .For(x => x.Property).Use("Value");

// Elsewhere in code


You can also hold a reference to the setup options if you don't want to go via the static accessor.

var myClassOptions = Fabricator.Setup<MyClass>()
                               .For(x => x.Property).Use("Value");

var sampleItems = myClassOptions.Generate(10);

Last edited Oct 24, 2010 at 9:27 AM by JRoughan, version 1


No comments yet.