private BindArguments ( System.Management.Automation.PSObject obj ) : void | ||
obj | System.Management.Automation.PSObject | |
Résultat | void |
public void BindingAmbiguous() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("i", 10); Assert.Throws(typeof(ArgumentException), delegate() { cmdProc.BindArguments(null); }); }
public void BindingField() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("Name", "John"); cmdProc.BindArguments(null); Assert.AreEqual("John", cmdlet.Name); }
public void BindingCombinationAllSet() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("Name", null); cmdProc.AddParameter(null, "John"); cmdProc.AddParameter("Recurse", null); cmdProc.BindArguments(null); Assert.AreEqual("John", cmdlet.Name); Assert.IsTrue(cmdlet.Recurse.ToBool()); }
public void BindingCombinationNonDefaultSet() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("Variable", "a"); cmdProc.AddParameter("Recurse", null); cmdProc.BindArguments(null); Assert.AreEqual("John", cmdlet.Name); Assert.AreEqual("a path", cmdlet.FilePath); Assert.IsTrue(cmdlet.Recurse.ToBool()); }
public void BindingParameter() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("InputObject", 10); cmdProc.BindArguments(null); Assert.AreEqual("10", cmdlet.InputObject.ToString()); }
public void BindingParameterSetSelectionSingleAlias() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("PSPath", null); cmdProc.AddParameter(null, "a path"); cmdProc.BindArguments(null); Assert.AreEqual("File", cmdlet.ParameterSetName); }
public void BindingParameterSetSelectionDoubleShouldFail() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("Variable", null); cmdProc.AddParameter(null, "test"); cmdProc.AddParameter("FilePath", null); cmdProc.AddParameter(null, "a path"); Assert.Throws(typeof(Exception), delegate() { cmdProc.BindArguments(null); }); }
public void BindingParameterAlias() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("Path", "a path"); cmdProc.BindArguments(null); Assert.AreEqual("a path", cmdlet.FilePath.ToString()); }