Exemplo n.º 1
0
        /// <summary>
        /// Access completed result of lambda function as dynamic object. If completed result is JSON object then you can directly access its properties.
        /// Throws exception when last event is not lambda completed event.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public static dynamic Result(this ILambdaItem item)
        {
            Ensure.NotNull(item, nameof(item));
            var completedEvent = item.LastEvent() as LambdaCompletedEvent;

            if (completedEvent == null)
            {
                throw new InvalidOperationException(Resources.Lambda_result_can_not_be_accessed);
            }
            return(completedEvent.Result());
        }
Exemplo n.º 2
0
 /// <summary>
 ///  Retruns the <see cref="LambdaTimedoutEvent"/> and if it is the last event, otherwise null is returned.
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public static LambdaTimedoutEvent LastTimedoutEvent(this ILambdaItem item)
 {
     Ensure.NotNull(item, nameof(item));
     return(item.LastEvent() as LambdaTimedoutEvent);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Retruns the <see cref="LambdaCompletedEvent"/> and if it is the last event, otherwise null is returned.
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public static LambdaCompletedEvent LastCompletedEvent(this ILambdaItem item)
 {
     Ensure.NotNull(item, nameof(item));
     return(item.LastEvent() as LambdaCompletedEvent);
 }