コード例 #1
0
 public void MarkAllMethodsAsNotValid(Match match, AssemblyReport instrumentationReport)
 {
     // Did not match so marking all methods as false - can be changed by later validation attempts
     foreach (var exactMethodMatcher in match.ExactMethodMatchers)
     {
         instrumentationReport.AddMethodValidation(match, exactMethodMatcher, false);
     }
 }
コード例 #2
0
        public void CheckExactMethodMatchers(AssemblyReport instrumentationReport, Match match, ClassModel classModel)
        {
            foreach (var exactMethodMatcher in match.ExactMethodMatchers)
            {
                // check if method exists in MethodModels and get MethodModel back
                if (classModel.MethodModels.TryGetValue(exactMethodMatcher.MethodName, out var methodModel))
                {
                    // Check if exactMethodMatcher.Parameters is empty or popluated
                    if (string.IsNullOrWhiteSpace(exactMethodMatcher.Parameters))
                    {
                        // exactMethodMatcher has NO params, checking of MethodModel has an empty ParameterSets value
                        //if (methodModel.ParameterSets.Contains(string.Empty))
                        //{
                        //    instrumentationReport.AddMethodValidation(match, exactMethodMatcher, true);
                        //    continue;
                        //}

                        instrumentationReport.AddMethodValidation(match, exactMethodMatcher, true);
                        continue;
                    }

                    // exactMethodMatcher HAS params to check
                    if (methodModel.ParameterSets.Contains(exactMethodMatcher.Parameters))
                    {
                        instrumentationReport.AddMethodValidation(match, exactMethodMatcher, true);
                        continue;
                    }

                    // param was not found
                    instrumentationReport.AddMethodValidation(match, exactMethodMatcher, false);
                    continue;
                }
                else
                {
                    // Did not find method in classmodel, amrking method as false
                    instrumentationReport.AddMethodValidation(match, exactMethodMatcher, false);
                }
            }
        }
コード例 #3
0
        public void ValidateClass(AssemblyModel assemblyModel, Match match, AssemblyReport instrumentationReport)
        {
            // check if class exists in ClassModels and get ClassModel back
            if (assemblyModel.ClassModels.TryGetValue(match.ClassName, out var classModel))
            {
                CheckExactMethodMatchers(instrumentationReport, match, classModel);
                return;
            }

            foreach (var exactMethodMatcher in match.ExactMethodMatchers)
            {
                instrumentationReport.AddMethodValidation(match, exactMethodMatcher, false);
            }
            // class did not match so marking all methods as false - can be changed by later validation attempts
            //MarkAllMethodsAsNotValid(match, instrumentationReport);
        }