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.Component(propertyInfo, (IComponentMapper x) => { }); Assert.That(component.Properties.Select(x => x.Name), Is.EquivalentTo(new[] { "A" })); }
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.Component(propertyInfo, (IComponentMapper x) => x.Access(Accessor.Field)); component.Properties.OfType <HbmComponent>().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.Component(propertyInfo, (IComponentMapper x) => { }); component.Properties.Select(x => x.Name).Should().Have.SameSequenceAs("A"); }
public void WhenAddThenHasGeneric() { var mapdoc = new HbmMapping(); var component = new HbmDynamicComponent(); var mapper = new DynamicComponentMapper(component, For <PersonWithGenericInfo> .Property(p => p.Info), mapdoc); var propertyInfo = For <PersonWithGenericInfo> .Property(p => p.Info); //just as another dyn-compo mapper.Component(propertyInfo, (IDynamicComponentMapper x) => { }); Assert.That(component.Properties.Select(x => x.Name), Is.EquivalentTo(new[] { "Info" })); }
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 = For <Person> .Property(p => p.Info); //just as another dyn-compo mapper.Component(propertyInfo, (IDynamicComponentMapper x) => x.Access(Accessor.Field)); Assert.That(component.Properties.OfType <HbmDynamicComponent>().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 = For <Person> .Property(p => p.Info); //just as another dyn-compo mapper.Component(propertyInfo, (IDynamicComponentMapper x) => { }); component.Properties.Select(x => x.Name).Should().Have.SameSequenceAs("Info"); }
public void WhenCustomizeAccessorThenIgnoreGeneric() { var mapdoc = new HbmMapping(); var component = new HbmDynamicComponent(); var mapper = new DynamicComponentMapper(component, For <PersonWithGenericInfo> .Property(p => p.Info), mapdoc); var propertyInfo = (new { A = (MyClass)null }).GetType().GetProperty("A"); mapper.Component(propertyInfo, (IComponentMapper x) => x.Access(Accessor.Field)); Assert.That(component.Properties.OfType <HbmComponent>().Single().Access, Is.Null.Or.Empty); }
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.Component(propertyInfo, (IComponentMapper x) => called = true); called.Should().Be.True(); }
public void WhenCustomizeThenCallCustomizerGeneric() { var mapdoc = new HbmMapping(); var component = new HbmDynamicComponent(); var mapper = new DynamicComponentMapper(component, For <PersonWithGenericInfo> .Property(p => p.Info), mapdoc); var propertyInfo = For <PersonWithGenericInfo> .Property(p => p.Info); //just as another dyn-compo var called = false; mapper.Component(propertyInfo, (IDynamicComponentMapper x) => called = true); Assert.That(called, Is.True); }
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 = For <Person> .Property(p => p.Info); //just as another dyn-compo var called = false; mapper.Component(propertyInfo, (IDynamicComponentMapper x) => called = true); called.Should().Be.True(); }
public void WhenCustomizeThenCallCustomizerGeneric() { var mapdoc = new HbmMapping(); var component = new HbmDynamicComponent(); var mapper = new DynamicComponentMapper(component, For <PersonWithGenericInfo> .Property(p => p.Info), mapdoc); var propertyInfo = (new { A = (MyClass)null }).GetType().GetProperty("A"); var called = false; mapper.Component(propertyInfo, (IComponentMapper x) => called = true); Assert.That(called, Is.True); }