예제 #1
0
 private static void SetHasDefaultAttribute(PropertyWrapper wrapper, bool hasDefault, string defaultValue)
 {
     wrapper.Stub(wrapper1 => wrapper1.HasDefaultAttribute).Return(hasDefault);
     if (hasDefault)
     {
         wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute <AutoMapDefaultAttribute>()).Return(
             new AutoMapDefaultAttribute(defaultValue));
     }
 }
예제 #2
0
 private static void SetHasDisplayNameAttribute(PropertyWrapper wrapper, bool hasDisplayName, string displayName)
 {
     wrapper.Stub(wrapper1 => wrapper1.HasDisplayNameAttribute).Return(hasDisplayName);
     if (hasDisplayName)
     {
         wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute <AutoMapDisplayNameAttribute>()).Return(
             new AutoMapDisplayNameAttribute(displayName));
     }
 }
예제 #3
0
        private static PropertyWrapper GetMockPropWrapper()
        {
            PropertyWrapper wrapper = MockRepository.GenerateMock <FakePropertyWrapper>();

            wrapper.Stub(wrapper1 => wrapper1.IsPublic).Return(true);
            wrapper.Stub(wrapper1 => wrapper1.UnderlyingPropertyType).Return(typeof(bool));
            wrapper.Stub(wrapper1 => wrapper1.Name).Return(GetRandomString());
            return(wrapper);
        }
 private void SetStringLengthPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper,int minLength,int maxLength)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute<AutoMapStringLengthPropRuleAttribute>()).Return(
            new AutoMapStringLengthPropRuleAttribute(minLength,maxLength));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasStringLengthRuleAttribute).Return(true);
 }
 private static void SetShortPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper, short minValue, short maxValue)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute<AutoMapShortPropRuleAttribute>()).Return(
             new AutoMapShortPropRuleAttribute(minValue, maxValue));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasShortPropRuleAttribute).Return(true);
 }
 private static void SetIntPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute<AutoMapIntPropRuleAttribute>()).Return(
             new AutoMapIntPropRuleAttribute());
     wrapper.Stub(propertyWrapper => propertyWrapper.HasIntPropRuleAttribute).Return(true);
 }
 private static void SetReadWriteAttribute(PropertyWrapper wrapper, PropReadWriteRule rule)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute<AutoMapReadWriteRuleAttribute>()).Return(
             new AutoMapReadWriteRuleAttribute(rule));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasReadWriteRuleAttribute).Return(true);
 }
 private static void SetHasDisplayNameAttribute(PropertyWrapper wrapper, bool hasDisplayName, string displayName)
 {
     wrapper.Stub(wrapper1 => wrapper1.HasDisplayNameAttribute).Return(hasDisplayName);
     if (hasDisplayName)
     {
         wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute<AutoMapDisplayNameAttribute>()).Return(
             new AutoMapDisplayNameAttribute(displayName));
     }
 }
 private static void SetHasDefaultAttribute(PropertyWrapper wrapper, bool hasDefault, string defaultValue)
 {
     wrapper.Stub(wrapper1 => wrapper1.HasDefaultAttribute).Return(hasDefault);
     if(hasDefault)
     {
         wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute<AutoMapDefaultAttribute>()).Return(
             new AutoMapDefaultAttribute(defaultValue));
     }
 }
예제 #10
0
 private void SetStringLengthPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper, int minLength, int maxLength)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute <AutoMapStringLengthPropRuleAttribute>()).Return(
         new AutoMapStringLengthPropRuleAttribute(minLength, maxLength));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasStringLengthRuleAttribute).Return(true);
 }
예제 #11
0
 private static void SetShortPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute <AutoMapShortPropRuleAttribute>()).Return(
         new AutoMapShortPropRuleAttribute());
     wrapper.Stub(propertyWrapper => propertyWrapper.HasShortPropRuleAttribute).Return(true);
 }
예제 #12
0
 private static void SetReadWriteAttribute(PropertyWrapper wrapper, PropReadWriteRule rule)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute <AutoMapReadWriteRuleAttribute>()).Return(
         new AutoMapReadWriteRuleAttribute(rule));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasReadWriteRuleAttribute).Return(true);
 }
예제 #13
0
 private static void SetStringPatternMatchPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper, string regexPattern, string message)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute <AutoMapStringPatternMatchPropRuleAttribute>()).Return(
         new AutoMapStringPatternMatchPropRuleAttribute(regexPattern, message));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasStringPatternMatchRuleAttribute).Return(true);
 }
예제 #14
0
 private void SetDateTimeStringPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper, string startDate, string endDate)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute <AutoMapDateTimePropRuleAttribute>()).Return(
         new AutoMapDateTimePropRuleAttribute(startDate, endDate));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasDateTimeStringRuleAttribute).Return(true);
 }
 private void SetDateTimeStringPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper, string startDate, string endDate)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute<AutoMapDateTimePropRuleAttribute>()).Return(
            new AutoMapDateTimePropRuleAttribute(startDate, endDate));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasDateTimeStringRuleAttribute).Return(true);
 }
 private static void SetStringPatternMatchPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper, string regexPattern, string message)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute<AutoMapStringPatternMatchPropRuleAttribute>()).Return(
           new AutoMapStringPatternMatchPropRuleAttribute(regexPattern, message));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasStringPatternMatchRuleAttribute).Return(true);
 }
        private static void SetupMockPropWrapper(PropertyWrapper propertyWrapper, TypeWrapper ownerType, TypeWrapper relatedType, string relationshipName, string reverseRelName)
        {
            propertyWrapper.SetName(relationshipName);
            propertyWrapper.SetDeclaringType(ownerType);
            propertyWrapper.SetOneToOneReverseRelName(reverseRelName);
            propertyWrapper.SetRelatedType(relatedType);
            propertyWrapper.Stub(wrapper => wrapper.HasSingleReverseRelationship).Return(true);
            propertyWrapper.Stub(wrapper1 => wrapper1.IsPublic).Return(true);

            propertyWrapper.Stub(wrapper => wrapper.PropertyInfo).Return(MockRepository.GenerateMock<FakePropertyInfo>());
        }
예제 #18
0
 private static void SetIntPropRuleAttributeWithDefaultConstructor(PropertyWrapper wrapper, int minValue, int maxValue)
 {
     wrapper.Stub(propertyWrapper => propertyWrapper.GetAttribute <AutoMapIntPropRuleAttribute>()).Return(
         new AutoMapIntPropRuleAttribute(minValue, maxValue));
     wrapper.Stub(propertyWrapper => propertyWrapper.HasIntPropRuleAttribute).Return(true);
 }