Beispiel #1
0
        /// <summary>
        /// Routes the operation to the correct handler, based on the command.
        /// </summary>
        /// <param name="op">The operation data.</param>
        /// <param name="done">The completion callback.</param>
        public static void HandleOp(OperationData op, Action done)
        {
            if (!(dynamic)op || !(dynamic)op.Command)
            {
                return;
            }

            IOperationHandler handler = null;

            switch (op.Command)
            {
            case "RunTest": handler = new RunTestHandler();
                break;

            case "Wait": handler = new WaitHandler();
                break;

            default:
                throw new Error("Unexpected command: " + op.Command);
            }

            if (handler != null)
            {
                handler.HandleOp(op, done);
            }
            else
            {
                done();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Routes the operation to the correct handler, based on the command.
        /// </summary>
        /// <param name="op">The operation data.</param>
        /// <param name="done">The completion callback.</param>
        public static void HandleOp(OperationData op, Action done)
        {
            if (!(dynamic)op || !(dynamic)op.Command)
                return;

            IOperationHandler handler = null;

            switch (op.Command)
            {
                case "RunTest": handler = new RunTestHandler();
                    break;

                case "Wait": handler = new WaitHandler();
                    break;

                default:
                    throw new Error("Unexpected command: " + op.Command);
            }

            if (handler != null)
                handler.HandleOp(op, done);
            else done();
        }