Skip to content
antonmajuPublic

About

Dummy object generator

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NDummy

NDummy is a .NET portable class library for generating object by spec.

Build status

##Installation##

To install NDummy, run the following command in the Package Manager Console

PM> Install-Package NDummy

##Usage ##

  • Create spec for classes you want to generate
    public class WarriorSpec : FactorySpec<Warrior>
    {
        public WarriorSpec()
        {
            ConfigureProperties(
               For(n =>n.Name).GenerateWith(ctx =>"Name-"+ctx.Index),
    		   For(n =>n.Hp).GenerateWith(100) 	
              );
        }
    }
    
  • Register specs
    var config = new FactoriesConfig()
    	.Register<Warrior, WarriorSpec>()
    	.Register<Weapon, WeaponSpec>();
    
    var manager = new FactoryManager(config);
    
  • Get factory
    var factory = manager.GetFactory<Warrior>();
    var newInstance = factory.Create(); //create new Warrior instance 
    
  • Please visit wiki for more information.

About

Dummy object generator

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages