public void Init()
		{
			project = new MockCSharpProject();
			c = new MockClass();
			method = new MockMethod(c);
			selectedTests = new SelectedTests(project, namespaceFilter, c, method);
		}
		public void Init()
		{
			base.InitBase();
			
			project = new MockCSharpProject();
			MockBuildProjectBeforeTestRun buildProject = new MockBuildProjectBeforeTestRun();
			context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject);
			
			methodToTest = MockMethod.CreateMockMethodWithoutAnyAttributes();
			methodToTest.FullyQualifiedName = "MyTests.MyTestClass.MyTestMethod";
			
			classToTest = methodToTest.DeclaringType as MockClass;
			classToTest.SetDotNetName("MyTests.MyTestClass");
			
			treeView = new MockTestTreeView();
			treeView.SelectedProject = project;
			treeView.SelectedMember = methodToTest;
			
			runTestCommand.Owner = treeView;
			
			runTestCommand.Run();
			
			buildProject.FireBuildCompleteEvent();
			
			context.MockUnitTestWorkbench.MakeSafeThreadAsyncMethodCallsWithArguments = true;
			context.MockBuildOptions.ShowErrorListAfterBuild = false;
			
			TestResult result = new TestResult("MyTests.MyTestClass.MyTestMethod");
			result.ResultType = TestResultType.Failure;
			context.MockTestResultsMonitor.FireTestFinishedEvent(result);
			
			runTestCommand.CallTestsCompleted();
		}
		MockMethod CreateMethod(string name)
		{
			MockClass c = CreateClass();
			MockMethod method = new MockMethod(c, name);
			c.Methods.Add(method);
			return method;
		}
		public void SetUp()
		{			
			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			
			// Create the base test class.
			MockClass baseClass = new MockClass("RootNamespace.TestFixtureBase");
			baseClass.Attributes.Add(new MockAttribute("TestFixture"));
			baseClass.ProjectContent = projectContent;
			MockMethod baseMethod = new MockMethod("BaseMethod");
			baseMethod.Attributes.Add(new MockAttribute("Test"));
			baseMethod.DeclaringType = baseClass;
			baseClass.Methods.Add(baseMethod);
			
			// Create the derived test class.
			c = new MockClass("RootNamespace.MyTestFixture");
			c.Attributes.Add(new MockAttribute("TestFixture"));
			c.ProjectContent = projectContent;
			MockMethod method = new MockMethod("DerivedMethod");
			method.DeclaringType = c;
			method.Attributes.Add(new MockAttribute("Test"));
			c.Methods.Add(method);
			projectContent.Classes.Add(c);

			// Set derived class's base class.
			c.BaseClass = baseClass;
			
			// Create TestClass.
			testClass = new TestClass(c);
		}
		public void SetUp()
		{
			MockProjectContent projectContent = new MockProjectContent();
			
			// Create the base test class.
			MockClass baseClass = new MockClass(projectContent, "ICSharpCode.SharpDevelop.Tests.ReflectionOrCecilLayerTests");
			MockMethod baseMethod = new MockMethod(baseClass, "InheritanceTests");
			baseMethod.Attributes.Add(new MockAttribute("Test"));
			baseClass.Methods.Add(baseMethod);
			
			// Add a second method that does not have a Test attribute.
			baseMethod = new MockMethod(baseClass, "NonTestMethod");
			baseClass.Methods.Add(baseMethod);
			
			// Create the derived test class.
			c = new MockClass(projectContent, "ICSharpCode.SharpDevelop.Tests.CecilLayerTests");
			c.SetDotNetName(c.FullyQualifiedName);
			c.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(c);

			// Set derived class's base class.
			c.AddBaseClass(baseClass);
			
			// Create TestClass.
			MockTestFrameworksWithNUnitFrameworkSupport testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			testClass = new TestClass(c, testFrameworks);
		}
		public void SetUp()
		{
			MockProjectContent projectContent = new MockProjectContent();
			
			// Create the base test class.
			MockClass baseClass = new MockClass(projectContent, "RootNamespace.TestFixtureBase");
			baseClass.Attributes.Add(new MockAttribute("TestFixture"));
			MockMethod baseMethod = new MockMethod(baseClass, "BaseMethod");
			baseMethod.Attributes.Add(new MockAttribute("Test"));
			baseClass.Methods.Add(baseMethod);
			
			// Create the derived test class.
			c = new MockClass(projectContent, "RootNamespace.MyTestFixture");
			c.Attributes.Add(new MockAttribute("TestFixture"));
			MockMethod method = new MockMethod(c, "DerivedMethod");
			method.Attributes.Add(new MockAttribute("Test"));
			c.Methods.Add(method);
			projectContent.Classes.Add(c);

			// Set derived class's base class.
			c.AddBaseClass(baseClass);
			
			// Create TestClass.
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			testClass = new TestClass(c, testFrameworks);
		}
		public void Init()
		{
			resultChangedCalled = false;
			IProject project = new MockCSharpProject();
			project.Name = "TestProject";
			ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);

			projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			
			MockClass mockClass = new MockClass("RootNamespace.Tests.MyTestFixture");
			mockClass.Namespace = "RootNamespace.Tests";
			mockClass.ProjectContent = projectContent;
			mockClass.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(mockClass);
			
			// Add a method to the test class
			MockMethod mockMethod = new MockMethod("TestMethod");
			mockMethod.DeclaringType = mockClass;
			mockMethod.Attributes.Add(new MockAttribute("Test"));
			mockClass.Methods.Add(mockMethod);
			
			testProject = new TestProject(project, projectContent);
			testClass = testProject.TestClasses[0];
			testMethod = testClass.TestMethods[0];
		}
		public void Init()
		{
			IProject project = new MockCSharpProject();
			project.Name = "TestProject";
			ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);

			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			
			mockClass = new MockClass(projectContent, "RootNamespace.Tests.MyTestFixture");
			mockClass.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(mockClass);
			
			// Add a method to the test class
			MockMethod mockMethod = new MockMethod(mockClass, "TestMethod1");
			mockMethod.Attributes.Add(new MockAttribute("Test"));
			mockClass.Methods.Add(mockMethod);
			
			mockMethod = new MockMethod(mockClass, "TestMethod2");
			mockMethod.Attributes.Add(new MockAttribute("Test"));
			mockClass.Methods.Add(mockMethod);
			
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			testProject = new TestProject(project, projectContent, testFrameworks);
			testClass = testProject.TestClasses[0];
			testMethod1 = testClass.TestMembers[0];
			testMethod2 = testClass.TestMembers[1];
		}
		public void Init()
		{
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			
			// Add a test class.
			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			MockClass c = new MockClass(projectContent, "RootNamespace.MyTestFixture");
			c.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(c);
			
			// Add first method.
			var method = new MockMethod(c, "MyTest");
			method.Attributes.Add(new MockAttribute("Test"));
			c.Methods.Add(method);
			
			// Add duplicate method.
			c.Methods.Add(method);
			
			// Add a base class that has duplicate methods.
			MockClass baseClass = new MockClass(projectContent, "RootNamespace.MyTestFixtureBase");
			baseClass.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(baseClass);
			c.AddBaseClass(baseClass);
			var baseClassMethod = new MockMethod(baseClass, "MyTest");
			baseClassMethod.Attributes.Add(new MockAttribute("Test"));
			baseClass.Methods.Add(baseClassMethod);
			baseClass.Methods.Add(baseClassMethod);
			
			// Create test class.
			testClass = new TestClass(c, testFrameworks);
		}
		protected void InitBase()
		{			
			projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			
			// Create the base test class.
			outerClass = new MockClass(projectContent, "MyTests.A");
			projectContent.Classes.Add(outerClass);
			
			// Create the inner test class.
			// Note the use of the DotNetName "MyTests.A+InnerTest".
			innerClass = new MockClass(projectContent, "MyTests.A.InnerATest", "MyTests.A+InnerATest", outerClass);
			innerClass.Attributes.Add(new MockAttribute("TestFixture"));

			MockMethod method = new MockMethod(innerClass, "FooBar");
			method.Attributes.Add(new MockAttribute("Test"));
			innerClass.Methods.Add(method);
			outerClass.InnerClasses.Add(innerClass);
			
			// Add another inner class that is not a test class.
			nonTestInnerClass = new MockClass(projectContent, "MyTests.A.InnerBClass", outerClass);
			outerClass.InnerClasses.Add(nonTestInnerClass);

			// Add another inner class with the same name as the InnerATest.
			// This makes sure duplicate classes are not added.
			MockClass duplicateInnerClass = new MockClass(projectContent, "MyTests.A.InnerATest", "MyTests.A+InnerATest", outerClass);
			duplicateInnerClass.Attributes.Add(new MockAttribute("TestFixture"));
			outerClass.InnerClasses.Add(duplicateInnerClass);
			
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			testProject = new TestProject(null, projectContent, testFrameworks);
			if (testProject.TestClasses.Count > 0) {
				testClass = testProject.TestClasses[0];
			}
		}
		public void SetUp()
		{
			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			
			// Create the top base test class.
			MockClass baseBaseClass = new MockClass(projectContent, "ICSharpCode.SharpDevelop.Tests.BaseBaseTestFixture");
			MockMethod baseMethod = new MockMethod(baseBaseClass, "BaseBaseTest");
			baseMethod.Attributes.Add(new MockAttribute("Test"));
			baseBaseClass.Methods.Add(baseMethod);
			
			// Create the next level test class.
			MockClass baseClass = new MockClass(projectContent, "ICSharpCode.SharpDevelop.Tests.BaseTestFixture");
			baseMethod = new MockMethod(baseClass, "BaseTest");
			baseMethod.Attributes.Add(new MockAttribute("Test"));
			baseClass.Methods.Add(baseMethod);
			
			// Create the derived test class.
			c = new MockClass(projectContent, "ICSharpCode.SharpDevelop.Tests.MainTestFixture");
			c.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(c);

			// Set the base class for each class in the hierarchy.
			c.AddBaseClass(baseClass);
			baseClass.AddBaseClass(baseBaseClass);
			
			// Create TestClass.
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			testClass = new TestClass(c, testFrameworks);
		}
		public void SetUp()
		{			
			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;

			// Create the top base test class.
			MockClass baseBaseClass = new MockClass("ICSharpCode.SharpDevelop.Tests.BaseBaseTestFixture");
			baseBaseClass.ProjectContent = projectContent;
			MockMethod baseMethod = new MockMethod("BaseBaseTest");
			baseMethod.Attributes.Add(new MockAttribute("Test"));
			baseMethod.DeclaringType = baseBaseClass;
			baseBaseClass.Methods.Add(baseMethod);
			
			// Create the next level test class.
			MockClass baseClass = new MockClass("ICSharpCode.SharpDevelop.Tests.BaseTestFixture");
			baseClass.ProjectContent = projectContent;
			baseMethod = new MockMethod("BaseTest");
			baseMethod.Attributes.Add(new MockAttribute("Test"));
			baseMethod.DeclaringType = baseClass;
			baseClass.Methods.Add(baseMethod);

			// Create the derived test class.
			c = new MockClass("ICSharpCode.SharpDevelop.Tests.MainTestFixture");
			c.Attributes.Add(new MockAttribute("TestFixture"));
			c.ProjectContent = projectContent;
			projectContent.Classes.Add(c);

			// Set the base class for each class in the hierarchy.
			c.BaseClass = baseClass;
			baseClass.BaseClass = baseBaseClass;
			
			// Create TestClass.
			testClass = new TestClass(c);
		}
		public void Init()
		{	
			// Add a test class.
			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			MockClass c = new MockClass("RootNamespace.MyTestFixture");
			c.Attributes.Add(new MockAttribute("TestFixture"));
			c.ProjectContent = projectContent;
			projectContent.Classes.Add(c);
			
			// Add first method.
			MockMethod method = new MockMethod("MyTest");
			method.Attributes.Add(new MockAttribute("Test"));
			method.DeclaringType = c;
			c.Methods.Add(method);
			
			// Add duplicate method.
			c.Methods.Add(method);
			
			// Add a base class that has duplicate methods.
			MockClass baseClass = new MockClass("RootNamespace.MyTestFixtureBase");
			baseClass.Attributes.Add(new MockAttribute("TestFixture"));
			baseClass.ProjectContent = projectContent;
			projectContent.Classes.Add(baseClass);
			c.BaseClass = baseClass;
			baseClass.Methods.Add(method);
			baseClass.Methods.Add(method);
			
			// Create test class.
			testClass = new TestClass(c);
		}
		public void SetUp()
		{			
			MockProjectContent projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			
			// Create the base test class.
			MockClass baseClass = new MockClass("ICSharpCode.SharpDevelop.Tests.ReflectionOrCecilLayerTests");
			baseClass.ProjectContent = projectContent;
			MockMethod baseMethod = new MockMethod("InheritanceTests");
			baseMethod.Attributes.Add(new MockAttribute("Test"));
			baseMethod.DeclaringType = baseClass;
			baseClass.Methods.Add(baseMethod);

			// Add a second method that does not have a Test attribute.
			baseMethod = new MockMethod("NonTestMethod");
			baseMethod.DeclaringType = baseClass;
			baseClass.Methods.Add(baseMethod);
			
			// Create the derived test class.
			c = new MockClass("ICSharpCode.SharpDevelop.Tests.CecilLayerTests");
			c.Attributes.Add(new MockAttribute("TestFixture"));
			c.ProjectContent = projectContent;
			projectContent.Classes.Add(c);

			// Set derived class's base class.
			c.BaseClass = baseClass;
			
			// Create TestClass.
			testClass = new TestClass(c);
		}
		public void FullyQualifiedNameReturnsFullyQualifiedMethodName()
		{
			MockClass declaringType = new MockClass("MyNamespace.MyClass");
			MockMethod method = new MockMethod(declaringType, "MyMethod");
			string expectedName = "MyNamespace.MyClass.MyMethod";
			Assert.AreEqual(expectedName, method.FullyQualifiedName);
		}
		public void Init()
		{
			base.InitBase();

			DefaultCompilationUnit oldUnit = new DefaultCompilationUnit(projectContent);
			oldUnit.Classes.Add(outerClass);
			
			// Create new compilation unit with inner class that has its method renamed.
			DefaultCompilationUnit newUnit = new DefaultCompilationUnit(projectContent);
			MockClass newOuterClass = new MockClass("MyTests.A");
			newOuterClass.ProjectContent = projectContent;
			projectContent.Classes.Add(newOuterClass);
			newOuterClass.SetCompoundClass(newOuterClass);
			newUnit.Classes.Add(newOuterClass);
			
			// Create the inner test class.
			MockClass newInnerClass = new MockClass("MyTests.A.InnerATest", "MyTests.A+InnerATest");
			newInnerClass.Attributes.Add(new MockAttribute("TestFixture"));
			newInnerClass.ProjectContent = projectContent;
			newInnerClass.DeclaringType = outerClass; // Declaring type is outer class.	
			newInnerClass.SetCompoundClass(newInnerClass);
			newOuterClass.InnerClasses.Add(newInnerClass);
			
			MockMethod method = new MockMethod("FooBarRenamed");
			method.Attributes.Add(new MockAttribute("Test"));
			method.DeclaringType = newInnerClass;
			newInnerClass.Methods.Add(method);
			outerClass.InnerClasses.Add(newInnerClass);
		
			// Update TestProject's parse info.
			testProject.UpdateParseInfo(oldUnit, newUnit);
			
			innerTestClass = testProject.TestClasses["MyTests.A+InnerATest"];
		}
		public void Init()
		{
			base.InitBase();

			DefaultCompilationUnit oldUnit = new DefaultCompilationUnit(projectContent);
			oldUnit.Classes.Add(outerClass);
			
			// Create new compilation unit with inner class that has its method renamed.
			DefaultCompilationUnit newUnit = new DefaultCompilationUnit(projectContent);
			MockClass newOuterClass = new MockClass(projectContent, "MyTests.A");
			projectContent.Classes.Add(newOuterClass);
			newUnit.Classes.Add(newOuterClass);
			
			// Create the inner test class.
			MockClass newInnerClass = new MockClass(projectContent, "MyTests.A.InnerATest", outerClass);
			newInnerClass.SetDotNetName("MyTests.A+InnerATest");
			newInnerClass.Attributes.Add(new MockAttribute("TestFixture"));
			newOuterClass.InnerClasses.Add(newInnerClass);
			
			MockMethod method = new MockMethod(newInnerClass, "FooBarRenamed");
			method.Attributes.Add(new MockAttribute("Test"));
			newInnerClass.Methods.Add(method);
			outerClass.InnerClasses.Add(newInnerClass);
			
			MockClass innerClassInInnerClass = new MockClass(projectContent, "MyTests.A.InnerATest.InnerInnerTest", innerClass);
			innerClassInInnerClass.SetDotNetName("MyTests.A+InnerATest+InnerInnerTest");
			innerClassInInnerClass.Attributes.Add(new MockAttribute("TestFixture"));
			newInnerClass.InnerClasses.Add(innerClassInInnerClass);
		
			// Update TestProject's parse info.
			testProject.UpdateParseInfo(oldUnit, newUnit);
			
			innerTestClass = testProject.TestClasses["MyTests.A+InnerATest"];
		}
		public void IsTestMethodReturnsFalseWhenProjectContentLanguageHasNullNameComparer()
		{
			MockClass mockClass = MockClass.CreateMockClassWithoutAnyAttributes();
			mockClass.MockProjectContent.Language = new LanguageProperties(null);
			MockMethod mockMethod = new MockMethod(mockClass);
			mockMethod.Attributes.Add(new MockAttribute("Test"));
			
			Assert.IsFalse(testFramework.IsTestMethod(mockMethod));
		}
		public void GetMethodReplaceRegion()
		{
			MockMethod method = new MockMethod(MockClass.CreateMockClassWithoutAnyAttributes());
			DomRegion bodyRegion = new DomRegion(0, 4, 1, 4);
			method.BodyRegion = bodyRegion;
			DomRegion expectedRegion = new DomRegion(bodyRegion.BeginLine + 1, 1, bodyRegion.EndLine + 1, 1);
			DomRegion region = generator.GetBodyRegionInDocument(method);
			
			Assert.AreEqual(expectedRegion, region);
		}		
		public void IsTestMember_MethodThatDoesNotStartWithTest_ReturnsFalse()
		{
			CreateTestFramework();
			MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
			var method = new MockMethod(c, "RunThis");
			
			bool result = testFramework.IsTestMember(method);
			
			Assert.IsFalse(result);
		}
		public void Init()
		{
			MockAttribute testAttribute = new MockAttribute("Test");
			methodWithTestAttribute = MockMethod.CreateMockMethodWithAttribute(testAttribute);
			memberNodeForMethodWithTestAttribute = new MockMemberNode(methodWithTestAttribute);
			
			testFrameworks = new MockRegisteredTestFrameworks();
			testFrameworks.AddTestMethod(methodWithTestAttribute);
			
			testableCondition = new TestableCondition(testFrameworks);
		}
Beispiel #22
0
		public static MockMethod CreateMockMethodWithAttributes(IList<MockAttribute> attributes)
		{
			MockClass mockClass = MockClass.CreateMockClassWithoutAnyAttributes();
			MockMethod mockMethod = new MockMethod(mockClass);
			
			foreach (MockAttribute attribute in attributes) {
				mockMethod.Attributes.Add(attribute);
			}
			
			return mockMethod;
		}
		public void WriteTestsAddsTestMethodFileNameToResponseFile()
		{
			MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
			MockMethod method = new MockMethod(c, "MyTest");
			method.CompilationUnit.FileName = @"d:\mytest.rb";
			SelectedTests selectedTests = RubySelectedTestsHelper.CreateSelectedTests(method);
			responseFile.WriteTests(selectedTests);
			
			string expectedText = "d:\\mytest.rb\r\n";
			Assert.AreEqual(expectedText, responseFileText.ToString());
		}
		public void Init()
		{
			method = MockMethod.CreateMockMethodWithoutAnyAttributes();
			method.DeclaringType.CompilationUnit.FileName = @"c:\projects\mytest.cs";
			
			treeView = new MockTestTreeView();
			treeView.SelectedMethod = method;
			fileService = new MockFileService();
			gotoDefinitionCommand = new GotoDefinitionCommand(fileService);
			gotoDefinitionCommand.Owner = treeView;
			gotoDefinitionCommand.Run();
		}
		public void IsTestMethodReturnsFalseWhenProjectContentLanguageHasNullNameComparer()
		{
			IProject project = new MockCSharpProject();
			MockProjectContent mockProjectContent = new MockProjectContent();
			mockProjectContent.Project = project;
			mockProjectContent.Language = new LanguageProperties(null);
			MockClass mockClass = new MockClass(mockProjectContent);
			MockMethod mockMethod = new MockMethod(mockClass);
			mockMethod.Attributes.Add(new MockAttribute("Test"));
			
			Assert.IsFalse(testFramework.IsTestMethod(mockMethod));
		}
		public void Init()
		{
			// Create a project to display.
			project = new MockCSharpProject();
			project.Name = "TestProject";
			ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
			
			// Add a test class.
			projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			MockClass c = new MockClass("RootNamespace.MyTestFixture");
			c.Attributes.Add(new MockAttribute("TestFixture"));
			c.ProjectContent = projectContent;
			c.SetCompoundClass(c);
			MockMethod test1Method = new MockMethod("Test1");
			test1Method .DeclaringType = c;
			test1Method .Attributes.Add(new MockAttribute("Test"));
			c.Methods.Add(test1Method);
			
			// Test 2 method is from a duplicate test class.
			MockMethod test2Method = new MockMethod("Test2"); 
			test2Method.DeclaringType = c;
			test2Method.Attributes.Add(new MockAttribute("Test"));
			c.Methods.Add(test2Method);			
			projectContent.Classes.Add(c);
						
			testProject = new TestProject(project, projectContent);
			
			// Make sure test methods are created, otherwise
			// the Test2 method will never be looked at due to lazy evaluation
			// of test method.s
			int count = testProject.TestClasses[0].TestMethods.Count;
			
			// Change the name of the second test class.
			DefaultCompilationUnit oldUnit = new DefaultCompilationUnit(projectContent);
			oldUnit.Classes.Add(c);
			c.Methods.Remove(test2Method); // Remove duplicate test class method.

			
			// Create new compilation unit with inner class that has its method renamed.
			DefaultCompilationUnit newUnit = new DefaultCompilationUnit(projectContent);
			MockClass newTestClass = new MockClass("RootNamespace.MyNewTestFixture");
			newTestClass.ProjectContent = projectContent;
			newTestClass.Attributes.Add(new MockAttribute("TestFixture"));
			newTestClass.SetCompoundClass(newTestClass);
			projectContent.Classes.Add(newTestClass);
			newTestClass.Methods.Add(test2Method);
			newUnit.Classes.Add(newTestClass);

			testProject.UpdateParseInfo(oldUnit, newUnit);
		}
		public void IsTestMember_ProjectContentLanguageHasNullNameComparer_ReturnsFalse()
		{
			CreateTestFramework();
			MockClass mockClass = MockClass.CreateMockClassWithoutAnyAttributes();
			mockClass.MockProjectContent.Language = new LanguageProperties(null);
			var mockMethod = new MockMethod(mockClass);
			mockMethod.Attributes.Add(new MockAttribute("Test"));
			
			bool result = testFramework.IsTestMember(mockMethod);
			
			Assert.IsFalse(result);
		}
		public void NullNameComparer()
		{
			IProject project = new MockCSharpProject();
			MockClass mockClass = new MockClass();
			MockProjectContent mockProjectContent = new MockProjectContent();
			mockProjectContent.Project = project;
			mockProjectContent.Language = new LanguageProperties(null);
			mockClass.ProjectContent = mockProjectContent;
			MockMethod mockMethod = new MockMethod();
			mockMethod.DeclaringType = mockClass;
			mockMethod.Attributes.Add(new MockAttribute("Test"));
			
			Assert.IsFalse(TestMethod.IsTestMethod(mockMethod));
		}
		public void Init()
		{
			method = MockMethod.CreateMockMethodWithoutAnyAttributes();
			method.DeclaringType.CompilationUnit.FileName = @"c:\projects\mytest.cs";
			
			int methodBeginLine = 3; // 1 based.
			int methodBeginColumn = 6; // 1 based.
			method.Region = new DomRegion(methodBeginLine, methodBeginColumn);
			
			treeView = new MockTestTreeView();
			treeView.SelectedMember = method;
			fileService = new MockFileService();
			gotoDefinitionCommand = new GotoDefinitionCommand(fileService);
			gotoDefinitionCommand.Owner = treeView;
			gotoDefinitionCommand.Run();
		}
		public void SetUpFixture()
		{
			mockClass = new MockClass("Tests.MyTestFixture");
			mockMethod = new MockMethod(mockClass, "MyMethod");
			
			mockMethodRegion = new DomRegion(0, 0, 0, 10);
			mockMethod.Region = mockMethodRegion;
			mockMethodBodyRegion = new DomRegion(1, 0, 2, 5);
			mockMethod.BodyRegion = mockMethodBodyRegion;
			mockMethod.Modifiers = ModifierEnum.Public;
		
			MockClass returnTypeClass = new MockClass("Tests.ReturnType");
			returnType = new DefaultReturnType(returnTypeClass);
			mockMethod.ReturnType = returnType;
			
			baseTestMethod = new BaseTestMethod(mockClass, mockMethod);
		}