Ejemplo n.º 1
0
        /// <summary>
        /// Builds an <see cref="GetValidityOp"/>.
        /// </summary>
        /// <param name="cellLocator">The cell locator.</param>
        /// <returns>
        /// The operation.
        /// </returns>
        public static GetValidityOp GetValidity(
            this CellLocatorBase cellLocator)
        {
            var result = new GetValidityOp(Op.Const(cellLocator));

            return(result);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public async Task <Validity> ExecuteAsync(
            GetValidityOp 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 recalcPhase = this.getRecalcPhaseFunc();

            if ((recalcPhase != RecalcPhase.Validation) && (recalcPhase != RecalcPhase.AvailabilityCheck))
            {
                throw new InvalidOperationException(Invariant($"Cannot execute {nameof(GetValidityOp)} during the {recalcPhase} phase."));
            }

            var cell = await this.GetCellAndValidateIfNecessaryAsync(operation.CellLocator);

            var result = cell.GetValidity();

            return(result);
        }