Beispiel #1
0
 private static void DisplayFileInformationAndContents(FileElements file)
 {
     Console.WriteLine(string.Join(Environment.NewLine, new string[]
                                   { $"FileId: {file.Id}",
                                     $"FileName: {file.Name}",
                                     $"FileContents: {file.Text}" }));
 }
Beispiel #2
0
        public void LoadListOfElementFromFile()
        {
            var text     = "aaa" + Environment.NewLine + "bbb" + Environment.NewLine + "ccc" + Environment.NewLine + "fff";
            var elements = new FileElements(new StringReader(text));

            Assert.Equal(new string[] { "aaa", "bbb", "ccc", "fff" }, elements);
        }
Beispiel #3
0
 private void Initialize()
 {
     _files[1] = new FileElements(1, "CowMoon.txt", "The cow jumped over the moon");
     _files[2] = new FileElements(2, "BrokenClockDay.txt", "A broken clock is right twice a day");
     _files[3] = new FileElements(3, "BrokenClockYear.txt", "A broken clock is right 730 times a year");
     _files[4] = new FileElements(4, "ShakepeareAsYouLikeIt.txt", "All the world's a stage");
     _files[5] = new FileElements(5, "RushBastilleDay.txt", "There's no bread, let them eat cake");
 }
Beispiel #4
0
        public ParserController(ILogger logger, IReadOnlyList <string> arguments)
        {
            if (arguments.Count > 0)
            {
                pathCurrentDirectory = arguments[0];
                pathSaveLicense      = arguments[1];
            }

            this.logger          = logger;
            pathCurrentDirectory = ConfigurationManager.AppSettings["pathCurrentDirectory"];
            pathSaveLicense      = ConfigurationManager.AppSettings["pathSaveLicense"];
            FileElements         = new FileElements();
            DirectoryElements    = new DirectoryElements();

            this.logger.LogInformation("The app is running.");
        }
Beispiel #5
0
        public void LoadEmptyListFromEmptyFile()
        {
            var elements = new FileElements(new StringReader(string.Empty));

            Assert.Empty(elements);
        }