Ejemplo n.º 1
0
        public async Task AnalyzeFile(FileInfo file)
        {
            try{
                var lot = new Lot.Lot(_lotconfiguration, file.Name);

                using (System.IO.StreamReader sr = _streamReader.GetStreamReader(file.FullName))
                {
                    string s;
                    int    currentLine = 0;
                    while ((s = sr.ReadLine()) != null)
                    {
                        //We need to abstract this information to handle better and log if some information is not correct.
                        try{
                            lot.AddData(s);
                        }catch (System.Exception e) {
                            _logger.Warning("Problem in line " + currentLine + " in the lot " + file.Name + " : " + e.Message);
                        }

                        currentLine++;
                    }
                }

                await _reportGeneratorService.GenerateReport(lot);
            }catch (IOException e) {
                _logger.Warning("Error ocurred when opening lot:" + e.Message);
                throw e;
            }
        }
Ejemplo n.º 2
0
        public void GenerateReport_WhenCorrectLot_GenerateCorrectString()
        {
            //Arrange
            var lot = new SalesProcessor.Domain.Lot.Lot(new LotSettings()
            {
                recordSeparator = "ç"
            }, "Test");

            //Act
            _sut.GenerateReport(lot);

            //Assert
            _fileGenerator.Verify(x => x.GenerateFile(It.IsAny <string>(), It.IsAny <string>()));
        }
Ejemplo n.º 3
0
 public ActionResult FullReport(string websiteUrl)
 {
     if (!String.IsNullOrEmpty(websiteUrl))
     {
         try
         {
             var reportModel = m_ReportGeneratorService.GenerateReport(SanitizeUrl(websiteUrl));
             return(View("FullReport", reportModel));
         }
         catch (Exception exception)
         {
             return(RedirectToAction("Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index"));
     }
 }