Ejemplo n.º 1
0
        public void BitsTurnsNumberIntoArray()
        {
            var query = new JmesPathQuery(new YamlSerializers());

            var result = (List <object>)query.Search("bits(`9`)", null);

            Assert.AreEqual(2, result.Count());
            Assert.AreEqual(1, result[0]);
            Assert.AreEqual(8, result[1]);
        }
Ejemplo n.º 2
0
        public void MultipleNumbersAreBitwiseOredTogether()
        {
            var query = new JmesPathQuery(new YamlSerializers());

            var result = (List <object>)query.Search("bits(`9`, `5`)", null);

            Assert.AreEqual(3, result.Count());
            Assert.AreEqual(1, result[0]);
            Assert.AreEqual(4, result[1]);
            Assert.AreEqual(8, result[2]);
        }
Ejemplo n.º 3
0
        public void NumbersCanComeFromContext()
        {
            var query   = new JmesPathQuery(new YamlSerializers());
            var context = new Dictionary <string, object>
            {
                { "x", 18 }
            };

            var result = (List <object>)query.Search("bits(x)", context);

            Assert.AreEqual(2, result.Count());
            Assert.AreEqual(2, result[0]);
            Assert.AreEqual(16, result[1]);
        }