public void ConstructorWithContentTypeShouldSetContentType() { MimeEntity e = new MimeEntity("Hello, world", "text/silly; charset=uk-monty"); Assert.True(e.HasHeaders); Assert.True(e.HasHeader("content-type")); Assert.True(e.HasMediaType("text/silly")); Assert.Equal("text/silly; charset=uk-monty", e.ContentType); }
public void MimeEntityShouldHaveHeaders() { MimeEntity e = new MimeEntity("Hello, world", "text/silly"); e.ContentDisposition = "inline"; e.ContentTransferEncoding = "base64"; e.Headers.Add(new Header("foo", "bar")); Assert.True(e.HasHeader("FOO")); Assert.Equal(4, e.Headers.Count); }
/// <summary> /// Tests the <paramref name="entity"/> to see if it contains an MDN request. /// </summary> /// <param name="entity">The entity to test</param> /// <returns><c>true</c> if the entity contains an MDN request, <c>false</c> otherwise</returns> public static bool HasMDNRequest(MimeEntity entity) { if (entity == null) { return false; } return entity.HasHeader(Headers.DispositionNotificationTo); }