Skip to content
A .NET implementation of Thoughtbot's factory_girl for Ruby
C# Shell
Find file
New pull request


Minimal implementation of Ruby's factory_girl in .NET. If you are familiar with factory_girl in Ruby, we only support defining factories and building objects using those factories. We do not support create (e.g. saving to the database), attributes_for, or build_stubbed yet.

To define a factory:

FactoryGirl.Define(() => new User {
                              FirstName = "John",
                              LastName = "Doe",
                              Admin = false

To use a factory:

var user = FactoryGirl.Build<User>();

To customize the object being built:

var admin = FactoryGirl.Build<User>(x => x.Admin = true);

Copyright © 2012 James Kovacs

Something went wrong with that request. Please try again.