Пример #1
0
        public void CanDecodeArray()
        {
            const string proper = "Jack,Jane,Jill,Ally";

            byte[] bytes = Encoding.ASCII.GetBytes(proper);

            string test = CSVFileUtil.GetStringFromBytes(bytes);

            Assert.Equal(proper, test);
        }
Пример #2
0
        public void CanCreateCSVFile()
        {
            List <string> sampleData = new List <string>
            {
                "Jack", "Jane", "Jill", "Ally"
            };

            CSVFileUtil.CreateCSVFile("test", sampleData);

            Assert.True(File.Exists
                            (Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                          "CSV", "test.csv")));
        }
Пример #3
0
        public void CanReturnAnArray()
        {
            List <string> sampleData = new List <string>
            {
                "Jack", "Jane", "Jill", "Ally"
            };

            byte[] array = CSVFileUtil.CreateCSVFile("test", sampleData);

            Assert.NotNull(array);

            Assert.NotEmpty(array);
        }
Пример #4
0
        private void loadIndustry()
        {
            List <List <string> > info = CSVFileUtil.readCSV("Data/StockIndustry.txt", '\t');

            for (int i = 0; i < info.Count; i++)
            {
                List <string> arr = info[i];
                if (arr.Count < 3)
                {
                    continue;
                }
                m_stockIndustryMap.Add(arr[0], arr[2]);

                if (!m_stocksInIndustry.ContainsKey(arr[2]))
                {
                    List <string> stockList = new List <string>();
                    m_stocksInIndustry.Add(arr[2], stockList);
                }
                string stockID = StockIDUtil.complementCode(arr[0]);
                m_stocksInIndustry[arr[2]].Add(stockID);
            }
        }