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 = (object)null }).GetType().GetProperty("A"); mapper.Any(propertyInfo, typeof(int), x => x.Access(Accessor.Field)); component.Properties.OfType<HbmAny>().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 = (object)null }).GetType().GetProperty("A"); mapper.Any(propertyInfo, typeof(int), 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 = (object)null }).GetType().GetProperty("A"); mapper.Any(propertyInfo, typeof(int), 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 = (object)null }).GetType().GetProperty("A"); var called = false; mapper.Any(propertyInfo, typeof(int), x => called = true); called.Should().Be.True(); }