예제 #1
0
        public void RepeatLastWhenAlreadyRunning()
        {
            CodeSweep.VSPackage.BackgroundScanner_Accessor accessor = GetScanner();

            Project        project   = Utilities.SetupMSBuildProject(new string[] { Utilities.CreateBigFile() }, new string[] { CreateMinimalTermTableFile() });
            MockIVsProject vsProject = Utilities.RegisterProjectWithMocks(project, _serviceProvider);

            accessor.Start(new IVsProject[] { vsProject });
            accessor.RepeatLast();
        }
예제 #2
0
        public void RepeatLastProducesSameResultsAsPreviousScan()
        {
            CodeSweep.VSPackage.BackgroundScanner_Accessor accessor = GetScanner();

            string         firstFile  = Utilities.CreateTempTxtFile("foo abc foo def foo");
            string         secondFile = Utilities.CreateTempTxtFile("bar bar bar floop doop bar");
            string         termTable1 = Utilities.CreateTermTable(new string[] { "foo", "bar" });
            string         termTable2 = Utilities.CreateTermTable(new string[] { "floop" });
            Project        project1   = Utilities.SetupMSBuildProject(new string[] { firstFile, secondFile }, new string[] { termTable1, termTable2 });
            MockIVsProject vsProject1 = Utilities.RegisterProjectWithMocks(project1, _serviceProvider);

            string         thirdFile  = Utilities.CreateTempTxtFile("blarg");
            string         termTable3 = Utilities.CreateTermTable(new string[] { "blarg" });
            Project        project2   = Utilities.SetupMSBuildProject(new string[] { thirdFile }, new string[] { termTable3 });
            MockIVsProject vsProject2 = Utilities.RegisterProjectWithMocks(project2, _serviceProvider);

            accessor.Start(new IVsProject[] { vsProject1, vsProject2 });

            Utilities.WaitForStop(accessor);

            List <int>   resultCounts = new List <int>();
            MockTaskList taskList     = _serviceProvider.GetService(typeof(SVsTaskList)) as MockTaskList;

            taskList.OnRefreshTasks += delegate(object sender, MockTaskList.RefreshTasksArgs args)
            {
                resultCounts.Add(Utilities.TasksOfProvider(args.Provider).Count);
            };

            accessor.RepeatLast();

            Utilities.WaitForStop(accessor);

            Assert.AreEqual(4, resultCounts.Count, "Task list did not recieve correct number of updates.");
            Assert.AreEqual(0, resultCounts[0], "Number of hits in first update is wrong.");
            Assert.AreEqual(3, resultCounts[1], "Number of hits in second update is wrong.");
            Assert.AreEqual(3 + 5, resultCounts[2], "Number of hits in third update is wrong.");
            Assert.AreEqual(3 + 5 + 1, resultCounts[3], "Number of hits in fourth update is wrong.");
        }
예제 #3
0
 public void RepeatLastWithNoPreviousScan()
 {
     CodeSweep.VSPackage.BackgroundScanner_Accessor accessor = GetScanner();
     accessor.RepeatLast();
 }