當前位置: 首頁>>代碼示例>>C#>>正文


C# MockClass.SetDotNetName方法代碼示例

本文整理匯總了C#中UnitTesting.Tests.Utils.MockClass.SetDotNetName方法的典型用法代碼示例。如果您正苦於以下問題:C# MockClass.SetDotNetName方法的具體用法?C# MockClass.SetDotNetName怎麽用?C# MockClass.SetDotNetName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnitTesting.Tests.Utils.MockClass的用法示例。


在下文中一共展示了MockClass.SetDotNetName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Init

		public void Init()
		{
			base.InitBase();
			
			project = new MockCSharpProject();
			MockBuildProjectBeforeTestRun buildProject = new MockBuildProjectBeforeTestRun();
			context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject);
			
			classToTest = MockClass.CreateMockClassWithoutAnyAttributes();
			classToTest.SetDotNetName("MyTestClass");
			
			treeView = new MockTestTreeView();
			treeView.SelectedProject = project;
			treeView.SelectedClass = classToTest;
			
			runTestCommand.Owner = treeView;
			
			runTestCommand.Run();
			
			buildProject.FireBuildCompleteEvent();
			
			TestResult result = new TestResult("MyTestClass");
			result.ResultType = TestResultType.Success;
			context.MockTestResultsMonitor.FireTestFinishedEvent(result);
			
			runTestCommand.CallTestsCompleted();
		}
開發者ID:hefnerliu,項目名稱:SharpDevelop,代碼行數:27,代碼來源:RunTestsForClassTestFixture.cs

示例2: SetUp

		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);
		}
開發者ID:Bombadil77,項目名稱:SharpDevelop,代碼行數:27,代碼來源:AbstractBaseClassWithTestMethodsTestFixture.cs

示例3: Init

		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"];
		}
開發者ID:nylen,項目名稱:SharpDevelop,代碼行數:34,代碼來源:InnerClassMethodRenamedTestFixture.cs

示例4: Init

		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();
		}
開發者ID:nylen,項目名稱:SharpDevelop,代碼行數:33,代碼來源:RunTestsForMethodTestFixture.cs

示例5: Init

		public void Init()
		{
			testFrameworks = new MockRegisteredTestFrameworks();
			myTestClass = MockClass.CreateMockClassWithoutAnyAttributes();
			myTestClass.SetDotNetName("MyTests");
			testFrameworks.AddTestClass(myTestClass);
			
			oldUnit = new DefaultCompilationUnit(myTestClass.ProjectContent);
			oldUnit.Classes.Add(myTestClass);
			
			testProject = new TestProject(myTestClass.Project, myTestClass.ProjectContent, testFrameworks);
		}
開發者ID:Bombadil77,項目名稱:SharpDevelop,代碼行數:12,代碼來源:TestProjectUsesTestFrameworksTestFixture.cs


注:本文中的UnitTesting.Tests.Utils.MockClass.SetDotNetName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。