// Copyright © WireMock.Net using System; using System.Collections.Generic; using System.Linq; using MimeKit; using Stef.Validation; using WireMock.Models.Mime; namespace WireMock.Models; /// /// A wrapper class that implements the interface by wrapping an interface. /// /// /// This class provides a simplified, read-only view of an . /// public class MimeEntityDataWrapper : IMimeEntityData { private readonly IMimeEntity _entity; /// /// Initializes a new instance of the class. /// /// The MIME entity to wrap. public MimeEntityDataWrapper(IMimeEntity entity) { _entity = Guard.NotNull(entity); ContentDisposition = _entity.ContentDisposition != null ? new ContentDispositionDataWrapper(_entity.ContentDisposition) : null; ContentType = _entity.ContentType != null ? new ContentTypeDataWrapper(_entity.ContentType) : null; Headers = _entity.Headers.Select(h => h.ToString()).ToList(); } /// public IList Headers { get; private set; } /// public IContentDispositionData? ContentDisposition { get; private set; } /// public IContentTypeData? ContentType { get; private set; } /// public Uri ContentBase => _entity.ContentBase; /// public Uri ContentLocation => _entity.ContentLocation; /// public string ContentId => _entity.ContentId; /// public bool IsAttachment => _entity.IsAttachment; /// public override string ToString() { return _entity.ToString()!; } }