Example #1
0
        public void TestConstruct()
        {
            ImapPartialRange r;

              r = new ImapPartialRange(0L);

              Assert.AreEqual(0L, r.Start);
              Assert.IsNull(r.Length);
              Assert.IsFalse(r.IsLengthSpecified);
              Assert.AreEqual("<0>", r.ToString());
              Assert.AreEqual("/;PARTIAL=0", r.ToString("u"));

              r = new ImapPartialRange(0L, 1024L);

              Assert.AreEqual(0L, r.Start);
              Assert.AreEqual(1024L, r.Length);
              Assert.IsTrue(r.IsLengthSpecified);
              Assert.AreEqual("<0.1024>", r.ToString());
              Assert.AreEqual("<0.1024>", r.ToString("f"));
              Assert.AreEqual("/;PARTIAL=0.1024", r.ToString("u"));

              r = new ImapPartialRange(0L, (long)0xffffffff);

              Assert.AreEqual(0L, r.Start);
              Assert.AreEqual(4294967295L, r.Length);
              Assert.IsTrue(r.IsLengthSpecified);
              Assert.AreEqual("<0.4294967295>", r.ToString());
              Assert.AreEqual("<0.4294967295>", r.ToString("f"));
              Assert.AreEqual("/;PARTIAL=0.4294967295", r.ToString("u"));

              r = new ImapPartialRange((long)0xfffffffe, 1L);

              Assert.AreEqual(4294967294L, r.Start);
              Assert.AreEqual(1L, r.Length);
              Assert.IsTrue(r.IsLengthSpecified);
              Assert.AreEqual("<4294967294.1>", r.ToString());
              Assert.AreEqual("<4294967294.1>", r.ToString("f"));
              Assert.AreEqual("/;PARTIAL=4294967294.1", r.ToString("u"));
        }
Example #2
0
        public void TestSetStartLength()
        {
            var r = new ImapPartialRange(0L);

              Assert.AreEqual(0L, r.Start);
              Assert.IsNull(r.Length);
              Assert.AreEqual("<0>", r.ToString());
              Assert.AreEqual("/;PARTIAL=0", r.ToString("u"));

              r.Start = 1024L;

              Assert.AreEqual(1024L, r.Start);
              Assert.IsNull(r.Length);
              Assert.AreEqual("<1024>", r.ToString());
              Assert.AreEqual("/;PARTIAL=1024", r.ToString("u"));

              r.Length = 1024L;

              Assert.AreEqual(1024L, r.Start);
              Assert.AreEqual(1024L, r.Length);
              Assert.AreEqual("<1024.1024>", r.ToString());
              Assert.AreEqual("<1024.1024>", r.ToString("f"));
              Assert.AreEqual("/;PARTIAL=1024.1024", r.ToString("u"));

              r.Start = 2048L;
              r.Length = null;

              Assert.AreEqual(2048L, r.Start);
              Assert.IsNull(r.Length);
              Assert.AreEqual("<2048>", r.ToString());
              Assert.AreEqual("/;PARTIAL=2048", r.ToString("u"));
        }