frostfs-sdk-csharp/src/FrostFS.SDK.Tests/Mocks/ClientStreamWriter.cs
Pavel Gross c9a75ea025
All checks were successful
DCO / DCO (pull_request) Successful in 46s
[#24] Client: Implement pool part1
first iteration - base classes and methods

Signed-off-by: Pavel Gross <p.gross@yadro.com>
2024-10-21 10:48:00 +03:00

35 lines
743 B
C#

using System.Collections.ObjectModel;
using FrostFS.SDK.ProtosV2.Interfaces;
using Grpc.Core;
namespace FrostFS.SDK.Tests;
public class ClientStreamWriter : 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.PutRequest pr = new((Object.PutRequest)message);
Messages.Add(pr);
return Task.CompletedTask;
}
}