public void TestParent() { var part1 = new ImapSinglePartBodyStructure("1", new MimeType("text", "plain"), null, null, null, "7bit", 0L, 0L); var part21 = new ImapSinglePartBodyStructure("2.1", new MimeType("text", "plain"), null, null, null, "7bit", 0L, 0L); var part21extended = new ImapExtendedSinglePartBodyStructure(part21, null, null, null, null, null); var part22 = new ImapSinglePartBodyStructure("2.2", new MimeType("text", "html"), null, null, null, "7bit", 0L, 0L); var part2 = new ImapMultiPartBodyStructure("2", new[] {part21extended, part22}, "alternative"); var part31 = new ImapSinglePartBodyStructure("3.1", new MimeType("text", "plain"), null, null, null, "7bit", 0L, 0L); var part3Envelope = new ImapEnvelope(null, null, null, null, null, null, null, null, null, null); var part3 = new ImapMessageRfc822BodyStructure("3", new MimeType("message", "rfc822"), null, null, null, "7bit", 0L, part3Envelope, part31, 0L); var root = new ImapMultiPartBodyStructure(string.Empty, new IImapBodyStructure[] {part1, part2, part3}, "mixed"); Assert.IsNull(root.ParentStructure); Assert.AreSame(root, part1.ParentStructure); Assert.AreSame(root, part2.ParentStructure); Assert.AreSame(root, part3.ParentStructure); Assert.AreSame(part2, part21extended.ParentStructure); Assert.AreSame(part2, part22.ParentStructure); Assert.AreSame(part3, part31.ParentStructure); }
public ImapExtendedSinglePartBodyStructure(ImapSinglePartBodyStructure baseStructure, string md5, ImapBodyDisposition disposition, string[] languages, Uri location, ImapData[] extensions) : base(baseStructure) { this.MD5 = md5; this.Disposition = disposition; this.Languages = languages; this.Location = location; this.Extensions = extensions; }
protected ImapSinglePartBodyStructure(ImapSinglePartBodyStructure baseStructure) { if (baseStructure == null) throw new ArgumentNullException("baseStructure"); this.Section = baseStructure.Section; this.MediaType = baseStructure.MediaType; this.Parameters = baseStructure.Parameters; this.Id = baseStructure.Id; this.Description = baseStructure.Description; this.Encoding = baseStructure.Encoding; this.Size = baseStructure.Size; this.LineCount = baseStructure.LineCount; }
private IImapBodyStructure BuildMultiPart() { var part1 = new ImapSinglePartBodyStructure("1", new MimeType("text", "plain"), null, null, null, "7bit", 0L, 0L); var part21 = new ImapSinglePartBodyStructure("2.1", new MimeType("text", "plain"), null, null, null, "7bit", 0L, 0L); var part22 = new ImapSinglePartBodyStructure("2.2", new MimeType("text", "html"), null, null, null, "7bit", 0L, 0L); var part2 = new ImapMultiPartBodyStructure("2", new[] {part21, part22}, "alternative"); var part31 = new ImapSinglePartBodyStructure("3.1", new MimeType("text", "plain"), null, null, null, "7bit", 0L, 0L); var part3Envelope = new ImapEnvelope(null, null, null, null, null, null, null, null, null, null); var part3 = new ImapMessageRfc822BodyStructure("3", new MimeType("message", "rfc822"), null, null, null, "7bit", 0L, part3Envelope, part31, 0L); return new ImapMultiPartBodyStructure(string.Empty, new IImapBodyStructure[] {part1, part2, part3}, "mixed"); }
public void TestTraverseSinglePart() { var single = new ImapSinglePartBodyStructure(string.Empty, new MimeType("text", "plain"), null, null, null, "7bit", 0L, 0L); ImapBodyStructureUtils.Traverse(single, delegate(IImapBodyStructure s) { Assert.Fail("enumerated"); }); }