Esempio n. 1
0
        static void Main(string[] args)
        {
            // Required report writer is intialized to be dependency injected
            IReportWriter reportWriter = new ConsoleReportWriter();

            // CSV file path is retrieved through configuration
            string csvPath = ConfigurationManager.AppSettings["CSVLocation"];

            // Required file processor is initialized
            IFileProcessor fileProcessor = new MedianProcessor();

            // load data in to class objects
            FileLoadResult fileLoadResult = fileProcessor.LoadFileData(csvPath);

            if (fileLoadResult == FileLoadResult.Success)
            {
                // process data in the class objects
                fileProcessor.ProcessData();

                // print reports
                fileProcessor.PrintReports(reportWriter);
            }
            else
            {
                Console.WriteLine("Error: " + fileLoadResult.ToString());
            }

            Console.ReadLine();
        }
Esempio n. 2
0
        public void TestRightDataIsFilteredFromSampleFile()
        {
            var rootPath = AppDomain.CurrentDomain.BaseDirectory;

            MedianProcessor fp     = new MedianProcessor();
            var             result = fp.LoadFileData(rootPath);

            Assert.AreEqual(result, FileLoadResult.Success);

            fp.ProcessData();

            Assert.AreEqual(fp.lpFiles[0].LPDataList.Count, 96);
        }