Ejemplo n.º 1
0
        public async Task WriteCsvFile()
        {
            await using var fileStream = new FileStream(_tempFilePath, FileMode.Create);
            await using var fileWriter = new StreamWriter(fileStream);

            for (var i = 0; i < LineCount; i++)
            {
                await fileWriter.WriteAsync(Line);
            }

            var stateMachine = new TokenizerStateMachine(StateHolder.DefaultConfiguration);

            _tokenizer = new StateMachineTokenizer(stateMachine);

            var map = new ColumnMapBuilder <BenchmarkDataClass>()
                      .WithColumn(0, c => c.Field1)
                      .WithColumn(1, c => c.Field2)
                      .WithColumn(2, c => c.Field3)
                      .WithColumn(3, c => c.Field4)
                      .WithColumn(4, c => c.Field5)
                      .WithColumn(5, c => c.Field6)
                      .WithColumn(6, c => c.Field7)
                      .Build();

            _mapper = new MapperFactory <BenchmarkDataClass>(ConverterRegistry.CreateDefaultInstance()).CreateForMap(map);
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            var stateMachine = new TokenizerStateMachine(StateHolder.DefaultConfiguration);

            _tokenizer = new StateMachineTokenizer(stateMachine);

            var map = new ColumnMapBuilder <StatePopulation>()
                      .WithColumn(0, s => s.Name)
                      .WithColumn(1, s => s.Population)
                      .Build();

            _sut = new MapperFactory <StatePopulation>(ConverterRegistry.CreateDefaultInstance()).CreateForMap(map);
        }
Ejemplo n.º 3
0
        private ITokenStreamMapper <T> CreateTokenStreamMapper <T>(IMap <T> map) where T : class
        {
            var tokenStreamMapperFactory = new MapperFactory <T>(ConverterRegistry.CreateDefaultInstance());

            return(tokenStreamMapperFactory.CreateForMap(map));
        }
Ejemplo n.º 4
0
 public void SetUp()
 {
     _sut = new MapperFactory <TestDataClass>(ConverterRegistry.CreateDefaultInstance());
 }