parent
20586d8ada
commit
eebba7665b
13 changed files with 1094 additions and 233 deletions
|
@ -41,6 +41,8 @@ public class ObjectMocker(string key) : ObjectServiceBase(key)
|
|||
|
||||
public Collection<ByteString> RangeHashResponses { get; } = [];
|
||||
|
||||
public Action? Callback;
|
||||
|
||||
public override Mock<ObjectService.ObjectServiceClient> GetMock()
|
||||
{
|
||||
var mock = new Mock<ObjectService.ObjectServiceClient>();
|
||||
|
@ -165,9 +167,14 @@ public class ObjectMocker(string key) : ObjectServiceBase(key)
|
|||
It.IsAny<CancellationToken>()))
|
||||
.Returns((PutSingleRequest r, Metadata m, DateTime? dt, CancellationToken ct) =>
|
||||
{
|
||||
Callback?.Invoke();
|
||||
Verifier.CheckRequest(r);
|
||||
|
||||
PutSingleRequests.Add(r);
|
||||
var req = r.Clone();
|
||||
|
||||
// Clone method does not clone the payload but keeps a reference
|
||||
req.Body.Object.Payload = ByteString.CopyFrom(r.Body.Object.Payload.ToByteArray());
|
||||
PutSingleRequests.Add(req);
|
||||
|
||||
return new AsyncUnaryCall<PutSingleResponse>(
|
||||
Task.FromResult(putSingleResponse),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue