public void SameLinkDiffrentLines_AreEqualeReturnsTrue(string link, string text)
        {
            var link1 = new LinkDto(link, text, 1);
            var link2 = new LinkDto(link, text, 2);

            Assert.AreEqual(link1, link2, "The links should have been equale");
            Assert.AreEqual(link1.GetHashCode(), link2.GetHashCode(), "The links should have the same hase code");
        }
Ejemplo n.º 2
0
        private static void FindMatchesInLine(string line, int lineNumber, Dictionary <int, LinkDto> stringMatches)
        {
            var matches = Regex.Matches(line, LinkRegexPattern);

            foreach (Match match in matches)
            {
                var link     = match.Groups["link"].ToString();
                var linkText = match.Groups["text"].ToString();
                var linkDto  = new LinkDto(link, linkText, lineNumber);
                if (stringMatches.ContainsKey(linkDto.GetHashCode()))
                {
                    stringMatches[linkDto.GetHashCode()].Lines.Add(lineNumber);
                }
                else
                {
                    stringMatches.Add(linkDto.GetHashCode(), linkDto);
                }
            }
        }