public void SetUp()
		{
			solution = new Solution();
			
			// Create a project to display in the test tree view.
			project = new MockCSharpProject(solution, "TestProject");
			ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
			
			// Add a test class with a TestFixture attributes.
			projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			testClass1 = new MockClass(projectContent, "Project.Tests.MyTestFixture");
			testClass1.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(testClass1);
			
			testClass2 = new MockClass(projectContent, "Project.MyTestFixture");
			testClass2.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(testClass2);
						
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			dummyTreeView = new DummyParserServiceTestTreeView(testFrameworks);
			dummyTreeView.ProjectContentForProject = projectContent;
			
			// Load the projects into the test tree view.
			treeView = dummyTreeView as TestTreeView;
			solution.Folders.Add(project);
			treeView.AddSolution(solution);
			nodes = treeView.Nodes;
			rootNode = (ExtTreeNode)treeView.Nodes[0];
			
			treeView.SelectedNode = rootNode;
			testProject = treeView.SelectedTestProject;
		}
Пример #2
0
		public override void Dispose()
		{
			if (!disposed) {
				disposed = true;
				treeView.Dispose();
				treeView = null;
				
				ProjectService.ProjectItemRemoved -= ProjectItemRemoved;
				ProjectService.ProjectItemAdded -= ProjectItemAdded;
				ProjectService.ProjectAdded -= ProjectAdded;
				ProjectService.SolutionFolderRemoved -= SolutionFolderRemoved;
				ProjectService.SolutionClosed -= SolutionClosed;
				ParserService.ParseInformationUpdated -= ParseInformationUpdated;
				ParserService.LoadSolutionProjectsThreadEnded -= LoadSolutionProjectsThreadEnded;
			}
		}
Пример #3
0
        public override void Dispose()
        {
            if (!disposed)
            {
                disposed = true;
                treeView.Dispose();
                treeView = null;

                ProjectService.ProjectItemRemoved             -= ProjectItemRemoved;
                ProjectService.ProjectItemAdded               -= ProjectItemAdded;
                ProjectService.ProjectAdded                   -= ProjectAdded;
                ProjectService.SolutionFolderRemoved          -= SolutionFolderRemoved;
                ProjectService.SolutionClosed                 -= SolutionClosed;
                ParserService.ParseInformationUpdated         -= ParseInformationUpdated;
                ParserService.LoadSolutionProjectsThreadEnded -= LoadSolutionProjectsThreadEnded;
            }
        }
Пример #4
0
		public UnitTestsPad(ITestService testService)
		{
			this.testService = testService;
			
			panel = new DockPanel();
			treeView = new TestTreeView(); // treeView must be created first because it's used by CreateToolBar

			toolBar = CreateToolBar("/SharpDevelop/Pads/UnitTestsPad/Toolbar");
			panel.Children.Add(toolBar);
			DockPanel.SetDock(toolBar, Dock.Top);
			
			panel.Children.Add(treeView);
			
			treeView.ContextMenu = CreateContextMenu("/SharpDevelop/Pads/UnitTestsPad/ContextMenu");
			
			testService.OpenSolutionChanged += testService_OpenSolutionChanged;
			testService_OpenSolutionChanged(null, null);
		}
Пример #5
0
        public UnitTestsPad(ITestService testService)
        {
            this.testService = testService;

            panel    = new DockPanel();
            treeView = new TestTreeView();             // treeView must be created first because it's used by CreateToolBar

            toolBar = CreateToolBar("/SharpDevelop/Pads/UnitTestsPad/Toolbar");
            panel.Children.Add(toolBar);
            DockPanel.SetDock(toolBar, Dock.Top);

            panel.Children.Add(treeView);

            treeView.ContextMenu = CreateContextMenu("/SharpDevelop/Pads/UnitTestsPad/ContextMenu");

            testService.OpenSolutionChanged += testService_OpenSolutionChanged;
            testService_OpenSolutionChanged(null, null);
        }
Пример #6
0
        public UnitTestsPad()
        {
            instance = this;

            panel                 = new Panel();
            treeView              = CreateTestTreeView();
            treeView.Dock         = DockStyle.Fill;
            treeView.DoubleClick += TestTreeViewDoubleClick;
            treeView.KeyPress    += TestTreeViewKeyPress;
            panel.Controls.Add(treeView);

            toolStrip           = CreateToolStrip("/SharpDevelop/Pads/UnitTestsPad/Toolbar");
            toolStrip.GripStyle = ToolStripGripStyle.Hidden;
            panel.Controls.Add(toolStrip);

            // Add the load solution projects thread ended handler before
            // we try to display the open solution so the event does not
            // get missed.
            ParserService.LoadSolutionProjectsThreadEnded += LoadSolutionProjectsThreadEnded;
            OnAddedLoadSolutionProjectsThreadEndedHandler();

            // Display currently open solution.

            if (!IsParserLoadingSolution)
            {
                Solution openSolution = GetOpenSolution();
                if (openSolution != null)
                {
                    SolutionLoaded(openSolution);
                }
            }

            ParserService.ParseInformationUpdated += ParseInformationUpdated;
            ProjectService.SolutionClosed         += SolutionClosed;
            ProjectService.SolutionFolderRemoved  += SolutionFolderRemoved;
            ProjectService.ProjectAdded           += ProjectAdded;
            ProjectService.ProjectItemAdded       += ProjectItemAdded;
            ProjectService.ProjectItemRemoved     += ProjectItemRemoved;

            treeView.ContextMenuStrip = CreateContextMenu("/SharpDevelop/Pads/UnitTestsPad/ContextMenu");
        }
Пример #7
0
		public UnitTestsPad()
		{
			instance = this;
			
			panel = new Panel();
			treeView = CreateTestTreeView();
			treeView.Dock = DockStyle.Fill;
			treeView.DoubleClick += TestTreeViewDoubleClick;
			treeView.KeyPress += TestTreeViewKeyPress;
			panel.Controls.Add(treeView);
			
			toolStrip = CreateToolStrip("/SharpDevelop/Pads/UnitTestsPad/Toolbar");
			toolStrip.GripStyle = ToolStripGripStyle.Hidden;
			panel.Controls.Add(toolStrip);

			// Add the load solution projects thread ended handler before
			// we try to display the open solution so the event does not
			// get missed.
			ParserService.LoadSolutionProjectsThreadEnded += LoadSolutionProjectsThreadEnded;
			OnAddedLoadSolutionProjectsThreadEndedHandler();

			// Display currently open solution.

			if (!IsParserLoadingSolution) {
				Solution openSolution = GetOpenSolution();
				if (openSolution != null) {
					SolutionLoaded(openSolution);
				}
			}
			
			ParserService.ParseInformationUpdated += ParseInformationUpdated;
			ProjectService.SolutionClosed += SolutionClosed;
			ProjectService.SolutionFolderRemoved += SolutionFolderRemoved;
			ProjectService.ProjectAdded += ProjectAdded;
			ProjectService.ProjectItemAdded += ProjectItemAdded;
			ProjectService.ProjectItemRemoved += ProjectItemRemoved;
			
			treeView.ContextMenuStrip = CreateContextMenu("/SharpDevelop/Pads/UnitTestsPad/ContextMenu");
		}
		public void SetUp()
		{
			// Create solution.
			solution = new Solution();
			
			// Create a project to display in the test tree view.
			project = new MockCSharpProject();
			project.Name = "TestProject";
			ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
			
			// Add a test class with a TestFixture attributes.
			projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			testClass = new MockClass("MyTestFixture");
			testClass.Attributes.Add(new MockAttribute("TestFixture"));
			testClass.ProjectContent = projectContent;
			projectContent.Classes.Add(testClass);
						
			// Init mock project content to be returned.
			dummyTreeView = new DummyParserServiceTestTreeView();
			dummyTreeView.ProjectContentForProject = projectContent;
			
			// Load the projects into the test tree view.
			treeView = dummyTreeView as TestTreeView;
			solution.Folders.Add(project);
			treeView.AddSolution(solution);
			nodes = treeView.Nodes;
			rootNode = (ExtTreeNode)treeView.Nodes[0];
			
			// Expand the root node so any child nodes are
			// lazily created.
			rootNode.Expanding();
			rootChildNodes = rootNode.Nodes;
			testFixtureNode = (ExtTreeNode)rootNode.Nodes[0];
		}
		public void SetUp()
		{
			// Create a project to display in the test tree view.
			project = new MockCSharpProject();
			project.Name = "TestProject";
			nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
			List<IProject> projects = new List<IProject>();
			projects.Add(project);
			
			// Add second non-test project.
			projects.Add(new MockCSharpProject());
			
			// Add a test class with a TestFixture attributes.
			projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			testClass = new MockClass("RootNamespace.Tests.MyTestFixture");
			testClass.Namespace = "RootNamespace.Tests";
			testClass.Attributes.Add(new MockAttribute("TestFixture"));
			testClass.ProjectContent = projectContent;
			projectContent.Classes.Add(testClass);
			
			// Add two methods to the test class only
			// one of which has test attributes.
			testMethod = new MockMethod("NameExists");
			testMethod.Attributes.Add(new MockAttribute("Test"));
			testMethod.DeclaringType = testClass;
			testClass.Methods.Add(testMethod);
			testClass.Methods.Add(new MockMethod());
					
			// Add a second class that has no test fixture attribute.
			MockClass nonTestClass = new MockClass();
			nonTestClass.ProjectContent = projectContent;
			projectContent.Classes.Add(nonTestClass);
			
			// Init mock project content to be returned.
			dummyTreeView = new DummyParserServiceTestTreeView();
			dummyTreeView.ProjectContentForProject = projectContent;
			
			// Load the projects into the test tree view.
			treeView = dummyTreeView as TestTreeView;	
			treeView.AddProjects(projects);
			nodes = treeView.Nodes;
			rootNode = (ExtTreeNode)treeView.Nodes[0];
			
			// Expand the root node so any child nodes are
			// lazily created.
			rootNode.Expanding();
			rootChildNodes = rootNode.Nodes;
			rootNamespaceNode = (ExtTreeNode)rootNode.Nodes[0];
			
			// Expand the first namespace node.
			rootNamespaceNode.Expanding();
			rootNamespaceChildNodes = rootNamespaceNode.Nodes;
			testsNamespaceNode = (ExtTreeNode)rootNamespaceNode.Nodes[0];
		
			// Expand the tests namespace node.
			testsNamespaceNode.Expanding();
			testsNamespaceChildNodes = testsNamespaceNode.Nodes;
			testFixtureNode = (ExtTreeNode)testsNamespaceNode.Nodes[0];
		
			// Expand the test node.
			testFixtureNode.Expanding();
			testFixtureChildNodes = testFixtureNode.Nodes;
			testNode = (ExtTreeNode)testFixtureChildNodes[0];
		}