コード例 #1
0
        /// <summary>
        /// Output the sorted customer addresses in a .txt file
        /// </summary>
        /// <returns>.txt file</returns>
        public bool CreateSortedCustomerNamesTxtFile()
        {
            var    baseDirectory          = ConfigurationManager.AppSettings.Get("AssessmentBaseDirectory");
            var    contents               = string.Empty;
            string responseFilePath       = string.Format(@"{0}\SortedCustomerNames.txt", baseDirectory);
            var    customerNames          = BreakdownCustomerNames(GetCustomerAddresses());
            var    sortCountCustomerNames = SortCountCustomerNames(customerNames);

            foreach (var line in sortCountCustomerNames)
            {
                contents = contents + string.Format("{0} \n", line);
            }
            return(_csvFileManager.CreateCSVFileContents(responseFilePath, contents));
        }
コード例 #2
0
        public void CreateCSVFileContentsTestMethod()
        {
            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 contents = "Test method for _iCSVFileManager.CreateCSVFileContents(filePath, contents).";
            var result   = _iCSVFileManager.CreateCSVFileContents(filePath, contents);

            Assert.IsTrue(result, "Method _iCSVFileManager.CreateCSVFileContents(filePath, contents) failed");
        }