Files
WireMock.Net/src/WireMock.Net.Minimal/ResponseBuilders/WebSocketMessage.cs
Stef Heyenrath a3da39a9ec ws1
2026-02-08 10:30:59 +01:00

51 lines
1007 B
C#

// Copyright © WireMock.Net
using System;
using Stef.Validation;
using WireMock.Models;
namespace WireMock.ResponseBuilders;
/// <summary>
/// Implementation of IWebSocketMessage
/// </summary>
public class WebSocketMessage : IWebSocketMessage
{
private string? _bodyAsString;
private byte[]? _bodyAsBytes;
/// <inheritdoc />
public int DelayMs { get; set; }
/// <inheritdoc />
public string? BodyAsString
{
get => _bodyAsString;
set
{
_bodyAsString = value;
_bodyAsBytes = null;
}
}
/// <inheritdoc />
public byte[]? BodyAsBytes
{
get => _bodyAsBytes;
set
{
_bodyAsBytes = value;
_bodyAsString = null;
}
}
/// <inheritdoc />
public bool IsText => _bodyAsBytes == null;
/// <inheritdoc />
public string Id { get; set; } = Guid.NewGuid().ToString();
/// <inheritdoc />
public string? CorrelationId { get; set; }
}