private List <TextFileContent> parseMatches(
            string dir, string fname, string line, string pattern, ref uint instance)
        {
            var retList   = new List <TextFileContent>();
            var myRegex   = new Regex(pattern);
            var myMatches = myRegex.Matches(line);

            foreach (Match myMatch in myMatches)
            {
                var retItem = new TextFileContent()
                {
                    Line           = line,
                    Pattern        = pattern,
                    Text           = myMatch.ToString(),
                    Path           = dir,
                    FileName       = fname,
                    Instance       = ++instance,
                    SubExpressions = new List <string>()
                };

                foreach (var group in myMatch.Groups)
                {
                    retItem.SubExpressions.Add(group.ToString());
                }

                retList.Add(retItem);
            }

            return(retList);
        }
 private void AssertReturnedFileLine(
     TextFileContent textFileContent, 
     string expectedFileLineContent, 
     uint expectedInstance)
 {
     Assert.IsNotNull(textFileContent);
     Assert.AreEqual(FAKE_FILENAME, textFileContent.FileName);
     Assert.AreEqual(expectedInstance, textFileContent.Instance);
     Assert.AreEqual(expectedFileLineContent, textFileContent.Line);
     Assert.AreEqual(FAKE_FILEPATH, textFileContent.Path);
     Assert.AreEqual(FAKE_PATTERN, textFileContent.Pattern);
     Assert.AreEqual(FAKE_PATTERN, textFileContent.Text);
 }
        private TemporaryItemTypeGenerator CreateMockedItemTypeGenerator()
        {
            var fakeTextFileContent = new TextFileContent[] { new TextFileContent() { Text = "xxx if yyy" } }.ToList();
            var mocks = new MockRepository();
            
            var fakeObjectCollector = mocks.DynamicMock<TextFileContentObjectCollector>();
            //var fakeFileContent = mocks.DynamicMock<FileContentCollector>((SSHProvider)null);
            //Expect.Call(fakeFileContent.GetTextFileContent(null, null)).IgnoreArguments().Return(fakeTextFileContent);
            Expect.Call(fakeObjectCollector.GetValues(null)).IgnoreArguments().Return(new string[] { "xxx if yyy" });
            mocks.ReplayAll();

            return new TemporaryItemTypeGenerator() { ObjectCollector = fakeObjectCollector };
        }
        private List<TextFileContent> parseMatches(
            string dir, string fname, string line, string pattern, ref uint instance)
        {
            var retList = new List<TextFileContent>();
            var myRegex = new Regex(pattern);
            var myMatches = myRegex.Matches(line);
            foreach (Match myMatch in myMatches)
            {
                var retItem = new TextFileContent()
                {
                    Line = line,
                    Pattern = pattern,
                    Text = myMatch.ToString(),
                    Path = dir,
                    FileName = fname,
                    Instance = ++instance,
                    SubExpressions = new List<string>()
                };

                foreach (var group in myMatch.Groups)
                    retItem.SubExpressions.Add(group.ToString());

                retList.Add(retItem);
            }

            return retList;
        }