public void with_a_property_that_contains_multiple_aliases() { var optionSources = new OptionSource[] { new OptionSource("test", "alternatesecondflagalias", false, "value") }.UseAliases<TestType>(); Assert.AreEqual(1, optionSources.Count()); Assert.NotNull(optionSources.FirstOrDefault(x => x.Name.Equals("secondflag", System.StringComparison.OrdinalIgnoreCase))); Assert.AreEqual("value", optionSources.FirstOrDefault(x => x.Name.Equals("secondflag", System.StringComparison.OrdinalIgnoreCase)).Value); }
public void with_an_empty_string_as_a_value_it_should_return_true_as_the_value() { var normalizedValues = new OptionSource[] { new OptionSource("test", "flag", false, "") }.Normalize(); Assert.AreEqual(1, normalizedValues.Count()); Assert.AreEqual("flag", normalizedValues.First().Name); Assert.AreEqual(true, normalizedValues.First().IsTyped); Assert.AreEqual(true, normalizedValues.First().Value); }
public void with_a_positive_as_a_value_it_should_return_true_as_the_value() { var normalizedValues = new OptionSource[] { new OptionSource("test", "flag", false, "+") }.Normalize(); Assert.AreEqual(1, normalizedValues.Count()); Assert.AreEqual("flag", normalizedValues.First().Name); Assert.AreEqual(true, normalizedValues.First().IsTyped); Assert.AreEqual(true, normalizedValues.First().Value); }