public void TestNonEmptyBodyEndingWithMultipleNewLines() { const string text = "This is a test of the relaxed body filter with a non-empty body ending with multiple new-lines\n\n\n"; const string expected = "This is a test of the relaxed body filter with a non-empty body ending with multiple new-lines\n"; var input = Encoding.ASCII.GetBytes(text); var filter = new DkimRelaxedBodyFilter(); int outputIndex, outputLength; byte[] output; string actual; output = filter.Flush(input, 0, input.Length, out outputIndex, out outputLength); actual = Encoding.ASCII.GetString(output, outputIndex, outputLength); Assert.AreEqual(expected, actual); }
public void TestTrimmingEmptyLines() { const string text = "Hello!\r\n \r\n\r\n"; const string expected = "Hello!\r\n"; var input = Encoding.ASCII.GetBytes(text); var filter = new DkimRelaxedBodyFilter(); int outputIndex, outputLength; byte[] output; string actual; output = filter.Flush(input, 0, input.Length, out outputIndex, out outputLength); actual = Encoding.ASCII.GetString(output, outputIndex, outputLength); Assert.AreEqual(expected, actual); }
public void TestMultipleWhiteSpacesPerLine() { const string text = "This is a test of the relaxed body filter with \t multiple \t spaces\n"; const string expected = "This is a test of the relaxed body filter with multiple spaces\n"; var input = Encoding.ASCII.GetBytes(text); var filter = new DkimRelaxedBodyFilter(); int outputIndex, outputLength; byte[] output; string actual; output = filter.Flush(input, 0, input.Length, out outputIndex, out outputLength); actual = Encoding.ASCII.GetString(output, outputIndex, outputLength); Assert.AreEqual(expected, actual); }
public void TestWhiteSpaceBeforeNewLine() { const string text = "text\t \r\n\t \r\ntext\t \r\n"; const string expected = "text\r\n\r\ntext\r\n"; var input = Encoding.ASCII.GetBytes(text); var filter = new DkimRelaxedBodyFilter(); int outputIndex, outputLength; byte[] output; string actual; output = filter.Flush(input, 0, input.Length, out outputIndex, out outputLength); actual = Encoding.ASCII.GetString(output, outputIndex, outputLength); Assert.AreEqual(expected, actual); }