public void GetErrorFilterTest() { bool enableMultiLine = true; Regex errRegex = new Regex(@"(?s)<error>[\\s*]*(?<ErrorMessage>.*?)[\\s*]*</error>"); OutputFilter errorFilter = OutputFilter.GetErrorFilter(errRegex, enableMultiLine); const string ErrText = @" * BEFORE * * <error> * * err1 * * </error> * * AFTER * * <error>err2</error> * <error>err3</error> * "; var expectedErrOutputChunks = new[] { @" * * err1 * * ", "err2", "err3" }; var expectedErrOutput = string.Join(Environment.NewLine, expectedErrOutputChunks); XAssert.AreEqual(expectedErrOutput, errorFilter.ExtractMatches(ErrText)); }
public void GetErrorFilterTest() { bool enableMultiLine = true; Regex errRegex = new Regex(@"(?s)<error>[\\s*]*(?<ErrorMessage>.*?)[\\s*]*</error>"); OutputFilter errorFilter = OutputFilter.GetErrorFilter(errRegex, enableMultiLine); const string ErrText = @" * BEFORE * * <error> * * err1 * * </error> * * AFTER * * <error>err2</error> * <error>err3</error> * "; const string ExpectedErrOutput = @" * * err1 * * err2 err3"; XAssert.AreEqual(ExpectedErrOutput, errorFilter.ExtractMatches(ErrText)); }