Exemplo n.º 1
0
        public void WhenCustomizeAccessorThenIgnore()
        {
            var mapdoc       = new HbmMapping();
            var component    = new HbmDynamicComponent();
            var mapper       = new DynamicComponentMapper(component, For <Person> .Property(p => p.Info), mapdoc);
            var propertyInfo = (new { A = (MyClass)null }).GetType().GetProperty("A");

            mapper.OneToOne(propertyInfo, x => x.Access(Accessor.Field));

            Assert.That(component.Properties.OfType <HbmOneToOne>().Single().Access, Is.Null.Or.Empty);
        }
Exemplo n.º 2
0
        public void WhenAddThenHas()
        {
            var mapdoc       = new HbmMapping();
            var component    = new HbmDynamicComponent();
            var mapper       = new DynamicComponentMapper(component, For <Person> .Property(p => p.Info), mapdoc);
            var propertyInfo = (new { A = (MyClass)null }).GetType().GetProperty("A");

            mapper.OneToOne(propertyInfo, x => { });

            Assert.That(component.Properties.Select(x => x.Name), Is.EquivalentTo(new[] { "A" }));
        }
        public void WhenAddThenHas()
        {
            var mapdoc       = new HbmMapping();
            var component    = new HbmDynamicComponent();
            var mapper       = new DynamicComponentMapper(component, For <Person> .Property(p => p.Info), mapdoc);
            var propertyInfo = (new { A = (MyClass)null }).GetType().GetProperty("A");

            mapper.OneToOne(propertyInfo, x => { });

            component.Properties.Select(x => x.Name).Should().Have.SameSequenceAs("A");
        }
Exemplo n.º 4
0
        public void WhenCustomizeThenCallCustomizer()
        {
            var mapdoc       = new HbmMapping();
            var component    = new HbmDynamicComponent();
            var mapper       = new DynamicComponentMapper(component, For <Person> .Property(p => p.Info), mapdoc);
            var propertyInfo = (new { A = (MyClass)null }).GetType().GetProperty("A");

            var called = false;

            mapper.OneToOne(propertyInfo, x => called = true);

            Assert.That(called, Is.True);
        }