Пример #1
0
        /// <summary>
        /// Acquires a delegate which can call operations on variables in the test target application.
        /// </summary>
        /// <param name="operation">Operation name.</param>
        /// <param name="operationTypeInfo">
        /// Operation type information.
        /// Used to differentiate between multiple overloads or to target an operation with the same name within a parent class.
        /// Overloads can often be resolved by their parameters without specifying an OperationTypeInfo.
        /// </param>
        /// <returns>Delegate for executing operations.</returns>
#else
        /// <summary>
        /// テスト対象アプリケーション内の変数の操作を呼び出すdelegateを取得します。
        /// </summary>
        /// <param name="operation">操作名称。</param>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <returns>操作実行delegate。</returns>
#endif
        public FriendlyOperation this[string operation, OperationTypeInfo operationTypeInfo]
        {
            get
            {
                return((new FriendlyOperationOwner(this, operationTypeInfo, operation)).FriendlyOperation);
            }
        }
Пример #2
0
 /// <summary>
 /// 戻り値を値で取得する通信処理。
 /// </summary>
 /// <param name="protocolType">通信タイプ。</param>
 /// <param name="operationTypeInfo">操作タイプ情報。</param>
 /// <param name="operation">操作名称。</param>
 /// <param name="arguments">引数。</param>
 /// <returns>値。</returns>
 internal override object SendAndValueReceive(ProtocolType protocolType, OperationTypeInfo operationTypeInfo, string operation, object[] arguments)
 {
     if (_disposed)
     {
         throw new FriendlyOperationException(Resources.ErrorDisposedObject);
     }
     return(FriendlyTalker.SendAndValueReceive(this, _friendlyConnector, protocolType, operationTypeInfo, _varAddress, string.Empty, operation, arguments));
 }
Пример #3
0
        /// <summary>
        /// Declares a variable within the application under test using the specified information.
        /// </summary>
        /// <param name="newInfo">Variable in the application</param>
        /// <param name="operationTypeInfo">
        /// Operation type information.
        /// Used to call operation of the same name of a parent class when two or more overloads exist for the indicated operation.
        /// In many cases, an overload can be resolved using the parameters without specifying an OperationTypeInfo.
        /// </param>
        /// <returns>Variable in the application.</returns>
#else
        /// <summary>
        /// テスト対象アプリケーション内に指定の生成情報で生成されたオブジェクトを格納する変数を宣言します。
        /// </summary>
        /// <param name="newInfo">生成情報。</param>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <returns>アプリケーション内変数。</returns>
#endif
        public AppVar Dim(NewInfo newInfo, OperationTypeInfo operationTypeInfo)
        {
            if (newInfo == null)
            {
                throw new ArgumentNullException("newInfo");
            }
            return(Invoke(ProtocolType.VarNew, operationTypeInfo, newInfo.TypeFullName, newInfo.Arguments));
        }
Пример #4
0
        /// <summary>
        /// Acquires delegates for calling static operations in test target application.
        /// </summary>
        /// <param name="type">Type information storing a static call.</param>
        /// <param name="operation">Name of the operation.</param>
        /// <param name="operationTypeInfo">
        /// Operation type information.
        /// Used to call operation of the same name of a parent class when two or more overloads exist for the indicated operation.
        /// In many cases, an overload can be resolved using the parameters without specifying an OperationTypeInfo.
        /// </param>
        /// <param name="async">An asynchronous execution.</param>
        /// <returns>A delegate for calling static operation in the application.</returns>
#else
        /// <summary>
        /// テスト対象アプリケーション内のstatic操作を呼び出すdelegateを取得します。
        /// </summary>
        /// <param name="type">タイプ。</param>
        /// <param name="operation">操作名称。</param>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <param name="async">非同期実行オブジェクト。</param>
        /// <returns>アプリケーション内のstatic操作を呼び出すdelegate。</returns>
#endif
        public FriendlyOperation this[Type type, string operation, OperationTypeInfo operationTypeInfo, Async async]
        {
            get
            {
                if (type == null)
                {
                    throw new ArgumentNullException("type");
                }
                return(new StaticOperationTalker(FriendlyConnector, type.FullName)[operation, operationTypeInfo, async]);
            }
        }
Пример #5
0
        /// <summary>
        /// Acquires delegates for calling static operations in test target application.
        /// </summary>
        /// <param name="staticOperation">Selects by Namespace.Class.OperationName(Method, Property, Field)</param>
        /// <param name="operationTypeInfo">
        /// Operation type information.
        /// Used to call operation of the same name of a parent class when two or more overloads exist for the indicated operation.
        /// In many cases, an overload can be resolved using the parameters without specifying an OperationTypeInfo.
        /// </param>
        /// <returns>A delegate for calling static operation in the application.</returns>
#else
        /// <summary>
        /// テスト対象アプリケーション内のstatic操作を呼び出すdelegateを取得します。
        /// </summary>
        /// <param name="staticOperation">ネームスペース.クラス名.操作名(メソッド、プロパティー、フィールド)の形式で指定します。</param>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <returns>アプリケーション内のstatic操作を呼び出すdelegate。</returns>
#endif
        public FriendlyOperation this[string staticOperation, OperationTypeInfo operationTypeInfo]
        {
            get
            {
                if (operationTypeInfo == null)
                {
                    throw new ArgumentNullException("operationTypeInfo");
                }
                return(CreateFullNameFriendlyOperation(staticOperation, operationTypeInfo, null));
            }
        }
Пример #6
0
        /// <summary>
        /// Acquires a delegate which can call operations on variables in the test target application.
        /// </summary>
        /// <param name="operation">Operation name.</param>
        /// <param name="operationTypeInfo">
        /// Operation type information.
        /// Used to differentiate between multiple overloads or to target an operation with the same name within a parent class.
        /// Overloads can often be resolved by their parameters without specifying an OperationTypeInfo.
        /// </param>
        /// <param name="async">Object for asynchronous execution. </param>
        /// <returns>Delegate for executing operations.</returns>
#else
        /// <summary>
        /// テスト対象アプリケーション内の変数の操作を呼び出すdelegateを取得します。
        /// </summary>
        /// <param name="operation">操作名称。</param>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <param name="async">非同期実行オブジェクト。</param>
        /// <returns>操作実行delegate。</returns>
#endif
        public FriendlyOperation this[string operation, OperationTypeInfo operationTypeInfo, Async async]
        {
            get
            {
                if (async == null)
                {
                    throw new ArgumentNullException("async");
                }
                async.Initialize(this);
                return((new AsyncFriendlyOperationOwner(async, operationTypeInfo, operation)).FriendlyOperation);
            }
        }
 internal static FriendlyOperation GetFriendlyOperation(AppFriend target, string name, Async async, OperationTypeInfo typeInfo)
 {
     if (async != null && typeInfo != null)
     {
         return target[name, typeInfo, async];
     }
     else if (async != null)
     {
         return target[name, async];
     }
     else if (typeInfo != null)
     {
         return target[name, typeInfo];
     }
     return target[name];
 }
Пример #8
0
        /// <summary>
        /// 非同期操作呼び出し。
        /// </summary>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <param name="operation">操作。</param>
        /// <param name="arguments">引数。</param>
        /// <returns>戻り値。</returns>
        internal AppVar Invoke(OperationTypeInfo operationTypeInfo, string operation, object[] arguments)
        {
            //完了情報格納バッファ宣言
            _completedResult = _operationTalker.SendAndReceive(ProtocolType.AsyncResultVarInitialize, null, string.Empty, new object[] { null });

            //第一引数に入れて渡す。
            List <object> arg = new List <object>();

            arg.Add(_completedResult);
            arg.AddRange(arguments);

            //呼び出し。
            AppVar returnValue = _operationTalker.SendAndReceive(ProtocolType.AsyncOperation, operationTypeInfo, operation, arg.ToArray());

            GC.KeepAlive(_operationTalker);

            //戻り値格納変数を返す。
            return(returnValue);
        }
Пример #9
0
 public FriendlyOperation this[Type type, string operation, OperationTypeInfo operationTypeInfo, Async async]
 {
     get
     {
         if (type == null)
         {
             throw new ArgumentNullException("type");
         }
         return new StaticOperationTalker(FriendlyConnector, type.FullName)[operation, operationTypeInfo, async];
     }
 }
Пример #10
0
        /// <summary>
        /// 非同期操作呼び出し。
        /// </summary>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <param name="operation">操作。</param>
        /// <param name="arguments">引数。</param>
        /// <returns>戻り値。</returns>
        internal AppVar Invoke(OperationTypeInfo operationTypeInfo, string operation, object[] arguments)
        {
            //完了情報格納バッファ宣言
            _completedResult = _operationTalker.SendAndReceive(ProtocolType.AsyncResultVarInitialize, null, string.Empty, new object[] { null });

            //第一引数に入れて渡す。
            List<object> arg = new List<object>();
            arg.Add(_completedResult);
            arg.AddRange(arguments);

            //呼び出し。
            AppVar returnValue = _operationTalker.SendAndReceive(ProtocolType.AsyncOperation, operationTypeInfo, operation, arg.ToArray());
            GC.KeepAlive(_operationTalker);

            //戻り値格納変数を返す。
            return returnValue;
        }
Пример #11
0
        /// <summary>
        /// Acquires a delegate which can call operations on variables in the test target application.
        /// </summary>
        /// <param name="operation">Operation name.</param>
        /// <param name="operationTypeInfo">
        /// Operation type information.
        /// Used to differentiate between multiple overloads or to target an operation with the same name within a parent class. 
        /// Overloads can often be resolved by their parameters without specifying an OperationTypeInfo.
        /// </param>
        /// <param name="async">Object for asynchronous execution. </param>
        /// <returns>Delegate for executing operations.</returns>
#else
        /// <summary>
        /// テスト対象アプリケーション内の変数の操作を呼び出すdelegateを取得します。
        /// </summary>
        /// <param name="operation">操作名称。</param>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <param name="async">非同期実行オブジェクト。</param>
        /// <returns>操作実行delegate。</returns>
#endif
        public FriendlyOperation this[string operation, OperationTypeInfo operationTypeInfo, Async async] 
        {
            get
            {
                if (async == null)
                {
                    throw new ArgumentNullException("async");
                }
                async.Initialize(this);
                return (new AsyncFriendlyOperationOwner(async, operationTypeInfo, operation)).FriendlyOperation; 
            }
        }
Пример #12
0
 /// <summary>
 /// 実行。
 /// </summary>
 /// <param name="protocolType">プロトコルタイプ。</param>
 /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
 /// <param name="typeFullName">タイプフルネーム。</param>
 /// <param name="args">引数。</param>
 /// <returns>変数。</returns>
 private AppVar Invoke(ProtocolType protocolType, OperationTypeInfo operationTypeInfo, string typeFullName, object[] args)
 {
     return FriendlyTalker.SendAndVarReceive(this, FriendlyConnector, protocolType, operationTypeInfo, null, typeFullName, string.Empty, args);
 }
Пример #13
0
 /// <summary>
 /// 実行。
 /// </summary>
 /// <param name="protocolType">プロトコルタイプ。</param>
 /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
 /// <param name="typeFullName">タイプフルネーム。</param>
 /// <param name="args">引数。</param>
 /// <returns>変数。</returns>
 private AppVar Invoke(ProtocolType protocolType, OperationTypeInfo operationTypeInfo, string typeFullName, object[] args)
 {
     return(FriendlyTalker.SendAndVarReceive(this, FriendlyConnector, protocolType, operationTypeInfo, null, typeFullName, string.Empty, args));
 }
Пример #14
0
 /// <summary>
 /// 戻り値を値で取得する通信処理。
 /// </summary>
 /// <param name="protocolType">通信タイプ。</param>
 /// <param name="operationTypeInfo">操作タイプ情報。</param>
 /// <param name="operation">操作名称。</param>
 /// <param name="arguments">引数。</param>
 /// <returns>値。</returns>
 internal override object SendAndValueReceive(ProtocolType protocolType, OperationTypeInfo operationTypeInfo, string operation, object[] arguments)
 {
     if (_disposed)
     {
         throw new FriendlyOperationException(Resources.ErrorDisposedObject);
     }
     return FriendlyTalker.SendAndValueReceive(this, _friendlyConnector, protocolType, operationTypeInfo, _varAddress, string.Empty, operation, arguments);
 }
Пример #15
0
 public AppVar Dim(NewInfo newInfo, OperationTypeInfo operationTypeInfo)
 {
     if (newInfo == null)
     {
         throw new ArgumentNullException("newInfo");
     }
     return Invoke(ProtocolType.VarNew, operationTypeInfo, newInfo.TypeFullName, newInfo.Arguments);
 }
Пример #16
0
 /// <summary>
 /// static呼び出しで型名称から操作名称までフルネームのFriendlyOperation生成。
 /// </summary>
 /// <param name="staticOperation">スタティック操作。</param>
 /// <param name="operationTypeInfo">操作タイプ確定情報。</param>
 /// <param name="async">非同期実行オブジェクト。</param>
 /// <returns>FriendlyOperation</returns>
 private FriendlyOperation CreateFullNameFriendlyOperation(string staticOperation, OperationTypeInfo operationTypeInfo, Async async)
 {
     if (staticOperation == null)
     {
         throw new ArgumentNullException("staticOperation");
     }
     int index = staticOperation.LastIndexOf('.');
     if (index == -1)
     {
         throw new FriendlyOperationException(Resources.ErrorInvalidStaticCall);
     }
     string typeFullName = staticOperation.Substring(0, index);
     string operation = staticOperation.Substring(index + 1);
     return new StaticOperationTalker(FriendlyConnector, typeFullName)[operation, operationTypeInfo, async];
 }
Пример #17
0
        /// <summary>
        /// static呼び出しで型名称から操作名称までフルネームのFriendlyOperation生成。
        /// </summary>
        /// <param name="staticOperation">スタティック操作。</param>
        /// <param name="operationTypeInfo">操作タイプ確定情報。</param>
        /// <param name="async">非同期実行オブジェクト。</param>
        /// <returns>FriendlyOperation</returns>
        private FriendlyOperation CreateFullNameFriendlyOperation(string staticOperation, OperationTypeInfo operationTypeInfo, Async async)
        {
            if (staticOperation == null)
            {
                throw new ArgumentNullException("staticOperation");
            }
            int index = staticOperation.LastIndexOf('.');

            if (index == -1)
            {
                throw new FriendlyOperationException(Resources.ErrorInvalidStaticCall);
            }
            string typeFullName = staticOperation.Substring(0, index);
            string operation    = staticOperation.Substring(index + 1);

            return(new StaticOperationTalker(FriendlyConnector, typeFullName)[operation, operationTypeInfo, async]);
        }
Пример #18
0
 public FriendlyOperation this[string staticOperation, OperationTypeInfo operationTypeInfo]
 {
     get
     {
         if (operationTypeInfo == null)
         {
             throw new ArgumentNullException("operationTypeInfo");
         }
         return CreateFullNameFriendlyOperation(staticOperation, operationTypeInfo, null);
     }
 }
Пример #19
0
        /// <summary>
        /// Acquires a delegate which can call operations on variables in the test target application.
        /// </summary>
        /// <param name="operation">Operation name.</param>
        /// <param name="operationTypeInfo">
        /// Operation type information.
        /// Used to differentiate between multiple overloads or to target an operation with the same name within a parent class. 
        /// Overloads can often be resolved by their parameters without specifying an OperationTypeInfo.
        /// </param>
        /// <returns>Delegate for executing operations.</returns>
#else
        /// <summary>
        /// テスト対象アプリケーション内の変数の操作を呼び出すdelegateを取得します。
        /// </summary>
        /// <param name="operation">操作名称。</param>
        /// <param name="operationTypeInfo">操作タイプ情報。(オーバーロードの解決等に使用します。)</param>
        /// <returns>操作実行delegate。</returns>
#endif
        public FriendlyOperation this[string operation, OperationTypeInfo operationTypeInfo] 
        {
            get
            {
                return (new FriendlyOperationOwner(this, operationTypeInfo, operation)).FriendlyOperation; 
            }
        }