Skip to content

Commit

Permalink
Temporary reverting passing generator locale from outside
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriyIvon committed Feb 28, 2024
1 parent 80b03f4 commit cf2efed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public GeneratorDataSource(string filePath, IDataSourceFactory dataSourceFactory
var optionsDirectory = Path.GetDirectoryName(Path.GetFullPath(filePath));
Directory.SetCurrentDirectory(optionsDirectory);

var faker = !string.IsNullOrEmpty(_options.Locale) ? new Faker(_options.Locale) : new Faker();
//var faker = !string.IsNullOrEmpty(_options.Locale) ? new Faker(_options.Locale) : new Faker();

var generatorFactory = new GeneratorFactory(faker, dataSourceFactory, database);
var generatorFactory = new GeneratorFactory(/*faker, */dataSourceFactory, database);
_generators = _options.Columns
.Select(c => generatorFactory.Create(c.GeneratorOptions))
.ToArray();
Expand Down
4 changes: 2 additions & 2 deletions src/DatabaseBenchmark/Generators/GeneratorFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ public class GeneratorFactory : IGeneratorFactory
private readonly IDatabase _database;
private readonly DataSourceIteratorGeneratorFactory _dataSourceIteratorGeneratorFactory;

public GeneratorFactory(Faker faker, IDataSourceFactory dataSourceFactory, IDatabase database)
public GeneratorFactory(IDataSourceFactory dataSourceFactory, IDatabase database)
{
_dataSourceIteratorGeneratorFactory = new DataSourceIteratorGeneratorFactory(dataSourceFactory);
_database = database;
_faker = faker;
_faker = new Faker(); //TODO: pass faker or a locale from outside
}

public IGenerator Create(IGeneratorOptions options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public RandomValueProviderTests()
_distinctValues = ["One", "Two", "Three", "Four", "Five", "Six", "Seven"];

var columnPropertiesProvider = new TableColumnPropertiesProvider(table);
_randomGeneratorFactory = new GeneratorFactory(null, null, null);
_randomGeneratorFactory = new GeneratorFactory(null, null);
var distinctValuesProvider = Substitute.For<IDistinctValuesProvider>();
distinctValuesProvider.GetDistinctValues(_tableName, _distinctColumnName).Returns(_distinctValues);
_randomValueProvider = new RandomValueProvider(_randomGeneratorFactory, columnPropertiesProvider, distinctValuesProvider);
Expand Down

0 comments on commit cf2efed

Please sign in to comment.