public void TestParseMixedMultiple() { var variables = new VariableController(); variables.ParseArguments(@"-key1 ""value1"" -key2 -key3 2".Wordify()); VariableModel variableOne = variables.Get(new Command() { Origin = CommandOrigin.Local }, "key1").Now.Variables.First(); VariableModel variableTwo = variables.Get(new Command() { Origin = CommandOrigin.Local }, "key2").Now.Variables.First(); VariableModel variableThree = variables.Get(new Command() { Origin = CommandOrigin.Local }, "key3").Now.Variables.First(); Assert.AreEqual("value1", variableOne.ToType(String.Empty)); Assert.IsTrue(variableOne.Readonly); Assert.AreEqual(true, variableTwo.ToType(false)); Assert.IsTrue(variableTwo.Readonly); Assert.AreEqual(2, variableThree.ToType(0)); Assert.IsTrue(variableThree.Readonly); }
public void TestParseSingleFlag() { var variables = new VariableController(); variables.ParseArguments(@"-key".Wordify()); VariableModel variableModel = variables.Get(new Command() { Origin = CommandOrigin.Local }, "key").Now.Variables.First(); Assert.IsTrue(variableModel.ToType(false)); Assert.IsTrue(variableModel.Readonly); }
public void TestBlank() { var variables = new VariableController(); variables.ParseArguments(new List<String>()); Assert.AreEqual(0, variables.VolatileVariables.Count); }
public void TestParseSingle() { var variables = new VariableController(); variables.ParseArguments(@"-key ""value""".Wordify()); VariableModel variableModel = variables.Get(new Command() { Origin = CommandOrigin.Local }, "key").Now.Variables.First(); Assert.AreEqual("value", variableModel.ToType(String.Empty)); Assert.IsTrue(variableModel.Readonly); }