本文整理汇总了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();
}
示例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);
}
示例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"];
}
示例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();
}
示例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);
}