public void Test_MustBeMapped_WhenPropIsInherited_ShouldRetFalse()
        {
            //---------------Set up test pack-------------------

            var propertyWrapper = MockRepository.GenerateStub<FakePropertyWrapper>();
            propertyWrapper.Stub(wrapper => wrapper.IsPublic).Return(true);
            propertyWrapper.Stub(wrapper => wrapper.IsInherited).Return(true);
            propertyWrapper.Stub(wrapper => wrapper.IsSingleRelationship).Return(true);
            propertyWrapper.Stub(wrapper => wrapper.PropertyInfo).Return(GetFakePropertyInfo());
            propertyWrapper.Stub(wrapper => wrapper.HasOneToOneAttribute).Return(true);
            propertyWrapper.Stub(wrapper => wrapper.DeclaringType).Return(GetFakeTypeWrapper());
            OneToOneAutoMapper mapper = new OneToOneAutoMapper(propertyWrapper);
            //---------------Assert Precondition----------------

            Assert.IsFalse(propertyWrapper.IsStatic);
            Assert.IsTrue(propertyWrapper.IsPublic);
            Assert.IsFalse(propertyWrapper.HasManyToOneAttribute);
            Assert.IsTrue(propertyWrapper.IsSingleRelationship);
            Assert.IsFalse(propertyWrapper.HasIgnoreAttribute);
            Assert.IsTrue(propertyWrapper.HasOneToOneAttribute);
            Assert.IsNotNull(propertyWrapper.PropertyInfo);
            Assert.IsNotNull(propertyWrapper.DeclaringType);

            Assert.IsTrue(propertyWrapper.IsInherited);
            //---------------Execute Test ----------------------
            var mustBeMapped = mapper.MustBeMapped();
            //---------------Test Result -----------------------
            Assert.IsFalse(mustBeMapped);
        }
 public void Test_Map_OwningBoHasFK_ShouldReturnRelatedTypePkName()
 {
     //---------------Set up test pack-------------------
     TypeWrapper ownerType; TypeWrapper relatedType;
     string relatedFKPropName; string owningFKPropName;
     var propertyWrapper
             = GetPropertyWrapper(out ownerType, out relatedType, out relatedFKPropName, out owningFKPropName);
     relatedType.SetHasProperty(relatedFKPropName, true);
     propertyWrapper.SetIsSingleRelationship(true);
     OneToOneAutoMapper autoMapper = new OneToOneAutoMapper(propertyWrapper);
     //---------------Assert Precondition----------------
     Assert.IsFalse(autoMapper.OwningBoHasForeignKey);
     Assert.IsTrue(propertyWrapper.IsSingleRelationship);
     Assert.IsTrue(propertyWrapper.IsPublic);
     Assert.IsFalse(propertyWrapper.IsInherited);
     Assert.IsTrue(autoMapper.MustBeMapped());
     //---------------Execute Test ----------------------
     var relationshipDef = autoMapper.MapOneToOne();
     //---------------Test Result -----------------------
     Assert.IsNotNull(relationshipDef);
     Assert.IsInstanceOf(typeof (SingleRelationshipDef), relationshipDef);
     Assert.IsFalse(relationshipDef.OwningBOHasForeignKey);
     Assert.AreEqual(DeleteParentAction.Prevent, relationshipDef.DeleteParentAction);
 }