public void TestParseHelpTableWhenGivenTypes() { var result = OptionsParser.ParseHelpTable(typeof(HelpOptions)); HelpInformation resultEntry; Assert.IsTrue(result.TryGetValue("--option-one", out resultEntry)); Assert.AreEqual(HelpOptions.OptionOneHelpText, resultEntry.Summary); Assert.AreEqual(typeof(string), resultEntry.FieldInfo.FieldType); Assert.IsFalse(resultEntry.HasCustomValueDescription); Assert.IsTrue(result.TryGetValue("--option-two", out resultEntry)); Assert.AreEqual(HelpOptions.OptionTwoHelpText, resultEntry.Summary); Assert.AreEqual(typeof(bool), resultEntry.FieldInfo.FieldType); Assert.IsFalse(resultEntry.HasCustomValueDescription); Assert.IsTrue(result.TryGetValue("--option-missing-help-details", out resultEntry)); Assert.IsFalse(result["--option-missing-help-details"].HasSummary); Assert.IsNotNull(result["--option-missing-help-details"].FieldInfo); Assert.IsFalse(resultEntry.HasCustomValueDescription); Assert.IsTrue(result.TryGetValue("--custom-value-description", out resultEntry)); Assert.IsTrue(resultEntry.HasSummary); Assert.AreEqual(typeof(string), resultEntry.FieldInfo.FieldType); Assert.AreEqual("path", resultEntry.CustomValueDescription); Assert.IsTrue(resultEntry.HasCustomValueDescription); Assert.AreEqual(4, result.Count); }
public void TestParseHelpTableWhenGivenAnAssembly() { // Don't be strict with the asserts in this test. We want to keep it flexible. Just make sure // there are more entries in the result than HelpOptions has on it's own. var baseLine = OptionsParser.ParseHelpTable(typeof(OtherOptions)); var result = OptionsParser.ParseHelpTable(typeof(OtherOptions).Assembly); Assert.IsTrue(result.Count > baseLine.Count); }
public void TestHideFromHelp() { var result = OptionsParser.ParseHelpTable(typeof(HelpOptions)); Assert.IsFalse(result.ContainsKey("--option-hidden")); }