/// <summary>
        /// Get list of customer address from .csv files
        /// </summary>
        /// <returns>List of customer addresse</returns>
        public List <CustomerAddress> GetCustomerAddresses()
        {
            var customerAddresses = new List <CustomerAddress>();
            var rootDirectory     = ConfigurationManager.AppSettings.Get("AssessmentBaseDirectory");
            var files             = _csvFileManager.SearchCSVFile(rootDirectory);

            foreach (var filePath in files)
            {
                if (_csvFileManager.CheckFileSize(filePath))
                {
                    var filecontents = _csvFileManager.ReadCSVFile(filePath);
                    customerAddresses.AddRange(ExtractCustomerAddressFromCsvFile(filecontents));
                }
            }
            return(customerAddresses);
        }
示例#2
0
        public void CheckFileSizeTestMethod()
        {
            var baseDirectory = ConfigurationManager.AppSettings.Get("AssessmentBaseDirectory");

            if (string.IsNullOrEmpty(baseDirectory))
            {
                Assert.Fail();
            }
            var fileName = "SortedAddressesTest.txt";
            var filePath = string.Format(@"{0}\{1}", baseDirectory, fileName);
            var result   = _iCSVFileManager.CheckFileSize(filePath);

            Assert.IsTrue(result || !result, "method _iCSVFileManager.CheckFileSize(filePath) failed");
        }