コード例 #1
0
		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);
		}
コード例 #2
0
		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());
		}
コード例 #3
0
		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());
		}
コード例 #4
0
		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());
		}
コード例 #5
0
		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);
		}
コード例 #6
0
		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());
		}
コード例 #7
0
		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());
		}
コード例 #8
0
		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());
		}
コード例 #9
0
		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());
		}
コード例 #10
0
		public void TestMethod()
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			app.NoLogo = false;
			app.ShadowCopy = true;
			app.Fixture = "TestFixture";
			app.Test = "Test";
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"TestFixture.Test\"";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
コード例 #11
0
		public void NoXmlWhenXmlOutputFileSpecified()
		{
			NUnitConsoleApplication app = new NUnitConsoleApplication(new[] { testProject });
			app.NoLogo = false;
			app.ShadowCopy = true;
			app.XmlOutputFile = @"C:\NUnit.xml";
			app.NoXmlOutputFile = true;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /noxml";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
コード例 #12
0
		public void TestInnerClassSpecifiedInInitialize()
		{
			MockClass testFixture = new MockClass("MyTests.TestFixture.InnerTest", "MyTests.TestFixture+InnerTest");
			SelectedTests selectedTests = new SelectedTests(project, null, testFixture, null);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			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());
		}
コード例 #13
0
		public void SecondAssemblySpecified()
		{
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			app.Assemblies.Add("SecondAssembly.dll");
			app.NoLogo = false;
			app.ShadowCopy = true;
			app.Results = @"C:\results.txt";
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = 
				"\"C:\\Projects\\MyTests\\MyTests.dll\" " +
				"\"SecondAssembly.dll\" " +
				"/results=\"C:\\results.txt\"";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}
コード例 #14
0
		public void TestNamespace()
		{
			SelectedTests selectedTests = new SelectedTests(project);
			NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
			app.NoLogo = false;
			app.ShadowCopy = true;
			app.NamespaceFilter = "TestFixture";
			app.NoXmlOutputFile = false;
			
			string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"TestFixture\"";
			Assert.AreEqual(expectedCommandLine, app.GetArguments());
		}