Beispiel #1
0
        public void get_wmi_win32_computersystem_object_and_compare_environment_machinename()
        {
            using (var Win32_ComputerSystem = HttpPowerShell.Invoke("Get-WmiObject Win32_ComputerSystem").AsDisposable())
            {
                var wmi = Win32_ComputerSystem.First();

                if (!string.Equals((string)wmi.ToDynamic().Name, Environment.MachineName, StringComparison.CurrentCultureIgnoreCase))
                {
                    Assert.Fail("The WMI::Win32_ComputerSystem.Name value is not equal to Environment.MachineName.");
                }
            }
        }
Beispiel #2
0
        public void parameter_value_passed_to_script_via_input_is_returned_from_process_block()
        {
            var guid = Guid.NewGuid();

            Assert.AreEqual <Guid>(guid, HttpPowerShell.Invoke <Guid>("process { $_ }", input: new[] { guid }).First());
        }
Beispiel #3
0
        public void parameter_value_passed_to_script_via_parameters_is_returned()
        {
            var guid = Guid.NewGuid();

            Assert.AreEqual <Guid>(guid, HttpPowerShell.Invoke <Guid>("param($guid) $guid", parameters: new { guid = guid }).First());
        }
Beispiel #4
0
 public void should_throw_CmdletInvocationException_when_getcredential()
 {
     HttpPowerShell.Invoke("Get-Credential");
 }