예제 #1
0
        public async Task FindContainingProjects_ProjectFileIsChanged_ReturnsProject()
        {
            await _analyzer.LoadSolution(_vcxprojSolution, CancellationToken.None);

            string project = Path.Combine(TestContext.CurrentContext.TestDirectory, @"Data\SampleProjects\CppClrLibrary\CppClrLibrary.vcxproj");
            var    files   = new List <string> {
                project
            };

            var result = _analyzer.FindContainingProjects(files);

            Assert.AreEqual(result.Count, 1, "There should be exactly 1 changed project");
            Assert.AreEqual(project, result.Single(), "The changed project should match the file passed in");
        }
        public async Task FindDependentProjects_CppProjectChanged_BothProjectsReturned()
        {
            string cppProject      = Path.Combine(TestContext.CurrentContext.TestDirectory, @"Data\SampleProjects\CppClrLibrary\CppClrLibrary.vcxproj");
            var    changedProjects = new List <string> {
                cppProject
            };
            string csProject        = Path.Combine(TestContext.CurrentContext.TestDirectory, @"Data\SampleProjects\FormsAppWithCppReference\FormsAppWithCppReference.csproj");
            var    expectedProjects = new List <AnalysisResult>
            {
                new AnalysisResult("CppClrLibrary", cppProject, 0, "CppClrLibrary.dll"),
                new AnalysisResult("FormsAppWithCppReference", csProject, 1, "FormsAppWithCppReference.dll")
            };

            await _analyzer.LoadSolution(_mixedSolution, CancellationToken.None);

            var result = _analyzer.FindDependentProjects(changedProjects);

            CollectionAssert.AreEquivalent(expectedProjects, result);
        }