Esempio n. 1
0
        public void AllItemsInProjectTest()
        {
            CodeSweep.VSPackage.BuildManager_Accessor accessor = new CodeSweep.VSPackage.BuildManager_Accessor(_serviceProvider);

            Microsoft.Build.Evaluation.Project project = Utilities.SetupMSBuildProject();
            string projectFolder = Path.GetDirectoryName(project.FullPath);

            project.Xml.AddItem("foo", "blah.txt");
            project.Xml.AddItem("bar", "blah2.cs");
            project.Xml.AddItem("bar", "My.Namespace.Etc");
            project.Xml.AddItem("bar", "blah3.vsmdi");

            // Create the files on disk, otherwise AllItemsInProject will exclude them.
            File.WriteAllText(projectFolder + "\\blah.txt", "");
            File.WriteAllText(projectFolder + "\\blah2.cs", "");
            File.WriteAllText(projectFolder + "\\blah3.vsmdi", "");

            MockIVsProject vsProject = Utilities.RegisterProjectWithMocks(project, _serviceProvider);

            string projectDir = Path.GetDirectoryName(project.FullPath);

            List <string> items = Utilities.ListFromEnum(accessor.AllItemsInProject(vsProject));

            Assert.AreEqual(3, items.Count, "AllItemsInProject returned wrong number of items.");
            CollectionAssert.Contains(items, projectDir + "\\blah.txt", "AllItemsInProject did not return blah.txt.");
            CollectionAssert.Contains(items, projectDir + "\\blah2.cs", "AllItemsInProject did not return blah2.cs.");
            CollectionAssert.Contains(items, projectDir + "\\blah3.vsmdi", "AllItemsInProject did not return blah3.vsmdi.");
            CollectionAssert.DoesNotContain(items, "My.Namespace.Etc", "AllItemsInProject returned Reference entry.");
        }
Esempio n. 2
0
 public void AllItemsInProjectWithNullArg()
 {
     CodeSweep.VSPackage.BuildManager_Accessor accessor = new CodeSweep.VSPackage.BuildManager_Accessor(_serviceProvider);
     accessor.AllItemsInProject(null);
 }