public void Should_be_possible_to_get_one_line_with_pattern_match()
        {
            var fileContentSearchingParameters =
                TextFileContentObjectCollector.GetDictionaryWithParametersToSearchTextFileConten("c:\\windows\\win.ini", @"CMCDL.*?\r\n", 1);
            var textFileContentObjectCollector =
                new TextFileContentObjectCollector() { FileContentProvider = CreateFakeFileContentProvider(CreateFakeFileContent()) };

            var result = textFileContentObjectCollector.GetValues(fileContentSearchingParameters);

            Assert.IsNotNull(result);
            Assert.AreEqual(1,result.Count);
            Assert.AreEqual("CMCDLLNAME32=mapi32.dll",result[0].Trim());
        }
        public void Should_be_possible_to_get_xml_entries_with_pattern_match()
        {
            var fileContentSearchingParameters =
                  TextFileContentObjectCollector.GetDictionaryWithParametersToSearchTextFileConten("c:\\windows\\win.ini", @"<book>.*?</book>", 1, true, true);
            var textFileContentObjectCollector =
                new TextFileContentObjectCollector() { FileContentProvider = CreateFakeFileContentProvider(GetFakeLines()) };

            var result = textFileContentObjectCollector.GetValues(fileContentSearchingParameters);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count);
            Assert.IsTrue(result[0].Contains("<title>The Lord of the Rings</title>"));
        }
        public void Should_be_possible_to_get_textfilecontent_entries_with_pattern_match()
        {            
            string regex = @"\s*net\.ipv4\.conf\.all\.accept_redirects\s*=\s*0\s*(#.*)?";
            var fileContentSearchingParameters =
                TextFileContentObjectCollector.GetDictionaryWithParametersToSearchTextFileConten
                ("c:\\temp\\filecontent_base.xml", regex, 1);
            var textFileContentObjectCollector =
                new TextFileContentObjectCollector() { FileContentProvider = CreateFakeFileContentProvider(GetFakeLinesInFileContent()) };

            var result = textFileContentObjectCollector.GetValues(fileContentSearchingParameters);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count);
            Assert.IsTrue(result[0].Contains("net.ipv4.conf.all.accept_redirects = 0"));
        }
        public void Should_be_possible_to_get_the_second_instance_of_pattern_match()
        {
            var fileContentSearchingParameters =
                TextFileContentObjectCollector.GetDictionaryWithParametersToSearchTextFileConten("c:\\windows\\win.ini", @"<title>.*?</title>", 2);
            var textFileContentObjectCollector =
                new TextFileContentObjectCollector() { FileContentProvider = CreateFakeFileContentProvider(GetFakeLines()) };

            var result = textFileContentObjectCollector.GetValues(fileContentSearchingParameters);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(@"<title>Bible</title>", result[0].Trim());
        }