public override ICollection<IOccurence> Search(IProgressIndicator progressIndicator)
 {
     UnusedModulesProjectVisitor visitor = new UnusedModulesProjectVisitor(progressIndicator);
     using (ReadLockCookie cookie = ReadLockCookie.Create())
     {
         solution.Accept(visitor);
         emptyResult = visitor.GetTotalUnusedModules() == 0;
         results = visitor.GetSearchResults();
     }
     return EmptyArray<IOccurence>.Instance;
 }
 public void UnusedAssembly()
 {
     Pair<ISolution, IProjectFile> solutionHolder =
         CreateSingleFileSolution("UnusedReferences", "DeclaredVariable.cs", new string[] {"System.Data"});
     try
     {
         IProjectFile projectFile = solutionHolder.Second;
         IProject project = projectFile.GetProject();
         UnusedModulesProjectVisitor visitor = new UnusedModulesProjectVisitor(NullProgressIndicator.INSTANCE);
         project.GetSolution().Accept(visitor);
         ICollection<IModuleReference> modules = visitor.GetUnusedModules(project);
         Assert.AreEqual(1, modules.Count);
         IModuleReference first = CollectionUtil.GetFirst(modules);
         Assert.AreEqual("System.Data", first.Name);
     }
     finally
     {
         SolutionManager.Instance.CloseSolution(solutionHolder.First);
     }
 }