コード例 #1
0
        /// <summary>
        /// Determines if a a property with given specification is public settable or not
        /// </summary>
        /// <param name="propertyName"></param>
        /// <param name="propertyCondition"></param>
        /// <param name="propertyContent"></param>
        /// <returns></returns>
        /// ToDo: Make less complex
        public static bool HasPropertyPublicSetter(string propertyName, string propertyCondition,
                                                   string propertyContent)
        {
            if (string.IsNullOrWhiteSpace(propertyContent) && string.IsNullOrEmpty(propertyCondition))
            {
                return(false);
            }

            if (propertyContent != null && string.IsNullOrEmpty(propertyCondition) &&
                propertyContent.Contains(
                    string.Format(MsBuildStringUtilities.FormatProvider, "{0:Property}",
                                  propertyName)))
            {
                return(true);
            }

            if (string.IsNullOrEmpty(propertyCondition))
            {
                return(false);
            }

            RegexFactory factory = new RegexFactory();

            Regex selfIsEmptyCheck = factory.CreatePropertyConditionSelfCheckEmptyRegex(propertyName);

            if (selfIsEmptyCheck.IsMatch(propertyCondition))
            {
                return(true);
            }

            Regex selfIsNotEmptyCheck = factory.CreatePropertyConditionSelfCheckIsNotEmptyEmptyRegex(propertyName);

            return(selfIsNotEmptyCheck.IsMatch(propertyCondition) && !string.IsNullOrWhiteSpace(propertyContent) &&
                   propertyContent.Contains(string.Format(MsBuildStringUtilities.FormatProvider, "{0:Property}",
                                                          propertyName)));
        }
コード例 #2
0
 /// <summary>
 /// Returns a regex for checking the given properties condition for a not-empty-self-check
 /// </summary>
 /// <param name="propertyName"></param>
 /// <returns></returns>
 internal static Regex GetSystemUnderTestForSelfCheckIsNotEmpty(string propertyName)
 {
     return(Factory.CreatePropertyConditionSelfCheckIsNotEmptyEmptyRegex(propertyName));
 }