public void PopulateFromReflector()
		{
			const string xml = @"
    <exec>
    	<executable>mybatchfile.bat</executable>
    	<baseDirectory>C:\</baseDirectory>
	<buildArgs>myarg1 myarg2</buildArgs>
	<buildTimeoutSeconds>123</buildTimeoutSeconds>
        <environment>
		<variable name=""name1"" value=""value1""/>
		<variable><name>name2</name></variable>
		<variable name=""name3""><value>value3</value></variable>
	</environment>
    <priority>BelowNormal</priority>
	<successExitCodes>0,1,3,5</successExitCodes>
    </exec>";

			task = (ExecutableTask) NetReflector.Read(xml);
			Assert.AreEqual(@"C:\", task.ConfiguredBaseDirectory, "Checking ConfiguredBaseDirectory property.");
			Assert.AreEqual("mybatchfile.bat", task.Executable, "Checking property.");
			Assert.AreEqual(123, task.BuildTimeoutSeconds, "Checking BuildTimeoutSeconds property.");
			Assert.AreEqual("myarg1 myarg2", task.BuildArgs, "Checking BuildArgs property.");
			Assert.AreEqual(3, task.EnvironmentVariables.Length, "Checking environment variable array size.");
			Assert.AreEqual("name1", task.EnvironmentVariables[0].name, "Checking name1 environment variable.");
			Assert.AreEqual("value1", task.EnvironmentVariables[0].value, "Checking name1 environment value.");
			Assert.AreEqual("name2", task.EnvironmentVariables[1].name, "Checking name2 environment variable.");
			Assert.AreEqual("", task.EnvironmentVariables[1].value, "Checking name2 environment value.");
			Assert.AreEqual("name3", task.EnvironmentVariables[2].name, "Checking name3 environment variable.");
			Assert.AreEqual("value3", task.EnvironmentVariables[2].value, "Checking name3 environment value.");
			Assert.AreEqual("0,1,3,5", task.SuccessExitCodes);
            Assert.AreEqual(ProcessPriorityClass.BelowNormal, task.Priority);
			Verify();
		}
		public void ShouldBeAbleToSaveProjectsThatALoaderCanLoad()
		{
			ExecutableTask builder = new ExecutableTask();
			builder.Executable = "foo";
			FileSourceControl sourceControl = new FileSourceControl();
			sourceControl.RepositoryRoot = "bar";
			// Setup
			Project project1 = new Project();
			project1.Name = "Project One";
			project1.SourceControl = sourceControl;
			Project project2 = new Project();
			project2.Name = "Project Two";
			project2.SourceControl = sourceControl;
			ProjectList projectList = new ProjectList();
			projectList.Add(project1);
			projectList.Add(project2);

			DynamicMock mockConfiguration = new DynamicMock(typeof(IConfiguration));
			mockConfiguration.ExpectAndReturn("Projects", projectList);

			FileInfo configFile = new FileInfo(TempFileUtil.CreateTempFile(TempFileUtil.CreateTempDir(this), "loadernet.config"));

			// Execute
			DefaultConfigurationFileSaver saver = new DefaultConfigurationFileSaver(new NetReflectorProjectSerializer());
			saver.Save((IConfiguration) mockConfiguration.MockInstance, configFile);

			DefaultConfigurationFileLoader loader = new DefaultConfigurationFileLoader();
			IConfiguration configuration2 = loader.Load(configFile);

			// Verify
			Assert.IsNotNull (configuration2.Projects["Project One"]);
			Assert.IsNotNull (configuration2.Projects["Project Two"]);
			mockConfiguration.Verify();
		}
		public void SetUp()
		{
			CreateProcessExecutorMock(DefaultExecutable);
			task = new ExecutableTask((ProcessExecutor) mockProcessExecutor.MockInstance);
			task.Executable = DefaultExecutable;
			task.BuildArgs = DefaultArgs;
		}
		public void PopulateFromConfigurationUsingOnlyRequiredElementsAndCheckDefaultValues()
		{
			const string xml = @"
    <exec>
    	<executable>mybatchfile.bat</executable>
    </exec>";

			task = (ExecutableTask) NetReflector.Read(xml);
            Assert.AreEqual("mybatchfile.bat", task.Executable, "Checking property.");
            Assert.AreEqual(600, task.BuildTimeoutSeconds, "Checking BuildTimeoutSeconds property.");
            Assert.AreEqual("", task.BuildArgs, "Checking BuildArgs property.");
            Assert.AreEqual(0, task.EnvironmentVariables.Length, "Checking environment variable array size.");
			Assert.AreEqual("", task.SuccessExitCodes);
            Assert.AreEqual(ProcessPriorityClass.Normal, task.Priority);
			Verify();
		}
        public void ExecutableOutputShouldBeBuildResults()
        {
            ExecutableTask xmlTestTask = new ExecutableTask((ProcessExecutor)mockProcessExecutor.MockInstance);
            xmlTestTask.Executable = DefaultExecutable;
            xmlTestTask.BuildArgs = DefaultArgs;
            ExpectToExecuteArguments(DefaultArgs);

            IIntegrationResult result = IntegrationResult();
            xmlTestTask.Run(result);

            Assert.IsTrue(result.Succeeded);
            Assert.AreEqual(IntegrationStatus.Success, result.Status);

            // TODO: The following only works correctly when ProcessResultOutput is a single non-empty line.
            // That is always the case, courtesy of our superclass' initialization.  If that should ever
            // change, this test needs to be adjusted accordingly.
            Assert.AreEqual(System.Environment.NewLine + "<buildresults>" + System.Environment.NewLine + "  <message>"
                + ProcessResultOutput + "</message>" + System.Environment.NewLine + "</buildresults>"
                + System.Environment.NewLine, result.TaskOutput);
            Verify();
        }