Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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);
        }