示例#1
0
        public void LogProblem(string exceptionText, BindingValue value = null, PropertyInfo property = null)
        {
            var problem = new ConvertProblem {
                ExceptionText = exceptionText,
                Item          = Object,
                Property      = property,
                Value         = value
            };

            _problems.Add(problem);
        }
示例#2
0
 public bool Equals(BindingValue other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.RawKey, RawKey) && Equals(other.Source, Source) && Equals(other.RawValue, RawValue));
 }
示例#3
0
        public void SetUp()
        {
            _registry = new BindingRegistry();
            _property = typeof (PropertyHolder).GetProperty("Property");
            _numericTypeFamily = _registry.AllConverterFamilies().FirstOrDefault(cf =>
                                                                   cf.Matches(_property)) as NumericTypeFamily;
            _numericTypeFamily.ShouldNotBeNull();

            _context = MockRepository.GenerateMock<IPropertyContext>();
            _context.Stub(x => x.Property).Return(_property);
            _propertyValue = new BindingValue { RawValue = "1.000,001" };
            _context.Expect(c => c.RawValueFromRequest).Return(_propertyValue).Repeat.Times(4);
        }
示例#4
0
 public void ForProperty(PropertyInfo property, Action <IPropertyContext> action)
 {
     try
     {
         var propertyContext = new PropertyContext(this, _locator, property);
         action(propertyContext);
     }
     catch (Exception ex)
     {
         BindingValue value = null;
         _requestData.Value(property.Name, o => value = o);
         LogProblem(ex, value, property);
     }
 }
        public BindingValue RawValue(string name)
        {
            BindingValue value = null;

            _namingStrategies.Any(naming =>
            {
                string n = naming(name);
                return(_rawData.Value(n, x => value = x));
            });

            if (value != null)
            {
                _logger.UsedValue(value);
            }

            return(value);
        }
示例#6
0
 public void LogProblem(Exception ex, BindingValue value = null, PropertyInfo property = null)
 {
     LogProblem(ex.ToString(), value, property);
 }
示例#7
0
 public bool Equals(BindingValue other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.RawKey, RawKey) && Equals(other.Source, Source) && Equals(other.RawValue, RawValue);
 }