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


C# Utils.MockCSharpProject類代碼示例

本文整理匯總了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();
		}
開發者ID:hefnerliu,項目名稱:SharpDevelop,代碼行數:27,代碼來源:RunTestsForClassTestFixture.cs

示例2: MbUnitTestFrameworkRegisteredForUseWithProjectsWithVBNetProjectFileExtension

		public void MbUnitTestFrameworkRegisteredForUseWithProjectsWithVBNetProjectFileExtension()
		{
			MockCSharpProject project = new MockCSharpProject();
			project.FileName = @"d:\projects\test\MyProj.vbproj";
			
			Assert.AreEqual(mbUnitTestFramework, testFrameworks.GetTestFrameworkForProject(project));
		}
開發者ID:Bombadil77,項目名稱:SharpDevelop,代碼行數:7,代碼來源:RegisteredTestFrameworksTestFixture.cs

示例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();
		}
開發者ID:2594636985,項目名稱:SharpDevelop,代碼行數:26,代碼來源:RunTwoProjectsTestsTestFixture.cs

示例4: Init

		public void Init()
		{
			project = new MockCSharpProject();
			c = new MockClass();
			method = new MockMethod(c);
			selectedTests = new SelectedTests(project, namespaceFilter, c, method);
		}
開發者ID:Bombadil77,項目名稱:SharpDevelop,代碼行數:7,代碼來源:SelectedTestsTestFixture.cs

示例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);
		}
開發者ID:kingjiang,項目名稱:SharpDevelopLite,代碼行數:27,代碼來源:EmptyRootNamespaceTestFixture.cs

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

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

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

示例11: SelectedProjectMatchesProjectServiceCurrentProject

		public void SelectedProjectMatchesProjectServiceCurrentProject()
		{
			MockCSharpProject project = new MockCSharpProject();
			ProjectService.CurrentProject = project;
			
			Assert.AreEqual(project, runProjectTestsInPadCommand.SelectedProject);
		}
開發者ID:Bombadil77,項目名稱:SharpDevelop,代碼行數:7,代碼來源:RunProjectTestsInPadTestFixture.cs

示例12: StartTestRunner

		void StartTestRunner()
		{
			FileUtility.ApplicationRootPath = @"d:\sharpdevelop";
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests tests = new SelectedTests(project);
			testRunner.Start(tests);
		}
開發者ID:Bombadil77,項目名稱:SharpDevelop,代碼行數:7,代碼來源:CodeCoverageTestRunnerTests.cs

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

示例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];
		}
開發者ID:kingjiang,項目名稱:SharpDevelopLite,代碼行數:28,代碼來源:TestClassWithOneMethodTestFixture.cs

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


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