public Faker(FakerConfig config = null, int maxCycle = 5) { this.config = config; MaxCycle = maxCycle; List <TypeInfo> generatorTypes = Assembly.GetExecutingAssembly().DefinedTypes.Where(ti => IsRequiredType(ti, typeof(Generator <>))).ToList(); generatorTypes.ForEach(ti => generators.Add((IGenerator)Activator.CreateInstance(ti.AsType()))); string plugDir = Directory.GetCurrentDirectory() + "/Plugins"; if (Directory.Exists(plugDir)) { var pluginsPaths = Directory.EnumerateFiles(plugDir, "*.dll").ToList(); pluginsPaths.ForEach(path => { Assembly plugin = Assembly.LoadFrom(path); var types = plugin.GetTypes().Where(t => IsRequiredType(t, typeof(Generator <>))).ToList(); types.ForEach(t => generators.Add((IGenerator)Activator.CreateInstance(t))); }); } else { Directory.CreateDirectory(plugDir); } }
public Faker(FakerConfig fakerConfig) { this.config = fakerConfig; this.DTOCallStack = new Stack <object>(); this.config.Configure(this); }
public Faker(FakerConfig config = null) { GeneratorsLoader gl = new GeneratorsLoader(); generators = gl.GetGenerators(); generators.Add(typeof(int), new IntGenerator()); generators.Add(typeof(long), new LongGenerator()); generators.Add(typeof(double), new DoubleGenerator()); generators.Add(typeof(Uri), new UriGenerator()); generators.Add(typeof(char), new CharGenerator()); generators.Add(typeof(string), new StringGenerator()); _config = config; }
public static void AddConfig(FakerConfig config) { faker.AddConfig(config); }
public void AddConfig(FakerConfig config) { this.configs.Add(config); }