Ejemplo n.º 1
0
        public Task <object> Execute(CallbackExecutionParameters <TMarshal> execute)
        {
            if (!CanExecute)
            {
                throw new InvalidOperationException("Cannot execute.");
            }

            var pending = new PendingExecution
            {
                TargetType = execute.ResultTargetType,
                Binder     = execute.Binder
            };
            var nextId = idGenerator.GetNextId();

            callbacksInProgress.Add(nextId, pending);

            callbackExecutionSubject.OnNext(new CallbackExecution <TMarshal>
            {
                ExecutionId = nextId,
                FunctionId  = execute.Id,
                Parameters  = execute.Parameters.Select(s => execute.BindToWire(s.Value, s.Bindable)).ToArray(),
            });

            return(pending.Tcs.Task);
        }
Ejemplo n.º 2
0
 public void PendingExecutionConstructorTest()
 {
     PendingExecution[] target = new PendingExecution[] { new PendingExecution("A", true), new PendingExecution("A", false) };
     Assert.IsFalse(target.Contains(new PendingExecution("A", false)));
 }