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()); }
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 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 BindingFieldAlias() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("fn", "John"); cmdProc.BindArguments(null); Assert.AreEqual("John", cmdlet.Name); }
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 BindingNonSwitch() { CommandProcessor cmdProc = new CommandProcessor(info); TestParameterCommand cmdlet = new TestParameterCommand(); cmdProc.Command = cmdlet; cmdProc.AddParameter("Name", null); cmdProc.AddParameter(null, "John"); cmdProc.BindArguments(null); Assert.AreEqual("John", cmdlet.Name); Assert.IsFalse(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 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); }); }