コード例 #1
0
        public bool IncreseCurrentPropertyValue()
        {
            var currentProperty = _propertiesEnumerator.Current;
            var currentValue    = (int)currentProperty.GetValue(_currParams);

            var newValue = currentValue + 1;

            if (!_propertyValidator.CanSetPropertyValue(currentProperty.Name, newValue, _currParams))
            {
                return(false);
            }

            currentProperty.SetValue(_currParams, newValue);

            return(true);
        }
コード例 #2
0
        public Params Create()
        {
            var newParams = new Params();

            var propertyInfos = newParams.GetType().GetProperties();

            foreach (var propertyInfo in propertyInfos)
            {
                int randValue;

                do
                {
                    randValue = _random.Next(1, 100);
                } while (!_propertyValidator.CanSetPropertyValue(propertyInfo.Name, randValue, newParams));

                propertyInfo.SetValue(newParams, randValue);
            }

            return(newParams);
        }