Beispiel #1
0
        /// <summary>
        /// Builds an <see cref="DivideOp"/>.
        /// </summary>
        /// <param name="numerator">The numerator.</param>
        /// <param name="denominator">The denominator.</param>
        /// <returns>
        /// The operation.
        /// </returns>
        public static DivideOp Divide(
            IReturningOperation <decimal> numerator,
            IReturningOperation <decimal> denominator)
        {
            var result = new DivideOp(numerator, denominator);

            return(result);
        }
Beispiel #2
0
        /// <inheritdoc />
        public async Task <decimal> ExecuteAsync(
            DivideOp operation)
        {
            if (operation == null)
            {
                throw new ArgumentNullException(nameof(operation));
            }

            var numerator = await this.protocolFactory.GetProtocolAndExecuteViaReflectionAsync <decimal>(operation.Numerator);

            var denominator = await this.protocolFactory.GetProtocolAndExecuteViaReflectionAsync <decimal>(operation.Denominator);

            var result = numerator / denominator;

            return(result);
        }