Пример #1
0
        public void GetPropertyType_checks_each()
        {
            var composite = PropertyProvider.Compose(
                PropertyProvider.FromValue(new { a = 1, b = 2.0 }),
                PropertyProvider.FromValue(new { c = "1", d = 2.0m })
                );

            Assert.Equal(typeof(string), composite.GetPropertyType("c"));
        }
Пример #2
0
        public void TryGetProperty_checks_each()
        {
            var composite = PropertyProvider.Compose(
                PropertyProvider.FromValue(new { a = "1", b = "2" }),
                PropertyProvider.FromValue(new { c = "1", d = "2" })
                );

            object result;

            Assert.True(composite.TryGetProperty("c", out result));
            Assert.Equal("1", result);
        }
Пример #3
0
 public HxlTemplateContext(object owner)
 {
     _self        = Properties.FromValue(this);
     _ownerValues = owner == null ? Properties.Null : Properties.FromValue(owner);
     _selfValues  = PropertyProvider.Compose(_ownerValues, _self, DataProviders);
 }
Пример #4
0
        public void Compose_will_apply_optimal_composite_on_nulls()
        {
            var original = new Properties();

            Assert.Same(original, PropertyProvider.Compose(PropertyProvider.Null, original, PropertyProvider.Null));
        }
Пример #5
0
 public void Compose_converts_null_to_Null_provider()
 {
     Assert.Same(PropertyProvider.Null, PropertyProvider.Compose(null, null));
 }