mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-18 08:07:09 +01:00
* Implement IMimeMessageData * 1 * Update src/WireMock.Net.MimePart/Util/MimeKitUtils.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * v1 * v2 * e * ? * fix * if (Array.TrueForAll(_funcs, func => func(value).IsPerfect())) * Update src/WireMock.Net.Shared/Util/IMimeKitUtils.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/WireMock.Net.Minimal/Matchers/Request/RequestMessageMultiPartMatcher.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/WireMock.Net.MimePart/Models/MimeEntityDataWrapper.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Models.Mime.IMimeMessageData? BodyAsMimeMessage { get; } * Update src/WireMock.Net.MimePart/Util/MimeKitUtils.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/WireMock.Net.MimePart/Models/MimePartDataWrapper.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/WireMock.Net.MimePart/Models/MimeMessageDataWrapper.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/WireMock.Net.Shared/Util/IMimeKitUtils.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * . --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using MimeKit;
|
|
using Stef.Validation;
|
|
using WireMock.Models.Mime;
|
|
|
|
namespace WireMock.Models;
|
|
|
|
/// <summary>
|
|
/// A wrapper class that implements the <see cref="IMimeEntityData" /> interface by wrapping an <see cref="IMimeEntity" /> interface.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This class provides a simplified, read-only view of an <see cref="IMimeEntity"/>.
|
|
/// </remarks>
|
|
public class MimeEntityDataWrapper : IMimeEntityData
|
|
{
|
|
private readonly IMimeEntity _entity;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="MimeEntityDataWrapper"/> class.
|
|
/// </summary>
|
|
/// <param name="entity">The MIME entity to wrap.</param>
|
|
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();
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public IList<string> Headers { get; private set; }
|
|
|
|
/// <inheritdoc/>
|
|
public IContentDispositionData? ContentDisposition { get; private set; }
|
|
|
|
/// <inheritdoc/>
|
|
public IContentTypeData? ContentType { get; private set; }
|
|
|
|
/// <inheritdoc/>
|
|
public Uri ContentBase => _entity.ContentBase;
|
|
|
|
/// <inheritdoc/>
|
|
public Uri ContentLocation => _entity.ContentLocation;
|
|
|
|
/// <inheritdoc/>
|
|
public string ContentId => _entity.ContentId;
|
|
|
|
/// <inheritdoc/>
|
|
public bool IsAttachment => _entity.IsAttachment;
|
|
|
|
/// <inheritdoc/>
|
|
public override string ToString()
|
|
{
|
|
return _entity.ToString()!;
|
|
}
|
|
}
|