Exemplo n.º 1
0
        static void Main(string[] args)
        {
            RegisterServices();

            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", true, true)
                                    .Build();

            var filesPath = config["path"];
            var filter    = config["filter"];

            try
            {
                var fileNames = _fileEnumerator.GetFileNames(filesPath, filter);
                var lines     = _csvProcessor.ProcessFiles(fileNames);

                lines.ToList().ForEach(Console.WriteLine);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Exemplo n.º 2
0
        public void ProcessFiles_ShouldFindOneLine()
        {
            // Arrange
            var expected = 1;

            // Act
            var fileNames = _fileEnumerator.GetFileNames(location, filter);
            var lines     = _csvProcessor.ProcessFiles(fileNames);
            var actual    = lines.Count();

            // Assert
            Assert.Equal(expected, actual);
        }