using BuildFlow.Domain.Interfaces;
namespace BuildFlow.Rag.Tests.Stub;
///
/// Stub IFileStorageClient:Upload 记录调用,Download 返回内存流。
/// 绕过真实对象存储(RustFS/MinIO)。
///
public sealed class StubFileStorageClient : IFileStorageClient
{
/// 记录所有上传调用 (bucket, objectKey, size)。
public List<(string Bucket, string ObjectKey, long Size)> Uploads { get; } = [];
/// Download 返回的内容(UTF-8 字节)。默认空数组。
public byte[] DownloadContent { get; init; } = [];
public Task UploadAsync(
string bucket,
string objectKey,
Stream content,
string contentType,
string? authToken,
CancellationToken ct = default)
{
Uploads.Add((bucket, objectKey, content.Length));
return Task.CompletedTask;
}
public Task DownloadAsync(
string bucket,
string objectKey,
string? authToken,
CancellationToken ct = default)
=> Task.FromResult(new MemoryStream(DownloadContent));
}