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.ManyToOne(propertyInfo, x => x.Access(Accessor.Field)); component.Properties.OfType<HbmManyToOne>().Single().Access.Should().Be.NullOrEmpty(); }
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.ManyToOne(propertyInfo, x => { }); component.Properties.Select(x => x.Name).Should().Have.SameSequenceAs("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.ManyToOne(propertyInfo, x => { }); Assert.That(component.Properties.Select(x => x.Name), Is.EquivalentTo(new[] { "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.ManyToOne(propertyInfo, x => called = true); called.Should().Be.True(); }