Exemplo n.º 1
0
        public void TestWrite()
        {
            // Arrange
            TextFileOperations operations = new TextFileOperations();
            string             path       = ConfigurationManager.AppSettings["CityOutputDest"].ToString() + "\\" + DateTime.Now.ToString("dd-MMM-yyyy") + "\\Berlin.txt";

            // Act
            bool result = operations.WriteFile("test text", path);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result, true);
        }
Exemplo n.º 2
0
        public void FindAnagrams(string sourceFilePath, string resultFilePath)
        {
            var wordsList = TextFileOperations.ReadAllLines(sourceFilePath);
            Dictionary <string, string> wordsKeys = new Dictionary <string, string>();

            foreach (var word in wordsList)
            {
                wordsKeys.Add(word.Trim(), OrderedLetters(word));
            }

            Dictionary <string, List <string> > anagramsList = wordsKeys.GroupBy(w => w.Value)
                                                               .ToDictionary(t => t.Key, t => t.Select(w => w.Key).ToList());

            TextFileOperations.WriteToFile(anagramsList, resultFilePath);

            Console.ReadLine();
        }
Exemplo n.º 3
0
 public void TestTextToString()
 {
     Console.WriteLine(TextFileOperations.ConvertTextFileToString(@"\\nas72v2\vdi_data\USA\rparso2\Documents\Downloads\DevOrderMgmtSysUrlConfig.json"));
 }