Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 934 Bytes

README.markdown

File metadata and controls

39 lines (24 loc) · 934 Bytes

FactoryPlus

Introduction

FactoryPlus is a library for creating objects used in testing in .NET programs. It serves as an implementation of the Object Mother pattern.

FactoryPlus is inspired by factory_girl, but aims for simplicity with a small subset of useful features.

Basic Usage

Define how to create an object

Factory.Define(() => new User() { Name = "Test" });

Create an object

User user = Factory.Get<User>();

Create many objects

IList<User> users = Factory.GetMany<User>(100);

Named instances

Factory.Define("adminUser", () => new User() { Name = "Test", Role = Roles.Admin });
User user = Factory.Get<User>("adminUser"); 

License

FactoryPlus is licensed under the MIT License.