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); }
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"); }
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); }