public void TestContentMd5 ()
{
var part = new MimePart ();
Assert.IsNull (part.ContentMd5, "Initial ContentMd5 value should be null");
part.ContentMd5 = "XYZ";
Assert.AreEqual ("XYZ", part.ContentMd5, "Expected ContentMd5 to be updated");
Assert.IsTrue (part.Headers.Contains (HeaderId.ContentMd5), "Expected header to exist");
part.ContentMd5 = null;
Assert.IsNull (part.ContentMd5, "Expected ContentMd5 to be null again");
Assert.IsFalse (part.Headers.Contains (HeaderId.ContentMd5), "Expected header to be removed");
part.Headers.Add (HeaderId.ContentMd5, "XYZ");
Assert.AreEqual ("XYZ", part.ContentMd5, "Expected ContentMd5 to be set again");
part.Headers.Remove (HeaderId.ContentMd5);
Assert.IsNull (part.ContentMd5, "Expected ContentMd5 to be null again");
part.ContentMd5 = "XYZ";
part.Headers.Clear ();
Assert.IsNull (part.ContentMd5, "Expected ContentMd5 to be null again");
Assert.Throws<InvalidOperationException> (() => part.ComputeContentMd5 ());
Assert.IsFalse (part.VerifyContentMd5 ());
}