mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-05-31 11:00:41 +02:00
FIX?
This commit is contained in:
@@ -7,16 +7,29 @@ namespace WireMock.WebSockets;
|
||||
|
||||
internal class WebSocketMessageBuilder : IWebSocketMessageBuilder
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string? MessageText { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public byte[]? MessageBytes { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public TimeSpan? Delay { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public WebSocketMessageType Type { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ShouldClose { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IWebSocketMessageBuilder WithEcho()
|
||||
{
|
||||
Type = WebSocketMessageType.Close;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IWebSocketMessageBuilder WithText(string text)
|
||||
{
|
||||
MessageText = Guard.NotNull(text);
|
||||
@@ -24,6 +37,7 @@ internal class WebSocketMessageBuilder : IWebSocketMessageBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IWebSocketMessageBuilder WithBinary(byte[] bytes)
|
||||
{
|
||||
MessageBytes = Guard.NotNull(bytes);
|
||||
@@ -31,23 +45,27 @@ internal class WebSocketMessageBuilder : IWebSocketMessageBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IWebSocketMessageBuilder WithDelay(TimeSpan delay)
|
||||
{
|
||||
Delay = delay;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IWebSocketMessageBuilder WithDelay(int delayInMilliseconds)
|
||||
{
|
||||
Guard.Condition(delayInMilliseconds, d => d >= 0);
|
||||
return WithDelay(TimeSpan.FromMilliseconds(delayInMilliseconds));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IWebSocketMessageBuilder Close()
|
||||
{
|
||||
ShouldClose = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IWebSocketMessageBuilder AndClose() => Close();
|
||||
}
|
||||
Reference in New Issue
Block a user