Esempio n. 1
0
 public void DefaultConstructor()
 {
     var body = new Body();
     Assert.Equal(MimePartType.Body, body.Type);
     Assert.Equal(0, body.SourceText.Length);
     Assert.Equal("", body.Text);
 }
Esempio n. 2
0
 public void BodyFromStringShouldHaveMatchingText()
 {
     string bText = "Hello, world";
     Body b = new Body(bText);
     Assert.Equal(bText, b.Text);
     Assert.Equal(bText, b.SourceText.ToString());
     Assert.Equal(bText, b.ToString());
 }
Esempio n. 3
0
 public void BodyFromStringSegmentShouldHaveMatchingText()
 {
     string s = "abcHello, worlddef";
     string bText = "Hello, world";
     StringSegment ss = new StringSegment(s, 3, 14);
     Body b = new Body(ss);
     Assert.Equal(bText, b.Text);
     Assert.Equal(bText, b.SourceText.ToString());
     Assert.Equal(bText, b.ToString());
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes an instance with a <see cref="Body"/>, and associated <c>Content-Type</c>
 /// </summary>
 /// <param name="body">The body of this entity</param>
 /// <param name="contentType">The content type string</param>
 public MimeEntity(Body body, string contentType)
 {
     if (body == null)
     {
         throw new ArgumentNullException("body");
     }
     if (contentType == null)
     {
         throw new ArgumentNullException("contentType");
     }
     
     this.ContentType = contentType;
     this.Body = body;
 }
Esempio n. 5
0
 /// <summary>
 /// Writes a body
 /// </summary>
 /// <param name="body">The body to write.</param>
 public void Write(Body body)
 {
     if (body == null)
     {
         throw new ArgumentNullException("body");
     }
     
     Write(body.SourceText);
 }
Esempio n. 6
0
 internal Body(Body body)
     : base(MimePartType.Body, body.SourceText)
 {
 }