public MockNUnitTestFramework(IUnitTestDebuggerService debuggerService,
			ITestResultsMonitor testResultsMonitor, 
			UnitTestingOptions options,
			IMessageService messageService)
			: this(debuggerService, null, testResultsMonitor, options, messageService)
		{
		}
		public CodeCoverageTestRunner(CodeCoverageTestRunnerContext context)
			: base(context)
		{
			this.options = context.Options;
			this.fileSystem = context.CodeCoverageFileSystem;
			settingsFactory = new PartCoverSettingsFactory(fileSystem);
		}
		public void NoThreadSetToTrueInProperties()
		{
			Properties newProperties = new Properties();
			newProperties.Set<bool>(UnitTestingOptions.NoThreadProperty, true);
			UnitTestingOptions options = new UnitTestingOptions(newProperties);
			
			Assert.IsTrue(options.NoThread);
		}
		public NUnitTestDebugger(IDebuggerService debuggerService,
			IMessageService messageService,
			ITestResultsReader testResultsReader,
			UnitTestingOptions options)
			: base(debuggerService, messageService, testResultsReader)
		{
			this.options = options;
		}
		void CreateNUnitConsoleApplication()
		{
			MockCSharpProject project = new MockCSharpProject();
			selectedTests = new SelectedTests(project);
			
			options = new UnitTestingOptions(new Properties());
			nunitConsoleApp = new NUnitConsoleApplication(selectedTests, options);
		}
 public NUnitTestDebugger(IUnitTestDebuggerService debuggerService,
                          IUnitTestMessageService messageService,
                          ITestResultsMonitor testResultsMonitor,
                          UnitTestingOptions options)
     : base(debuggerService, messageService, testResultsMonitor)
 {
     this.options = options;
 }
		public DerivedCodeCoverageTestRunner(IUnitTestProcessRunner processRunner,
			ITestResultsMonitor testResultsMonitor,
			UnitTestingOptions options,
			IFileSystem fileSystem,
			IUnitTestMessageService messageService)
			: base(new CodeCoverageTestRunnerContext(processRunner, testResultsMonitor, fileSystem, messageService, options))
		{
		}
		public NUnitTestDebugger(IUnitTestDebuggerService debuggerService,
			IUnitTestMessageService messageService,
			ITestResultsMonitor testResultsMonitor,
			UnitTestingOptions options)
			: base(debuggerService, messageService, testResultsMonitor)
		{
			this.options = options;
		}
 public NUnitTestDebugger(IDebuggerService debuggerService,
                          IMessageService messageService,
                          ITestResultsReader testResultsReader,
                          UnitTestingOptions options)
     : base(debuggerService, messageService, testResultsReader)
 {
     this.options = options;
 }
		public void Init()
		{
			processRunner = new MockProcessRunner();
			testResultsMonitor = new MockTestResultsMonitor();
			options = new UnitTestingOptions(new Properties());
			fileSystem = new MockFileSystem();
			messageService = new MockMessageService();
			testRunner = new DerivedCodeCoverageTestRunner(processRunner, testResultsMonitor, options, fileSystem, messageService);
		}
		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 CodeCoverageTestRunnerContext(IUnitTestProcessRunner processRunner,
			ITestResultsMonitor testResultsMonitor,
			ICSharpCode.CodeCoverage.IFileSystem fileSystem,
			IUnitTestMessageService messageService,
			UnitTestingOptions options)
			: base(processRunner, testResultsMonitor, fileSystem, messageService)
		{
			this.options = options;
		}
		public MockNUnitTestFramework(IUnitTestDebuggerService debuggerService,
			IUnitTestProcessRunner processRunner,
			ITestResultsMonitor testResultsMonitor, 
			UnitTestingOptions options,
			IMessageService messageService)
		{
			this.debuggerService = debuggerService;
			this.processRunner = processRunner;
			this.testResultsMonitor = testResultsMonitor;
			this.options = options;
			this.messageService = messageService;
		}
		void InitializeOptions(UnitTestingOptions options)
		{
			NoThread = options.NoThread;
			NoLogo = options.NoLogo;
			NoDots = options.NoDots;
			Labels = options.Labels;
			ShadowCopy = !options.NoShadow;
			
			if (options.CreateXmlOutputFile) {
				GenerateXmlOutputFileName();
			}
		}
        void InitializeOptions(UnitTestingOptions options)
        {
            NoThread   = options.NoThread;
            NoLogo     = options.NoLogo;
            NoDots     = options.NoDots;
            Labels     = options.Labels;
            ShadowCopy = !options.NoShadow;

            if (options.CreateXmlOutputFile)
            {
                GenerateXmlOutputFileName();
            }
        }
		public MockCodeCoverageTestRunnerFactory()
		{
			ProcessRunner = new MockProcessRunner();
			TestResultsMonitor = new MockTestResultsMonitor();
			Options = new UnitTestingOptions(new Properties());
			FileSystem = new MockFileSystem();
			CodeCoverageTestRunnerContext context = new CodeCoverageTestRunnerContext(ProcessRunner, 
				TestResultsMonitor, 
				FileSystem, 
				MessageService,
				Options);
			TestRunner = new CodeCoverageTestRunner(context);
		}
		public void Init()
		{
			selectedTests = SelectedTestsHelper.CreateSelectedTestMember();
			FileUtility.ApplicationRootPath = @"C:\SharpDevelop";
			
			messageService = new MockMessageService();
			debuggerService = new MockDebuggerService();
			debugger = debuggerService.MockDebugger;
			testResultsMonitor = new MockTestResultsMonitor();
			testResultsMonitor.FileName = @"c:\temp\tmp66.tmp";
			options = new UnitTestingOptions(new Properties());
			options.NoShadow = true;
			testDebugger = new NUnitTestDebugger(debuggerService, messageService, testResultsMonitor, options);
		}
        /// <summary>
        /// Runs the test for the project after a successful build.
        /// </summary>
        void OnBuildComplete(BuildResults results, IProject project, string namespaceFilter, IClass fixture, IMember test)
        {
            if (results.ErrorCount == 0 && IsRunningTest)
            {
                UnitTestApplicationStartHelper helper = new UnitTestApplicationStartHelper();

                UnitTestingOptions options = new UnitTestingOptions();
                helper.NoThread   = options.NoThread;
                helper.NoLogo     = options.NoLogo;
                helper.NoDots     = options.NoDots;
                helper.Labels     = options.Labels;
                helper.ShadowCopy = !options.NoShadow;

                if (options.CreateXmlOutputFile)
                {
                    helper.XmlOutputFile = Path.Combine(Path.GetDirectoryName(project.OutputAssemblyFullPath), project.AssemblyName + "-TestResult.xml");
                }

                helper.Initialize(project, namespaceFilter, fixture, test);
                helper.Results = Path.GetTempFileName();

                ResetTestResults(project);

                testResultsMonitor.FileName = helper.Results;
                testResultsMonitor.Start();

                try {
                    RunTests(helper);
                } catch {
                    StopMonitoring();
                    throw;
                }
            }
            else
            {
                if (IsRunningTest)
                {
                    Stop();
                }
                if (TaskService.SomethingWentWrong && ErrorListPad.ShowAfterBuild)
                {
                    ShowErrorList();
                }
            }
        }
		public void SetUp()
		{
			Properties p = new Properties();
			options = new UnitTestingOptions(p);
			options.Labels = true;
			options.NoDots = false;
			options.NoShadow = false;
			options.NoThread = false;
			options.CreateXmlOutputFile = false;
			
			panel = new DerivedUnitTestingOptionsPanel(options);
			panel.LoadPanelContents();
			
			labelsCheckBox = (CheckBox)panel.ControlDictionary["labelsCheckBox"];
			showLogoCheckBox = (CheckBox)panel.ControlDictionary["showLogoCheckBox"];
			showProgressCheckBox = (CheckBox)panel.ControlDictionary["showProgressCheckBox"];
			threadCheckBox = (CheckBox)panel.ControlDictionary["threadCheckBox"];
			shadowCopyCheckBox = (CheckBox)panel.ControlDictionary["shadowCopyCheckBox"];			
			createXmlOutputFileCheckBox = (CheckBox)panel.ControlDictionary["createXmlOutputFileCheckBox"];			
		}
		/// <summary>
		/// Runs the test for the project after a successful build.
		/// </summary>
		void OnBuildComplete(BuildResults results, IProject project, string namespaceFilter, IClass fixture, IMember test)
		{
			if (results.ErrorCount == 0 && IsRunningTest) {
				UnitTestApplicationStartHelper helper = new UnitTestApplicationStartHelper();
				
				UnitTestingOptions options = new UnitTestingOptions();
				helper.NoThread = options.NoThread;
				helper.NoLogo = options.NoLogo;
				helper.NoDots = options.NoDots;
				helper.Labels = options.Labels;
				helper.ShadowCopy = !options.NoShadow;
				
				if (options.CreateXmlOutputFile) {
					helper.XmlOutputFile = Path.Combine(Path.GetDirectoryName(project.OutputAssemblyFullPath), project.AssemblyName + "-TestResult.xml");
				}
				
				helper.Initialize(project, namespaceFilter, fixture, test);
				helper.Results = Path.GetTempFileName();
				
				ResetTestResults(project);

				testResultsMonitor.FileName = helper.Results;
				testResultsMonitor.Start();
				
				try {
					RunTests(helper);
				} catch {
					StopMonitoring();
					throw;
				}
			} else {
				if (IsRunningTest) {
					Stop();
				}
				if (TaskService.SomethingWentWrong && ErrorListPad.ShowAfterBuild) {
					ShowErrorList();
				}
			}
		}
		public NUnitConsoleApplication(SelectedTests selectedTests, UnitTestingOptions options)
		{
			Initialize(selectedTests);
			InitializeOptions(options);
		}
		public UnitTestingOptionsPanel(UnitTestingOptions options)
		{
			this.options = options;
		}
 public NUnitConsoleApplication(IEnumerable <ITest> selectedTests, UnitTestingOptions options)
 {
     Initialize(selectedTests);
     InitializeOptions(options);
 }
		public MockNUnitTestFramework(IUnitTestProcessRunner processRunner,
			ITestResultsMonitor testResultsMonitor, 
			UnitTestingOptions options)
			: this(null, processRunner, testResultsMonitor, options, null)
		{
		}
 public NUnitConsoleApplication(SelectedTests selectedTests, UnitTestingOptions options)
 {
     Initialize(selectedTests);
     InitializeOptions(options);
 }
		public NUnitTestRunner(TestProcessRunnerBaseContext context, UnitTestingOptions options)
			: base(context)
		{
			this.options = options;
		}
 public NUnitTestRunner(TestProcessRunnerBaseContext context,
                        UnitTestingOptions options)
     : base(context)
 {
     this.options = options;
 }
		public NUnitConsoleApplication(IEnumerable<ITest> selectedTests, UnitTestingOptions options)
		{
			Initialize(selectedTests);
			InitializeOptions(options);
		}
 public UnitTestingOptionsPanel(UnitTestingOptions options)
 {
     this.options = options;
 }
		public DerivedUnitTestingOptionsPanel(UnitTestingOptions options) : base(options)
		{
		}
		public void Init()
		{
			p = new Properties();
			defaultOptions = new UnitTestingOptions(p);
		}
		public void CreateXmlOutputFileSetToTrueInProperties()
		{
			Properties newProperties = new Properties();
			newProperties.Set<bool>(UnitTestingOptions.CreateXmlOutputFileProperty, true);
			UnitTestingOptions options = new UnitTestingOptions(newProperties);
			
			Assert.IsTrue(options.CreateXmlOutputFile);
		}
		public void LabelsSetToTrueInProperties()
		{
			Properties newProperties = new Properties();
			newProperties.Set<bool>(UnitTestingOptions.LabelsProperty, true);
			UnitTestingOptions options = new UnitTestingOptions(newProperties);
			
			Assert.IsTrue(options.Labels);
		}
		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());
		}