Beispiel #1
0
        public override bool Execute()
        {
            var taskSuccess = true;

            var config = TaskUtilities.TryGetConfig(AnalysisConfigDir, new MSBuildLoggerAdapter(Log));

            if (config != null)
            {
                var regEx = TryGetRegularExpression(config);

                try
                {
                    IsTest = !string.IsNullOrEmpty(regEx) && Regex.IsMatch(FullFilePath, regEx, RegexOptions.IgnoreCase);
                }
                catch (ArgumentException ex) // thrown for invalid regular expressions
                {
                    taskSuccess = false;
                    Log.LogError(Resources.IsTest_InvalidRegularExpression, regEx, ex.Message, TestRegExSettingId);
                }
            }

            return(!Log.HasLoggedErrors && taskSuccess);
        }
Beispiel #2
0
        public override bool Execute()
        {
            var taskSuccess = true;

            var config = TaskUtilities.TryGetConfig(AnalysisConfigDir, new MSBuildLoggerAdapter(Log));

            if (config != null)
            {
                var regEx = TryGetRegularExpression(config);

                try
                {
                    // Let's use a case sensitive regex (default behavior)
                    IsTest = Regex.IsMatch(FullFilePath, regEx);
                }
                catch (ArgumentException ex) // thrown for invalid regular expressions
                {
                    taskSuccess = false;
                    Log.LogError(Resources.IsTest_InvalidRegularExpression, regEx, ex.Message, TestRegExSettingId);
                }
            }

            return(!Log.HasLoggedErrors && taskSuccess);
        }