Example #1
0
        public void HandleKeyValuePair()
        {
            var values   = new KeyValuePair <string, bool>("apple", true);
            var expected = "apple";

            CN.Create(values).ShouldBe(expected);
        }
Example #2
0
        public void HandleTupleWithFunction()
        {
            var values   = ("apple", new Func <bool>(() => true));
            var expected = "apple";

            CN.Create(values).ShouldBe(expected);
        }
Example #3
0
        public void HandleTuple()
        {
            var values   = ("apple", true);
            var expected = "apple";

            CN.Create(values).ShouldBe(expected);
        }
Example #4
0
        public void HandleFunction()
        {
            var values   = new Func <string>(() => "apple");
            var expected = "apple";

            CN.Create(values).ShouldBe(expected);
        }
Example #5
0
        public void HandleKeyValuePairWithFunction()
        {
            var values   = new KeyValuePair <string, Func <bool> >("apple", new Func <bool>(() => true));
            var expected = "apple";

            CN.Create(values).ShouldBe(expected);
        }
Example #6
0
        public void HandleKeyValuePairs()
        {
            var values = new object[]
            {
                new KeyValuePair <string, bool>("apple", true),
                new KeyValuePair <string, bool>("banana", false),
                new KeyValuePair <string, bool>("cherry", true)
            };
            var expected = "apple cherry";

            CN.Create(values).ShouldBe(expected);
        }
Example #7
0
        public void HandleTuples()
        {
            var values = new object[]
            {
                ("apple", true),
                ("banana", false),
                ("cherry", true)
            };
            var expected = "apple cherry";

            CN.Create(values).ShouldBe(expected);
        }
Example #8
0
        public void HandleFunctions()
        {
            var values = new Func <string>[]
            {
                () => "apple",
                () => null,
                () => "banana",
            };
            var expected = "apple banana";

            CN.Create(values).ShouldBe(expected);
        }
Example #9
0
        public void HandleDictionary()
        {
            var values = new Dictionary <string, bool>()
            {
                { "apple", true },
                { "banana", false },
                { "cherry", true },
            };
            var expected = "apple cherry";

            CN.Create(values).ShouldBe(expected);
        }
Example #10
0
        public void HandleTuplesWithFunctions()
        {
            var falseFunc = new Func <bool>(() => false);
            var trueFunc  = new Func <bool>(() => true);

            var values = new object[]
            {
                ("apple", trueFunc),
                ("banana", falseFunc),
                ("cherry", trueFunc)
            };
            var expected = "apple cherry";

            CN.Create(values).ShouldBe(expected);
        }
Example #11
0
        public void HandleDictionaryWithFunction()
        {
            var falseFunc = new Func <bool>(() => false);
            var trueFunc  = new Func <bool>(() => true);

            var values = new Dictionary <string, Func <bool> >()
            {
                { "apple", trueFunc },
                { "banana", falseFunc },
                { "cherry", trueFunc },
            };
            var expected = "apple cherry";

            CN.Create(values).ShouldBe(expected);
        }
Example #12
0
        public void HandleKeyValuePairsWithFunctions()
        {
            var falseFunc = new Func <bool>(() => false);
            var trueFunc  = new Func <bool>(() => true);

            var values = new object[]
            {
                new KeyValuePair <string, Func <bool> >("apple", trueFunc),
                new KeyValuePair <string, Func <bool> >("banana", falseFunc),
                new KeyValuePair <string, Func <bool> >("cherry", trueFunc)
            };
            var expected = "apple cherry";

            CN.Create(values).ShouldBe(expected);
        }
Example #13
0
        public void HandleAllCombinations()
        {
            var falseFunc     = new Func <bool>(() => false);
            var trueFunc      = new Func <bool>(() => true);
            var jackfruitFunc = new Func <string>(() => "jackfruit");

            var values = new object[]
            {
                "apple",
                null,
                new string[] { "banana", "cherry" },
                " ",
                ("durian", true),
                ("ignore", false),
                ("elderberry", trueFunc),
                ("ignore", falseFunc),
                "\t",
                new Dictionary <string, bool>()
                {
                    { "fig", true },
                    { "ignore", false }
                },
                new Dictionary <string, Func <bool> >()
                {
                    { "grape", trueFunc },
                    { "ignore", falseFunc }
                },
                new KeyValuePair <string, bool>("hackberry", true),
                new KeyValuePair <string, bool>("ignore", false),
                new KeyValuePair <string, Func <bool> >("imbe", trueFunc),
                new KeyValuePair <string, Func <bool> >("ignore", falseFunc),
                jackfruitFunc,
            };
            var expected = "apple banana cherry durian elderberry fig grape hackberry imbe jackfruit";

            CN.Create(values).ShouldBe(expected);
        }
Example #14
0
 public void HandleStrings(object[] values, string expected)
 {
     CN.Create(values).ShouldBe(expected);
 }
Example #15
0
 public void IgnoreNullOrWhitespaceValues(params object[] values)
 {
     CN.Create(values).ShouldBe(String.Empty);
 }