Exemplo n.º 1
0
 /// <summary>
 ///  Execute a function in a process in a new thread with a <see cref="FunctionCallArguments" /> argument
 /// </summary>
 /// <param name="process">The process the thread will be created and executed in.</param>
 /// <param name="functionName">The name of the function to be executed.</param>
 /// <param name="arguments">The class which will be serialized and passed to the function being executed.</param>
 private void ExecuteAssemblyFunctionWithArguments(
     Process process,
     IFunctionName functionName,
     FunctionCallArguments arguments)
 {
     _processManager.Execute(
         functionName.Module,
         functionName.Function,
         MarshallingHelper.StructToByteArray(arguments),
         false);
 }
Exemplo n.º 2
0
 /// <summary>
 ///  Execute a function in a process in a new thread with a <see cref="FunctionCallArguments" /> argument
 /// </summary>
 /// <param name="process">The process the thread will be created and executed in.</param>
 /// <param name="functionName">The name of the function to be executed.</param>
 /// <param name="arguments">The class which will be serialized and passed to the function being executed.</param>
 private void ExecuteAssemblyFunctionWithArguments(
     Process process,
     IFunctionName functionName,
     FunctionCallArguments arguments)
 {
     _memoryManager.Add(
         process,
         _processManager.Execute(
             functionName.Module,
             functionName.Function,
             Binary.StructToByteArray(arguments),
             false),
         false
         );
 }
Exemplo n.º 3
0
        public void Valid_Happy_Path_result_Tests()
        {
            var expectedCommand = "SomeAppName";
            var expectedResult  = new ProcessResult
            {
                Output              = "Sample Output",
                Errors              = "There were Errors",
                Command             = expectedCommand,
                ElapsedMilliseconds = 1234
            };

            _processManager.Execute(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <int>()).Returns(expectedResult);

            var result = DWPSUtils.ExecuteCommandSync(_diskManager, _processManager, expectedCommand, null);

            Assert.IsNotNull(result);
            Assert.AreEqual(result, expectedResult);
        }
Exemplo n.º 4
0
 private void ExecuteAssemblyWithArguments(IFunctionName moduleFunction, byte[] arguments, bool waitForThreadExit)
 {
     _processManager.Execute(moduleFunction.Module, moduleFunction.Function, arguments, waitForThreadExit);
 }