예제 #1
0
        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);

            filter.Reset();
        }
예제 #2
0
        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);

            filter.Reset();
        }
예제 #3
0
        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);

            filter.Reset();
        }