public void CodeFileCollectionWebProject()
 {
     Project testProject = (Project)(extensibility.Solution.Projects.Item(4));
     CodeFileCollection collection = new CodeFileCollection(testProject);
     String[] names = new string[] {"Class1.vb", "Default.aspx.cs" };
     this.MatchArrayAndCollection(names, collection);
 }
 public void CodeFileCollectionVBProject()
 {
     Project testProject = (Project)(extensibility.Solution.Projects.Item(2));
     CodeFileCollection collection = new CodeFileCollection(testProject);
     String[] names = new string[] { "Form1.vb", "AssemblyInfo.vb", "Comment Test.vb"};
     this.MatchArrayAndCollection(names, collection);
 }
 public void CodeFileCollectionSimpleProjectTest()
 {
     Project testProject = (Project)(extensibility.Solution.Projects.Item(1));
     CodeFileCollection collection = new CodeFileCollection(testProject);
     String[] names = new string[] { "AssemblyInfo.cs", "CommentTest.cs"};
     this.MatchArrayAndCollection(names, collection);
 }
 public void CodeFileCollectionCSharpProject()
 {
     Project testProject = (Project)(extensibility.Solution.Projects.Item(3));
     CodeFileCollection collection = new CodeFileCollection(testProject);
     String[] names = new string[] { "AssemblyInfo.cs", "Form1.cs", "Program.cs" };
     this.MatchArrayAndCollection(names, collection);
 }
 /// <summary>
 /// Tests if array of file names matches to the files in the collection
 /// </summary>
 /// <param name="names"></param>
 /// <param name="collection"></param>
 private void MatchArrayAndCollection(String[] names, CodeFileCollection collection)
 {
     Assert.AreEqual(names.Length, collection.Count, Messages.CodeFilesCountInvalid);
     foreach (string name in names)
     {
         Assert.IsNotNull(collection.GetCodeFile(name), Messages.CodeFileNotFound);
     }
 }
        public void CodeFileCollectionWebProject()
        {
            Project            testProject = (Project)(extensibility.Solution.Projects.Item(4));
            CodeFileCollection collection  = new CodeFileCollection(testProject);

            String[] names = new string[] { "Class1.vb", "Default.aspx.cs" };
            this.MatchArrayAndCollection(names, collection);
        }
        public void CodeFileCollectionCSharpProject()
        {
            Project            testProject = (Project)(extensibility.Solution.Projects.Item(3));
            CodeFileCollection collection  = new CodeFileCollection(testProject);

            String[] names = new string[] { "AssemblyInfo.cs", "Form1.cs", "Program.cs" };
            this.MatchArrayAndCollection(names, collection);
        }
        public void CodeFileCollectionVBProject()
        {
            Project            testProject = (Project)(extensibility.Solution.Projects.Item(2));
            CodeFileCollection collection  = new CodeFileCollection(testProject);

            String[] names = new string[] { "Form1.vb", "AssemblyInfo.vb", "Comment Test.vb" };
            this.MatchArrayAndCollection(names, collection);
        }
        public void CodeFileCollectionSimpleProjectTest()
        {
            Project            testProject = (Project)(extensibility.Solution.Projects.Item(1));
            CodeFileCollection collection  = new CodeFileCollection(testProject);

            String[] names = new string[] { "AssemblyInfo.cs", "CommentTest.cs" };
            this.MatchArrayAndCollection(names, collection);
        }
 /// <summary>
 /// Finds all instances of a text in the code files contained by the provided project
 /// </summary>
 /// <param name="project">Project to search</param>
 /// <param name="text">Text to look for</param>
 /// <returns>A collection of BaseHardCodedString implementations</returns>
 public static ReadOnlyCollection<BaseHardCodedString> FindAllInstancesInProject(Project project, string text)
 {
     Collection<BaseHardCodedString> instances = new Collection<BaseHardCodedString>();
     CodeFileCollection codeFiles = new CodeFileCollection(project);
     foreach (ProjectItem item in codeFiles)
     {
         foreach (BaseHardCodedString instance in FindAllInstancesInDocument(item, text))
         {
             instances.Add(instance);
         }
     }
     return new ReadOnlyCollection<BaseHardCodedString>(instances);
 }
 /// <summary>
 /// Tests if array of file names matches to the files in the collection
 /// </summary>
 /// <param name="names"></param>
 /// <param name="collection"></param>
 private void MatchArrayAndCollection(String[] names, CodeFileCollection collection)
 {
     Assert.AreEqual(names.Length, collection.Count, Messages.CodeFilesCountInvalid);
     foreach (string name in names)
     {
         Assert.IsNotNull(collection.GetCodeFile(name), Messages.CodeFileNotFound);
     }
 }