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);
        }
Example #2
0
        /// <summary>
        /// Tests the entity to determine if it is a disposition notification body part
        /// </summary>
        /// <remarks>
        /// Notification status is indicated by the appropriate <c>Content-Type</c>. The notification
        /// section will be a body part of the appropriate MDN report multipart body.
        /// </remarks>
        /// <param name="entity">The entity to test</param>
        /// <returns><c>true</c> if this body part is an MDN notification, <c>false</c> otherwise</returns>
        public static bool IsNotification(MimeEntity entity)
        {
            if (entity == null)
            {
                return(false);
            }

            return(entity.HasMediaType(MDNStandard.MediaType.DispositionNotification));
        }
        public void TextConstructiorShouldCreateTextPlain()
        {
            MimeEntity e = new MimeEntity("Hello, world");

            Assert.True(e.HasMediaType("text/plain"));
        }