public void ValidateLogMobileMessagePatterns(LogMessageMobile logMessageMobile, IDictionary <string, string> patternsDictionary) { var elements = logMessageMobile.GetPatternsValueToVerify(patternsDictionary); if (elements.Any(keyValuePair => !IsValidRegularExpression(keyValuePair.Value))) { throw new JsonException("Invalid pattern"); } }
public void ValidateLogMobileMessagePatterns(LogMessageMobile logMessageMobile, IDictionary <string, string> patternsDictionary) { IDictionary <string, KeyValuePair <string, string> > elements = logMessageMobile.GetPatternsValueToVerify(patternsDictionary); foreach (var keyValuePair in elements) { if (!IsValidRegularExpression(keyValuePair.Value)) { throw new JsonException("Invalid pattern"); } } }
public void LogMessageMobile_GetPatternsValueToVerify_ShouldReturnListOfLogValiationModel() { Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("severityRegex", "low"); dictionary.Add("buildVersionRegex", "v1.0.1"); dictionary.Add("operationSystemRegex", "ios"); dictionary.Add("deviceOSVersionRegex", "iOS12"); dictionary.Add("positiveNumbersRegex", "12"); var pattern = _log.GetPatternsValueToVerify(dictionary); Assert.IsInstanceOf <Dictionary <string, KeyValuePair <string, string> > >(pattern); }