예제 #1
0
        public void ToString_PropertyConcatenatedWithSubPath()
        {
            var property = new HypnoGreen.PropertyPath.PropertyPath(
                new Property("Person"),
                new HypnoGreen.PropertyPath.PropertyPath(
                    new ArrayItemProperty("Address", 2),
                    new HypnoGreen.PropertyPath.PropertyPath(
                        new Property("PostalCode"))));

            Assert.AreEqual("Person.Address[2].PostalCode", property.ToString());
        }
예제 #2
0
        public void Evaluate_PropertyIsArray_ReturnsArray()
        {
            var path = new HypnoGreen.PropertyPath.PropertyPath(new Property("Persons"));
            var data = new
            {
                Persons = new[] { "Michael", "Anders", "Andreas" }
            };

            var value = path.ResolveValue(data, new ReflectionPropertyValueResolver());

            Assert.AreEqual(data.Persons, value);
        }
예제 #3
0
        public void ResolveValue_Integer_ReturnsInt()
        {
            var path = new HypnoGreen.PropertyPath.PropertyPath(new Property("Count"));
            var data = new
            {
                Count = 10
            };

            var value = path.ResolveValue <long>(data, new ReflectionPropertyValueResolver());

            Assert.AreEqual(10, value);
        }