예제 #1
0
        public List <Assertion> MatchVerifications(List <Assertion> verifications, string httpContent)
        {
            var matchedItems = new List <Assertion>();

            foreach (Assertion item in verifications)
            {
                var assertionLogger = new AssertionLogger(_logger);
                assertionLogger.LogItem(item.AssertionType, item);

                switch (item.AssertionMethod)
                {
                case AssertionMethod.CssSelector:
                    var cqMatcher = new AngleSharpMatcher(_variableProvider, assertionLogger);
                    cqMatcher.Match(item, httpContent);
                    break;

                case AssertionMethod.Regex:
                default:
                    var regexMatcher = new RegexMatcher(_variableProvider, assertionLogger);
                    regexMatcher.Match(item, httpContent);
                    break;
                }

                item.Log = assertionLogger.GetLog();
                matchedItems.Add(item);
            }

            return(matchedItems);
        }
예제 #2
0
 public RegexMatcher(ICapturedVariableProvider variableProvider, AssertionLogger assertionLogger)
 {
     _variableProvider = variableProvider;
     _assertionLogger  = assertionLogger;
 }
예제 #3
0
 public AngleSharpMatcher(ICapturedVariableProvider variableProvider, AssertionLogger assertionLogger)
 {
     _variableProvider = variableProvider;
     _assertionLogger  = assertionLogger;
 }