public void CanSetAccessor()
		{
			var mapdoc = new HbmMapping();
			var component = new HbmDynamicComponent();
			var mapper = new DynamicComponentMapper(component, For<Person>.Property(p => p.Info), mapdoc);

			mapper.Access(Accessor.Field);
			Assert.That(component.access, Is.EqualTo("field.camelcase"));
		}
		public void CanSetInsert()
		{
			var mapdoc = new HbmMapping();
			var component = new HbmDynamicComponent();
			var mapper = new DynamicComponentMapper(component, For<Person>.Property(p => p.Info), mapdoc);

			mapper.Insert(false);
			component.insert.Should().Be.False();
		}
		public void CanSetOptimisticLock()
		{
			var mapdoc = new HbmMapping();
			var component = new HbmDynamicComponent();
			var mapper = new DynamicComponentMapper(component, For<Person>.Property(p => p.Info), mapdoc);

			mapper.OptimisticLock(false);
			Assert.That(component.OptimisticLock, Is.False);
		}
		public void CanSetAccessor()
		{
			var mapdoc = new HbmMapping();
			var component = new HbmDynamicComponent();
			var mapper = new DynamicComponentMapper(component, For<Person>.Property(p => p.Info), mapdoc);

			mapper.Access(Accessor.Field);
			component.access.Should().Be("field.camelcase");
		}
		public void CanSetUpdate()
		{
			var mapdoc = new HbmMapping();
			var component = new HbmDynamicComponent();
			var mapper = new DynamicComponentMapper(component, For<Person>.Property(p => p.Info), mapdoc);

			mapper.Update(false);
			Assert.That(component.update, Is.False);
		}
		public void CanAddSimpleProperty()
		{
			var mapdoc = new HbmMapping();
			var component = new HbmDynamicComponent();
			var mapper = new DynamicComponentMapper(component, For<Person>.Property(p => p.Info), mapdoc);
			var dynObject = new { Pizza = 5 };
			mapper.Property(dynObject.GetType().GetProperty("Pizza"), x => { });

			component.Properties.Single().Should().Be.OfType<HbmProperty>().And.ValueOf.Name.Should().Be.EqualTo("Pizza");
		}
		public void CanAddSimpleProperty()
		{
			var mapdoc = new HbmMapping();
			var component = new HbmDynamicComponent();
			var mapper = new DynamicComponentMapper(component, For<Person>.Property(p => p.Info), mapdoc);
			var dynObject = new { Pizza = 5 };
			mapper.Property(dynObject.GetType().GetProperty("Pizza"), x => { });

			Assert.That(component.Properties.Single(), Is.TypeOf<HbmProperty>().And.Property("Name").EqualTo("Pizza"));
		}
		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));

			Assert.That(component.Properties.OfType<HbmAny>().Single().Access, Is.Null.Or.Empty);
		}
		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));

			component.Properties.OfType<HbmDynamicComponent>().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 = 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 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 = (IEnumerable<int>)null }).GetType().GetProperty("A");

			mapper.IdBag(propertyInfo, x => x.Access(Accessor.Field), rel => { });

			component.Properties.OfType<HbmIdbag>().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 = (IEnumerable<int>)null }).GetType().GetProperty("A");

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

			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 = For<Person>.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 = (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 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 = 5 }).GetType().GetProperty("A");
			var called = false;
			mapper.Property(propertyInfo, x => called = true);

			called.Should().Be.True();
		}
		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 = (IDictionary<int, int>)null }).GetType().GetProperty("A");

			mapper.Map(propertyInfo, x => x.Access(Accessor.Field), km => { }, rel => { });

			Assert.That(component.Properties.OfType<HbmMap>().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 = (IDictionary<int, int>)null }).GetType().GetProperty("A");

			mapper.Map(propertyInfo, x => { }, km => { }, rel => { });

			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 = (IDictionary<int, int>)null }).GetType().GetProperty("A");

			var called = false;
			mapper.Map(propertyInfo, x => called = true, km => { }, rel => { });

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

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