예제 #1
0
        public void parse_options_as_values()
        {
            var options = new Option[] { new Option("a"), new Option("b"), new Option("c") };

            var text = Option.Write(options);

            var options2 = Option.ParseText(text);

            options2.ShouldHaveTheSameElementsAs(options);
        }
예제 #2
0
        public static string Write(Option[] options)
        {
            if (options == null || options.Length == 0) return string.Empty;

            if (options.All(x => x.display == x.value))
            {
                return options.Select(x => x.value).Join(", ");
            }
            else
            {
                return options.Select(x => x.ToString()).Join(", ");
            }
        }
예제 #3
0
 protected bool Equals(Option other)
 {
     return string.Equals(display, other.display) && string.Equals(value, other.value);
 }
예제 #4
0
        public void set_selection_options_throug_fi()
        {
            var opt1 = new Option {display = "One", value = "1"};
            var opt2 = new Option {display = "Two", value = "2"};

            var cell = Cell.For<CellTarget>(x => x.Number);
            cell.As<ICellExpression>().SelectionOptions(opt1, opt2).ShouldBeSameAs(cell);

            cell.options
                .ShouldHaveTheSameElementsAs(opt1, opt2);
        }
예제 #5
0
        public void write_options_that_are_all_values()
        {
            var options = new Option[] {new Option("a"), new Option("b"), new Option("c")};

            Option.Write(options).ShouldBe("a, b, c");
        }
예제 #6
0
        public void write_options_that_have_key_value_pairs()
        {
            var options = new Option[] { new Option("a", "1"), new Option("b", "2"), new Option("c", "3") };

            Option.Write(options).ShouldBe("a=1, b=2, c=3");
        }