public void CheckMissingParamsAreDetected() { CommandLineParameterCollection mandatoryParams = new CommandLineParameterCollection(); mandatoryParams.Add(new CommandLineParameter("A", String.Empty, String.Empty, true)); mandatoryParams.Add(new CommandLineParameter("B", String.Empty, String.Empty, false)); CommandLineParameterWithValueCollection values = new CommandLineParameterWithValueCollection(); values.Add(new CommandLineParameterWithValue(mandatoryParams[1], String.Empty)); Assert.AreEqual(1, ApplicationParameterValidator.GetMissingMandatoryParams(mandatoryParams, values).Count); Assert.AreEqual("A", ApplicationParameterValidator.GetMissingMandatoryParams(mandatoryParams, values)[0].GetName()); }
private void SetupAndAssert(bool expectedResult, string commandLine, params string[] mandatoryParams) { CommandLineParameterCollection mandatoryList = new CommandLineParameterCollection(); foreach (string s in mandatoryParams) { mandatoryList.Add(new CommandLineParameter(s)); } EnsureAllMandatoryParametersArePresentValidator validator = new EnsureAllMandatoryParametersArePresentValidator(mandatoryList); Assert.AreEqual(expectedResult, validator.IsValid(TestHelper.GetCommandLineParameters(commandLine))); }
private void SetupAndAssert(bool expectedResult, string commandLine, params string[] supportedParams) { CommandLineParameterCollection supportedParamsColl = new CommandLineParameterCollection(); foreach (string s in supportedParams) { supportedParamsColl.Add(new CommandLineParameter(s)); } EnsureSupportedParametersOnlyValidator validator = new EnsureSupportedParametersOnlyValidator(supportedParamsColl, String.Empty); Assert.AreEqual(expectedResult, validator.IsValid(TestHelper.GetCommandLineParameters(commandLine))); }
public void GetReplaceString_WithLParam_WillReturnSearchStringInLowerCase() { CommandLineParameterCollection mandatoryParams = new CommandLineParameterCollection(); mandatoryParams.Add(new CommandLineParameter("S", String.Empty, String.Empty, true)); CommandLineParameterWithValueCollection param = new CommandLineParameterWithValueCollection(); param.Add(new CommandLineParameterWithValue(mandatoryParams[0], "HelloWorld")); param.Add(new CommandLineParameterWithValue(new CommandLineParameter("L", String.Empty, String.Empty, false), string.Empty)); ApplicationParameters values = new ApplicationParameters(param); Assert.AreEqual("HelloWorld", values.GetSearchString()[0]); Assert.AreEqual("helloworld", values.GetReplaceString()[0]); }