public void WmiTest()
        {
            // Initialise Instance
            var target = new TfsBuildExtensions.Activities.Management.Wmi()
            {
                Action    = WmiAction.Execute,
                Class     = "Win32_Process",
                Method    = "Create",
                Namespace = @"\root\CIMV2"
            };

            // Declare additional parameters
            var parameters = new Dictionary <string, object>
            {
                { "MethodParameters", new[] { "CommandLine#~#calc.exe" } },
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);
            var             actual  = invoker.Invoke(parameters);

            // Assert
            Assert.IsTrue(actual["ReturnValue"].ToString() == "0");
        }
示例#2
0
        public void WmiTest()
        {
            // Initialise Instance
            var target = new TfsBuildExtensions.Activities.Management.Wmi()
                {
                    Action = WmiAction.Execute,
                    Class = "Win32_Process",
                    Method = "Create",
                    Namespace = @"\root\CIMV2"
                };
                
                // Declare additional parameters
            var parameters = new Dictionary<string, object>
            {
                { "MethodParameters", new[] { "CommandLine#~#calc.exe" } },
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);
            var actual = invoker.Invoke(parameters);

            // Assert
            Assert.IsTrue(actual["ReturnValue"].ToString() == "0");
        }