Example #1
0
        protected virtual bool MakeSimpleChange(TEntity entity)
        {
            if (string.IsNullOrEmpty(SimpleChangePropertyName))
            {
                return(false);
            }

            var fieldName = SimpleChangePropertyName.ToUpper();
            var property  = Properties.Value[fieldName];

            if (property == null)
            {
                throw new Exception(string.Format("Не найдено свойство {0} для simple change.", fieldName));
            }
            property.SetValue(entity, GetTestValueByType(property.PropertyType));

            return(true);
        }
Example #2
0
        protected virtual void CheckSimpleChange(TEntity entity, TEntity updated)
        {
            if (string.IsNullOrEmpty(SimpleChangePropertyName))
            {
                throw new Exception("CheckSimpleChange can be called only if SimpleChangePropertyName is exists.");
            }

            var fieldName = SimpleChangePropertyName.ToUpper();
            var property  = Properties.Value[fieldName];

            if (property == null)
            {
                throw new Exception(string.Format("Не найдено свойство {0} для simple change.", fieldName));
            }

            var updatedValue = property.GetValue(updated);
            var sourceValue  = GetTestValueByType(property.PropertyType);

            updatedValue.ShouldBeEquivalentTo(sourceValue);
        }