public void AnyParsedWithInvalidNames() { const string Name1 = "arg1"; const string Name2 = "arg2"; string[] arguments = new string[] { Switch.GetPrefixedName(Name1), Switch.GetPrefixedName(Name2) }; SwitchCollection switches = new SwitchCollection(); switches.Add(Name1); switches.Add(Name2); ArgumentParser parser = new ArgumentParser(arguments, switches); Assert.IsFalse(parser.AnyParsed(EmptyNames)); Assert.IsFalse(parser.AnyParsed(NoNames)); Assert.IsFalse(m_emptyParser.AnyParsed(EmptyNames)); Assert.IsFalse(m_emptyParser.AnyParsed(NoNames)); parser.Parse(); Assert.IsFalse(parser.AnyParsed(EmptyNames)); Assert.IsFalse(parser.AnyParsed(NoNames)); }
public void AnyParsed() { const string Name1 = "arg1"; const string Name2 = "arg2"; const string Name3 = "arg3"; string[] arguments = new string[] { Switch.GetPrefixedName(Name1), Switch.GetPrefixedName(Name2) }; string[] switchNames1 = new string[] { Name1 }; string[] switchNames2 = new string[] { Name1, Name2 }; string[] switchNames3 = new string[] { Name1, Name2, Name3 }; SwitchCollection switches = new SwitchCollection(); switches.Add(switchNames2); ArgumentParser parser = new ArgumentParser(arguments, switches); Assert.IsFalse(parser.AnyParsed(switchNames1)); Assert.IsFalse(parser.AnyParsed(switchNames2)); Assert.IsFalse(parser.AnyParsed(switchNames3)); Assert.IsFalse(m_emptyParser.AnyParsed(switchNames1)); Assert.IsFalse(m_emptyParser.AnyParsed(switchNames2)); Assert.IsFalse(m_emptyParser.AnyParsed(switchNames3)); parser.Parse(); Assert.IsTrue(parser.AnyParsed(switchNames1)); Assert.IsTrue(parser.AnyParsed(switchNames2)); Assert.IsTrue(parser.AnyParsed(switchNames3)); }