public void DefaultConstructor() { var body = new Body(); Assert.Equal(MimePartType.Body, body.Type); Assert.Equal(0, body.SourceText.Length); Assert.Equal("", body.Text); }
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()); }
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()); }
/// <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; }
/// <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); }
internal Body(Body body) : base(MimePartType.Body, body.SourceText) { }