예제 #1
0
        public async Task <IActionResult> GetLines(GetLines query)
        {
            // Reponse
            var response = await _lineService.GetLines(query);

            // Return
            return(Ok(response));
        }
예제 #2
0
        public async Task <List <Responses.Line> > GetLines(GetLines query)
        {
            // Get all lines
            var lines = await _mainDbContext.Lines.Where(LineExpression.Filter(query.Period, query.CurrencyIds, query.UserIds, query.IndicatorIds)).ToListAsync();

            // Response
            var response = _mapper.Map <List <Responses.Line> >(lines);

            // Return
            return(response);
        }
예제 #3
0
        public void GetLines_ReturnFields()
        {
            List <string> fieldsReturned = new List <string>();

            //readFileResults
            foreach (var result in readFileResults)
            {
                fieldsReturned = GetLines.ReturnFields(result);
                Console.WriteLine(fieldsReturned.Count);
            }
            Assert.IsTrue(fieldsReturned.Count > 2, "Fields are not returned");
        }
예제 #4
0
        public void GetLines_CheckFieldFormat()
        {
            List <string> fieldsReturned = new List <string>();

            foreach (var result in readFileResults)
            {
                fieldsReturned = GetLines.ReturnFields(result);
                Console.WriteLine(fieldsReturned.Count);
                foreach (var fieldReturned in fieldsReturned)
                {
                    var formatted = GetLines.CheckFieldFormat(fieldReturned);
                    Console.WriteLine($"formatted{formatted}");
                }
            }

            Assert.IsTrue(fieldsReturned.Count > 2, "Fields are not returned");
        }
예제 #5
0
 Equal(
     GetLines(expected !),
예제 #6
0
        static void Main(string[] args)
        {
            FileInfo = new FileInformation();


            while (ValueFormatter.isEmpty(FileInfo.InputFileName))
            {
                Out.WriteLine("Please copy and paste file path in .csv or .tsv format");
                FileInfo.InputFileName = ReadLine();
            }

            FileInfo.ReadResults = GetFileName.ReadFileName(FileInfo.InputFileName);



            string numberOfFields = null;
            int    temp2;

            while (ValueFormatter.isEmpty(numberOfFields) || !int.TryParse(numberOfFields, out temp2))
            {
                WriteLine("Enter number of fields");
                numberOfFields = ReadLine();
            }

            int fieldsInRecords = 0;

            try
            {
                fieldsInRecords         = Convert.ToInt32(numberOfFields);
                FileInfo.NumberOfFields = fieldsInRecords;

                FileInfo.Results    = GetLines.ReturnDetailRecords(FileInfo.ReadResults);
                FileInfo.NewResults = FileInfo.Results.Skip(1).ToList();
                char delimiter = GetFileName.CheckFileName(FileInfo.InputFileName);
                //Once you run this, it'll write the files to your bin direcotry
                FileInfo.EnvironmentDirectory = WriteToFile.GetEnvironmentDirectory();

                foreach (var rec in FileInfo.NewResults)
                {
                    var returnedFields  = GetLines.ReturnFields(rec, delimiter);
                    var isRecordCorrect = GetLines.GetFieldCount(returnedFields, fieldsInRecords);
                    if (isRecordCorrect == false)
                    {
                        var pathCombined = Path.Combine(FileInfo.EnvironmentDirectory, "errorrecs.txt");
                        Out.WriteLine($"directory is {pathCombined}");
                        WriteToFile.WriteErrorsToFile(pathCombined, rec);
                    }
                    else
                    {
                        var pathCombined = Path.Combine(FileInfo.EnvironmentDirectory, "correct.txt");
                        Out.WriteLine($"directory is {pathCombined}");
                        WriteToFile.WriteErrorsToFile(pathCombined, rec);
                    }
                }

                Console.WriteLine($"the delimiter is {delimiter}");
                Console.WriteLine(FileInfo.NewResults.Count);
            }
            catch (System.FormatException fe)
            {
                Out.WriteLine($"No fields were read {fe}");
            }

            Console.Out.WriteLine("Bonsoir, Elliot");
            Console.ReadKey();
        }
예제 #7
0
 public void TestInitialize()
 {
     fut             = GetFileName.ReadFileName(@"C:\Temp\TestFile.csv");
     readFileResults = GetLines.ReturnDetailRecords(fut);
 }