Example #1
0
        public void TestEncodeLongResultMethod()
        {
            const string expected = "Authentication-Results: lists.example.com 1;\n\treally-long-method-name=really-long-value\n";
            var          encoded  = new StringBuilder("Authentication-Results:");
            var          authres  = new AuthenticationResults("lists.example.com");
            var          options  = FormatOptions.Default.Clone();

            authres.Results.Add(new AuthenticationMethodResult("really-long-method-name", "really-long-value"));
            authres.Version = 1;

            options.NewLineFormat = NewLineFormat.Unix;

            authres.Encode(options, encoded, encoded.Length);

            Assert.AreEqual(expected, encoded.ToString());
        }
Example #2
0
        public void TestEncodeLongAuthServId()
        {
            const string authservid = "this-is-a-really-really-really-long-authserv-identifier-that-is-78-octets-long";
            const string expected   = "Authentication-Results:\n\t" + authservid + ";\n\tdkim=pass; spf=pass\n";
            var          encoded    = new StringBuilder("Authentication-Results:");
            var          authres    = new AuthenticationResults(authservid);
            var          options    = FormatOptions.Default.Clone();

            authres.Results.Add(new AuthenticationMethodResult("dkim", "pass"));
            authres.Results.Add(new AuthenticationMethodResult("spf", "pass"));

            options.NewLineFormat = NewLineFormat.Unix;

            authres.Encode(options, encoded, encoded.Length);

            Assert.AreEqual(expected, encoded.ToString());
        }
Example #3
0
        public void TestEncodeLongResultMethodWithVersionAndCommentAndReason()
        {
            const string expected = "Authentication-Results: lists.example.com 1;\n\treally-really-really-long-method-name/214748367=\n\treally-really-really-long-value (this is a really really long result comment)\n\treason=\"this is a really really really long reason\"\n\tthis-is-a-really-really-long-ptype.this-is-a-really-really-long-property=\n\tthis-is-a-really-really-long-value\n";
            var          encoded  = new StringBuilder("Authentication-Results:");
            var          authres  = new AuthenticationResults("lists.example.com");
            var          options  = FormatOptions.Default.Clone();

            authres.Results.Add(new AuthenticationMethodResult("really-really-really-long-method-name", "really-really-really-long-value")
            {
                ResultComment = "this is a really really long result comment",
                Reason        = "this is a really really really long reason",
                Version       = 214748367
            });
            authres.Results[0].Properties.Add(new AuthenticationMethodProperty("this-is-a-really-really-long-ptype", "this-is-a-really-really-long-property", "this-is-a-really-really-long-value"));
            authres.Version = 1;

            options.NewLineFormat = NewLineFormat.Unix;

            authres.Encode(options, encoded, encoded.Length);

            Assert.AreEqual(expected, encoded.ToString());
        }