protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
        {
            NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests, options);

            app.Results = base.TestResultsMonitor.FileName;
            return(app.GetProcessStartInfo());
        }
        protected override ProcessStartInfo GetProcessStartInfo(IEnumerable <ITest> selectedTests)
        {
            NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests, options);

            app.ResultsPipe = base.TestResultsReader.PipeName;
            return(app.GetProcessStartInfo());
        }
		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);
		}
		protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests, options);
			testResultsMonitor = new TestResultsMonitor();
			app.Results = testResultsMonitor.FileName;
			return app.GetProcessStartInfo();
		}
		void CreatePartCoverApplication(SelectedTests selectedTests)
		{
			NUnitConsoleApplication nunitConsoleApp = new NUnitConsoleApplication(selectedTests, options);
			nunitConsoleApp.Results = base.TestResultsMonitor.FileName;
			
			PartCoverSettings settings = settingsFactory.CreatePartCoverSettings(selectedTests.Project);
			partCoverApplication = new PartCoverApplication(nunitConsoleApp, settings);
		}
		public void Init()
		{
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			
			info = app.GetProcessStartInfo();
		}
		public void Init()
		{
			MockCSharpProject project = new MockCSharpProject();
			NUnitTestProject testProject = new NUnitTestProject(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			
			info = app.GetProcessStartInfo();
		}
		void CreateNUnitConsoleApplication()
		{
			MockCSharpProject project = new MockCSharpProject();
			selectedTests = new SelectedTests(project);
			
			options = new UnitTestingOptions(new Properties());
			nunitConsoleApp = new NUnitConsoleApplication(selectedTests, options);
		}
		public void TargetCpuX64Dotnet2()
		{
			project.ActiveConfiguration = new ConfigurationAndPlatform("Debug", "AnyCPU");
			project.SetProperty("PlatformTarget", "x64");
			project.SetProperty("TargetFrameworkVersion", "v3.5");
			
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-dotnet2.exe", app.FileName);
		}
		void CreateNUnitConsoleApplication()
		{
			project = new MockCSharpProject();
			project.FileName = FileName.Create(@"c:\projects\MyTests\MyTests.csproj");
			
			var testProject = new NUnitTestProject(project);
			options = new UnitTestingOptions(new Properties());
			nunitConsoleApp = new NUnitConsoleApplication(new [] { testProject }, options);
		}
		public void NUnitTestRunnerCreatedWithMockProcessRunnerAndUnitTestingOptions()
		{
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests tests = new SelectedTests(project);
			testRunner.Start(tests);
			
			NUnitConsoleApplication app = new NUnitConsoleApplication(tests, context.UnitTestingOptions);
			string expectedArguments = app.GetArguments();
			Assert.AreEqual(expectedArguments, processRunner.CommandArgumentsPassedToStartMethod);
		}
		public void TargetCpuAnyCPUDotnet45()
		{
			project.ActiveConfiguration = new ConfigurationAndPlatform("Debug", "AnyCPU");
			project.SetProperty("PlatformTarget", "AnyCPU");
			project.SetProperty("TargetFrameworkVersion", "v4.5");
			
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			// We use 32-bit NUnit to test AnyCPU projects because the debugger doesn't support 64-bit
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-x86.exe", app.FileName);
		}
		public PartCoverApplication(string fileName, NUnitConsoleApplication nunitConsoleApp, PartCoverSettings settings)
		{
			this.fileName = fileName;
			this.nunitConsoleApp = nunitConsoleApp;
			this.settings = settings;
			
			if (String.IsNullOrEmpty(fileName)) {
				GetPartCoverApplicationFileName();
			}
		}
		public void NoShadowCopy()
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			app.NoLogo = false;
			app.ShadowCopy = false;
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /noshadow";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
		public void NUnitConsole32BitUsedWhenTargetCpuIs32Bit()
		{
			MockCSharpProject project = new MockCSharpProject();
			project.ActiveConfiguration = "Debug";
			project.ActivePlatform = "AnyCPU";
			project.SetProperty("PlatformTarget", "x86");
				
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-x86.exe", app.FileName);			
		}
		public void TestResultsFile()
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			app.NoLogo = false;
			app.ShadowCopy = true;
			app.NoXmlOutputFile = false;
			app.ResultsPipe = @"C:\results.txt";
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /pipe=\"C:\\results.txt\"";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
		public void NoLogo()
		{
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			app.NoLogo = true;
			app.ShadowCopy = true;
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /nologo";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
		public void TargetCpuAnyCPUDotnet45()
		{
			MockCSharpProject project = new MockCSharpProject();
			project.ActiveConfiguration = "Debug";
			project.ActivePlatform = "AnyCPU";
			project.SetProperty("PlatformTarget", "AnyCPU");
			project.SetProperty("TargetFrameworkVersion", "v4.5");
			
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console.exe", app.FileName);
		}
		public void Init()
		{
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests selectedTests = new SelectedTests(project);
			helper = new NUnitConsoleApplication(selectedTests);
			
			context = new MockRunTestCommandContext();
			context.MockUnitTestsPad.AddProject(project);
			
			buildProject = new MockBuildProjectBeforeTestRun();
			context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject);
			
			processRunner = new MockProcessRunner();
			
			testFramework = new MockNUnitTestFramework(processRunner, context.MockTestResultsMonitor, context.UnitTestingOptions);
			context.MockRegisteredTestFrameworks.AddTestFrameworkForProject(project, testFramework);
			
			runCommand = new DerivedRunTestInPadCommand(context);
		}
		public void TestMethodSpecifiedInInitialize()
		{
			var method = new DefaultUnresolvedMethod(new DefaultUnresolvedTypeDefinition("TestFixture"), "Test");
			var testMethod = new NUnitTestMethod(testProject, method);
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testMethod });
			app.NoLogo = false;
			app.ShadowCopy = true;
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"TestFixture.Test\"";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
		public PartCoverApplication(NUnitConsoleApplication nunitConsoleApp, PartCoverSettings settings)
			: this(null, nunitConsoleApp, settings)
		{
		}
		public void NothingSpecified()
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-x86.exe", app.FileName);
		}
		public void NotMSBuildBasedProject()
		{
			ProjectLoadInformation info = new ProjectLoadInformation(MockSolution.Create(), FileName.Create(@"C:\Projects\Test.proj"), "Test");
			
			MissingProject project = new MissingProject(info);
			ITestProject testProject = new NUnitTestProject(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			
			Assert.AreEqual(project.GetType().BaseType, typeof(AbstractProject), "MissingProject should be derived from AbstractProject.");
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console.exe", app.FileName);
		}
		public void NUnitConsole32BitUsedWhenTargetCpuIs32Bit()
		{
			project.ActiveConfiguration = new ConfigurationAndPlatform("Debug", "AnyCPU");
			project.SetProperty("PlatformTarget", "x86");
			
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console-x86.exe", app.FileName);
		}
		public void NotMSBuildBasedProject()
		{
			MissingProject project = new MissingProject(@"C:\Projects\Test.proj", "Test");
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			
			Assert.AreEqual(project.GetType().BaseType, typeof(AbstractProject), "MissingProject should be derived from AbstractProject.");
			Assert.AreEqual(@"D:\SharpDevelop\bin\Tools\NUnit\nunit-console.exe", app.FileName);			
		}
		public void NUnitTestDebuggerCreatedWithDebuggerService()
		{
			context.UnitTestingOptions.NoShadow = true;
			
			MockCSharpProject project = new MockCSharpProject();
			SelectedTests tests = new SelectedTests(project);
			testDebugger.Start(tests);
			
			NUnitConsoleApplication app = new NUnitConsoleApplication(tests, context.UnitTestingOptions);
			string expectedArguments = app.GetArguments();
			Assert.AreEqual(expectedArguments, debuggerService.MockDebugger.ProcessStartInfo.Arguments);
		}
		public void XmlOutputFileNameSpecifiedOnCommandLine()
		{
			UnitTestingOptions options = new UnitTestingOptions(new Properties());
			options.CreateXmlOutputFile = true;
			NUnitTestClass testFixture = new NUnitTestClass(testProject, new FullTypeName("MyTests.TestFixture.MyTest"));
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testFixture }, options);
			app.NoLogo = false;
			app.ShadowCopy = true;
			
			string expectedCommandLine =
				"\"C:\\Projects\\MyTests\\MyTests.dll\" " +
				"/xml=\"C:\\Projects\\MyTests\\MyTests-TestResult.xml\" " +
				"/run=\"MyTests.TestFixture.MyTest\"";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
示例#28
0
		protected override ProcessStartInfo GetProcessStartInfo(IEnumerable<ITest> selectedTests)
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests, options);
			app.ResultsPipe = base.TestResultsReader.PipeName;
			return app.GetProcessStartInfo();
		}
		public void TestNamespaceSpecifiedInInitialize()
		{
			var testNamespace = new TestNamespace(testProject, "Project.MyTests");
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testNamespace });
			app.NoLogo = false;
			app.ShadowCopy = true;
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"Project.MyTests\"";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
		public void FullCommandLine()
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			app.NoLogo = true;
			app.ShadowCopy = true;
			app.NoXmlOutputFile = false;
			
			FileUtility.ApplicationRootPath = @"C:\SharpDevelop";
			
			string expectedFullCommandLine =
				"\"C:\\SharpDevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
				"\"C:\\Projects\\MyTests\\MyTests.dll\" " +
				"/nologo";
			Assert.AreEqual(expectedFullCommandLine, app.GetCommandLine());
		}
		public void GetProject()
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			Assert.AreSame(project, app.Project);
		}
		public void TestInnerClassSpecifiedInInitialize()
		{
			NUnitTestClass innerTestClass = new NUnitTestClass(testProject, new FullTypeName("MyTests.TestFixture+InnerTest"));
			NUnitConsoleApplication app = new NUnitConsoleApplication(new [] { innerTestClass });
			app.NoLogo = false;
			app.ShadowCopy = true;
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" " +
				"/run=\"MyTests.TestFixture+InnerTest\"";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}