frostfs-sdk-csharp/src/FrostFS.SDK.Tests/Mocks/PatchStreamWriter.cs
Pavel Gross 003b7fdfdd [#25] Client: Implement Patch and Range methods
Signed-off-by: Pavel Gross <p.gross@yadro.com>
2024-11-08 10:38:50 +03:00

36 lines
747 B
C#

using System.Collections.ObjectModel;
using FrostFS.SDK.ProtosV2.Interfaces;
using Grpc.Core;
namespace FrostFS.SDK.Tests;
public class PatchStreamWriter : IClientStreamWriter<IRequest>
{
private WriteOptions? _options;
public Collection<IRequest> Messages { get; } = [];
public bool CompletedTask { get; private set; }
public WriteOptions? WriteOptions
{
get => _options;
set => _options = value;
}
public Task CompleteAsync()
{
CompletedTask = true;
return Task.CompletedTask;
}
public Task WriteAsync(IRequest message)
{
Object.PatchRequest pr = new((Object.PatchRequest)message);
Messages.Add(pr);
return Task.CompletedTask;
}
}