[#17] Client: Add extra parameter
API methods' parameters types with optional session, polling settings, xHeaders etc. and corresponding handlers have been added Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
00a1e9412f
commit
7b9c19f37c
42 changed files with 1054 additions and 386 deletions
|
@ -77,6 +77,21 @@ public class ContainerMocker(string key) : ContainerServiceBase(key)
|
|||
|
||||
getResponse.VerifyHeader = GetResponseVerificationHeader(getResponse);
|
||||
|
||||
var getNoContainerResponse = new GetResponse
|
||||
{
|
||||
Body = new (),
|
||||
MetaHeader = new ResponseMetaHeader
|
||||
{
|
||||
Status = new Status.Status
|
||||
{
|
||||
Code = 3072,
|
||||
Message = "container not found"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getNoContainerResponse.VerifyHeader = GetResponseVerificationHeader(getNoContainerResponse);
|
||||
|
||||
mock.Setup(x => x.GetAsync(
|
||||
It.IsAny<GetRequest>(),
|
||||
It.IsAny<Metadata>(),
|
||||
|
@ -86,12 +101,22 @@ public class ContainerMocker(string key) : ContainerServiceBase(key)
|
|||
{
|
||||
Verifier.CheckRequest(r);
|
||||
|
||||
if (ReturnContainerRemoved)
|
||||
{
|
||||
return new AsyncUnaryCall<GetResponse>(
|
||||
Task.FromResult(getNoContainerResponse),
|
||||
Task.FromResult(ResponseMetaData),
|
||||
() => new Grpc.Core.Status(StatusCode.NotFound, string.Empty),
|
||||
() => ResponseMetaData,
|
||||
() => { });
|
||||
}
|
||||
|
||||
return new AsyncUnaryCall<GetResponse>(
|
||||
Task.FromResult(getResponse),
|
||||
Task.FromResult(ResponseMetaData),
|
||||
() => new Grpc.Core.Status(StatusCode.OK, string.Empty),
|
||||
() => ResponseMetaData,
|
||||
() => { });
|
||||
() => { });
|
||||
});
|
||||
|
||||
var listResponse = new ListResponse
|
||||
|
@ -154,6 +179,8 @@ public class ContainerMocker(string key) : ContainerServiceBase(key)
|
|||
return mock;
|
||||
}
|
||||
|
||||
public bool ReturnContainerRemoved { get; set; }
|
||||
|
||||
public List<byte[]> ContainerIds { get; set; } = [];
|
||||
|
||||
public List<RequestData<DeleteRequest>> Requests { get; set; } = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue