コード例 #1
0
 private boolean isExcludedFromCoverage(Resource resource) {
   if (excludedAssemblies.isEmpty()) {
     return false;
   }
   Project project = resourceHelper.findParentProject(resource);
   VisualStudioProject vsProject = vsSolution.getProjectFromSonarProject(project);
   return excludedAssemblies.contains(vsProject.getName());
 }
コード例 #2
0
  @BeforeClass
  public static void init() {
    aRule = Rule.create("gendarme", "Rule", "Rule").setSeverity(RulePriority.BLOCKER);
    aFileIMoney = new org.sonar.api.resources.File("IMoney");
    aFileMoney = new org.sonar.api.resources.File("Money");

    env = mock(MicrosoftWindowsEnvironment.class);
    VisualStudioSolution solution = mock(VisualStudioSolution.class);
    when(env.getCurrentSolution()).thenReturn(solution);
    VisualStudioProject vsProject = mock(VisualStudioProject.class);
    when(solution.getProjectFromSonarProject(any(Project.class))).thenReturn(vsProject);
    when(solution.getProject(any(File.class))).thenReturn(vsProject);

    project = mock(Project.class);
    ProjectFileSystem fileSystem = mock(ProjectFileSystem.class);
    when(fileSystem.getSourceDirs()).thenReturn(Lists.newArrayList(new File("C:\\Sonar\\Example")));
    when(project.getFileSystem()).thenReturn(fileSystem);
    resourcesBridge = createFakeBridge();

    resourceHelper = mock(ResourceHelper.class);
    when(resourceHelper.isResourceInProject(any(Resource.class), eq(project))).thenReturn(true);
  }