int AssertMatchesOnce(string content, Regex matcher, string matchType)
{
MatchCollection matches = matcher.Matches(content);
if (matches.Count == 0)
{
_logger.Error(String.Format("The {0} cannot be found: {1}", matchType, matcher), "SYSTEM");
return -1;
}
if (matches.Count > 1)
{
_logger.Error(String.Format("The {0} was found {1} times: {2}", matchType, matches.Count, matcher),
"SYSTEM");
return -1;
}
return matches[0].Captures[0].Index;
}