当前位置: 首页>>代码示例>>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;未经允许,请勿转载。