本文整理汇总了C#中UnitTesting.Tests.Utils.MockCSharpProject类的典型用法代码示例。如果您正苦于以下问题:C# MockCSharpProject类的具体用法?C# MockCSharpProject怎么用?C# MockCSharpProject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockCSharpProject类属于UnitTesting.Tests.Utils命名空间,在下文中一共展示了MockCSharpProject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: MbUnitTestFrameworkRegisteredForUseWithProjectsWithVBNetProjectFileExtension
public void MbUnitTestFrameworkRegisteredForUseWithProjectsWithVBNetProjectFileExtension()
{
MockCSharpProject project = new MockCSharpProject();
project.FileName = @"d:\projects\test\MyProj.vbproj";
Assert.AreEqual(mbUnitTestFramework, testFrameworks.GetTestFrameworkForProject(project));
}
示例3: Init
public void Init()
{
base.InitBase();
project1 = new MockCSharpProject();
testProject1 =
TestProjectHelper.CreateTestProjectWithTestClassAndSingleTestMethod(project1, "testClass1", "testMethod1");
project2 = new MockCSharpProject();
testProject2 =
TestProjectHelper.CreateTestProjectWithTestClassAndSingleTestMethod(project1, "testClass2", "testMethod2");
context.MockUnitTestsPad.AddProject(project1);
context.MockUnitTestsPad.AddProject(project2);
context.MockUnitTestsPad.AddTestProject(testProject1);
context.MockUnitTestsPad.AddTestProject(testProject2);
buildProject1 = new MockBuildProjectBeforeTestRun();
context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject1);
runTestCommand.Run();
buildProject1.FireBuildCompleteEvent();
runTestCommand.CallTestsCompleted();
}
示例4: Init
public void Init()
{
project = new MockCSharpProject();
c = new MockClass();
method = new MockMethod(c);
selectedTests = new SelectedTests(project, namespaceFilter, c, method);
}
示例5: Init
public void Init()
{
// Create a project to display in the test tree view.
IProject 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.
MockProjectContent projectContent = new MockProjectContent();
projectContent.Language = LanguageProperties.None;
MockClass c = new MockClass("RootNamespace.MyTestFixture");
c.Namespace = "RootNamespace";
c.Attributes.Add(new MockAttribute("TestFixture"));
c.ProjectContent = projectContent;
projectContent.Classes.Add(c);
// Add a second class no root namespace.
c = new MockClass("MyTestFixture2");
c.Namespace = String.Empty;
c.Attributes.Add(new MockAttribute("TestFixture"));
c.ProjectContent = projectContent;
projectContent.Classes.Add(c);
testProject = new TestProject(project, projectContent);
}
示例6: IsSupportedProjectReturnsTrueForVBNetProject
public void IsSupportedProjectReturnsTrueForVBNetProject()
{
MockCSharpProject project = new MockCSharpProject();
project.FileName = @"d:\projects\myproj.vbproj";
Assert.IsTrue(descriptor.IsSupportedProject(project));
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:TestFrameworkDescriptorIgnoresProjectFileExtensionWhitespaceTestFixture.cs
示例7: NothingSpecified
public void NothingSpecified()
{
MockCSharpProject project = new MockCSharpProject();
SelectedTests selectedTests = new SelectedTests(project);
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-x86.exe", app.FileName);
}
示例8: IsSupportedProjectReturnsTrueForCSharpProjectFileExtensionInUpperCase
public void IsSupportedProjectReturnsTrueForCSharpProjectFileExtensionInUpperCase()
{
MockCSharpProject project = new MockCSharpProject();
project.FileName = @"d:\projects\myproj.CSPROJ";
Assert.IsTrue(descriptor.IsSupportedProject(project));
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:TestFrameworkDescriptorSupportsCSharpProjectsTestFixture.cs
示例9: Init
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];
}
示例10: 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();
}
示例11: SelectedProjectMatchesProjectServiceCurrentProject
public void SelectedProjectMatchesProjectServiceCurrentProject()
{
MockCSharpProject project = new MockCSharpProject();
ProjectService.CurrentProject = project;
Assert.AreEqual(project, runProjectTestsInPadCommand.SelectedProject);
}
示例12: StartTestRunner
void StartTestRunner()
{
FileUtility.ApplicationRootPath = @"d:\sharpdevelop";
MockCSharpProject project = new MockCSharpProject();
SelectedTests tests = new SelectedTests(project);
testRunner.Start(tests);
}
示例13: NothingSpecified
public void NothingSpecified()
{
MockCSharpProject project = new MockCSharpProject();
UnitTestApplicationStartHelper helper = new UnitTestApplicationStartHelper();
helper.Initialize(project, null);
Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-dotnet2-x86.exe", helper.UnitTestApplication);
}
示例14: Init
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];
}
示例15: SetUp
public void SetUp()
{
testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
treeView = new DummyParserServiceTestTreeView(testFrameworks);
// Create a solution with two test projects.
solution = new Solution(new MockProjectChangeWatcher());
// Create the first test project.
firstProject = new MockCSharpProject(solution, "FirstTestProject");
ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(firstProject);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(firstProject, nunitFrameworkReferenceItem);
// Create the second test project.
secondProject = new MockCSharpProject(solution, "SecondTestProject");
nunitFrameworkReferenceItem = new ReferenceProjectItem(secondProject);
nunitFrameworkReferenceItem.Include = "NUnit.Framework";
ProjectService.AddProjectItem(secondProject, nunitFrameworkReferenceItem);
// Add the projects to the solution.
solution.Folders.Add(firstProject);
solution.Folders.Add(secondProject);
// Create a dummy project content so the projects will be added
// to the tree.
treeView.ProjectContentForProject = new MockProjectContent();
// Add the solution to the tree.
treeView.AddSolution(solution);
allTestsTreeNode = treeView.Nodes[0] as AllTestsTreeNode;
firstTestProject = treeView.GetTestProject(firstProject);
secondTestProject = treeView.GetTestProject(secondProject);
}