public void protectTest() { StringHandler target = new StringHandler(); string actual = target.protectMixedQuotes("test \"str1\" - 'str2' data"); Assert.AreEqual(false, Regex.IsMatch(actual, RPattern.DoubleQuotesContent, RegexOptions.IgnorePatternWhitespace)); Assert.AreEqual(false, Regex.IsMatch(actual, RPattern.SingleQuotesContent, RegexOptions.IgnorePatternWhitespace)); }
public void recoveryTest() { StringHandler target = new StringHandler(); string str = target.protectMixedQuotes("test \"str1\" - 'str2' data"); Assert.AreEqual("test \"str1\" - 'str2' data", target.recovery(str)); }
/// <summary> /// Handler of mixed data SBE-Scripts /// Format: https://bitbucket.org/3F/vssolutionbuildevent/issue/22/#comment-12739932 /// </summary> /// <param name="data">mixed data</param> /// <param name="allowMSBuild">Allows post-processing with MSBuild or not. /// Some components can require immediate processing with evaluation, before passing control to next level. /// </param> /// <returns>prepared and evaluated data</returns> public string parse(string data, bool allowMSBuild) { lock(_lock) { _depthLevel = 0; postProcessingMSBuild = allowMSBuild; StringHandler hString = new StringHandler(); return hString.recovery(parse(hString.protectMixedQuotes(data), _depthLevel, hString)); } }