Exemple #1
0
        /// <summary>
        /// Builds an <see cref="GetCellOpExecutionOutcomeOp"/>.
        /// </summary>
        /// <param name="cellLocator">The cell locator.</param>
        /// <returns>
        /// The operation.
        /// </returns>
        public static GetCellOpExecutionOutcomeOp GetOpExecutionOutcome(
            this CellLocatorBase cellLocator)
        {
            var result = new GetCellOpExecutionOutcomeOp(Op.Const(cellLocator));

            return(result);
        }
Exemple #2
0
        /// <inheritdoc />
        public async Task <CellOpExecutionOutcome> ExecuteAsync(
            GetCellOpExecutionOutcomeOp operation)
        {
            // NOTE: THIS CODE IS A NEAR DUPLICATE OF THE SYNC METHOD ABOVE; NO GOOD WAY TO D.R.Y. IT OUT
            if (operation == null)
            {
                throw new ArgumentNullException(nameof(operation));
            }

            var locatedCell = await this.GetCellAndExecuteOperationIfNecessaryAsync(operation.CellLocator);

            if (!(locatedCell.Cell is IOperationOutputCell operationCell))
            {
                throw new CellNotFoundException(Invariant($"The operation addresses a cell whose type is not an {typeof(IOperationOutputCell<TValue>).ToStringReadable()}: {locatedCell.Cell.GetType().ToStringReadable()}."), locatedCell.CellLocator);
            }

            var result = operationCell.GetCellOpExecutionOutcome();

            return(result);
        }