mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
25 lines
944 B
C#
25 lines
944 B
C#
|
using System.Threading;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Capnp.Rpc;
|
|||
|
|
|||
|
namespace Capnp.Net.Runtime.Tests
|
|||
|
{
|
|||
|
class ProvidedCapabilityMock : Skeleton
|
|||
|
{
|
|||
|
readonly TaskCompletionSource<(ulong, ushort, DeserializerState, CancellationToken)>
|
|||
|
_call = new TaskCompletionSource<(ulong, ushort, DeserializerState, CancellationToken)>();
|
|||
|
|
|||
|
public override Task<AnswerOrCounterquestion> Invoke(ulong interfaceId, ushort methodId,
|
|||
|
DeserializerState args, CancellationToken cancellationToken = default(CancellationToken))
|
|||
|
{
|
|||
|
_call.SetResult((interfaceId, methodId, args, cancellationToken));
|
|||
|
return Return.Task;
|
|||
|
}
|
|||
|
|
|||
|
public Task<(ulong, ushort, DeserializerState, CancellationToken)> WhenCalled =>
|
|||
|
_call.Task;
|
|||
|
|
|||
|
public TaskCompletionSource<AnswerOrCounterquestion> Return { get; } = new TaskCompletionSource<AnswerOrCounterquestion>();
|
|||
|
}
|
|||
|
}
|