public async Task TaskInterfaceFactoryCreateWithResultMethod() { const int Value = 5; int result = await TaskInterfaceFactory.CreateTask(async() => { await Task.Delay(50).ConfigureAwait(false); return(Value); }).ConfigureAwait(false); Assert.AreEqual(Value, result); }
public object Invoke(object[] parameters) { if (parameters.Length != 0) { throw new InvokerMisconfigurationException(); } try { return(TaskInterfaceFactory.CreateTask(async() => await this.Invoke())); } catch (InvalidCastException exception) { throw new InvokerMisconfigurationException(exception.Message, exception); } }
object IInvokerMember.Invoke(params object[] parameters) { if (parameters.Length != 1) { throw new InvokerMisconfigurationException(); } try { var param1 = (ITask <TIn>)parameters[0]; return(TaskInterfaceFactory.CreateTask(async() => await this.Invoke(await param1))); } catch (InvalidCastException exception) { throw new InvokerMisconfigurationException(exception.Message, exception); } }
public ITask <TResponse> Invoke(ITask <TRequest> request) { return(TaskInterfaceFactory.CreateTask(async() => (TResponse)await(await this.RecursiveInvoke(this.rootInvokerMember, request) as ITask <object>))); }
public async Task TaskInterfaceFactoryCreateMethod() { await TaskInterfaceFactory.CreateTask(async() => await Task.Delay(50).ConfigureAwait(false)).ConfigureAwait(false); }
public async Task AsTaskExtensionMethod() { await TaskInterfaceFactory.CreateTask(async() => await Task.Delay(50).ConfigureAwait(false)).AsTask().ConfigureAwait(false); }