System.Xml.Tests.XsltcTestCaseBase.TryCreatePersistedTransformAssembly C# (CSharp) Méthode

TryCreatePersistedTransformAssembly() private méthode

Currently this method supports only 1 input file. For variations that require more than one input file to test @file functionality, custom-craft and write those input files in the body of the variation method, then pass an appropriate commandline such as @file1 @file2 @file3, along with createFromInputFile = false.
private TryCreatePersistedTransformAssembly ( string commandLine, bool createFromInputFile, bool expectedToSucceed, string targetDirectory ) : string
commandLine string
createFromInputFile bool
expectedToSucceed bool
targetDirectory string
Résultat string
        private string TryCreatePersistedTransformAssembly(string commandLine, bool createFromInputFile, bool expectedToSucceed, string targetDirectory)
        {
            // If createFromInputFile is specified, create an input file now that the compiler can consume.
            string processArguments = createFromInputFile ? "@" + CreateInputFile(commandLine) : commandLine;

            var processStartInfo = new ProcessStartInfo
            {
                FileName = XsltVerificationLibrary.SearchPath("xsltc.exe"),
                Arguments = processArguments,
                //WindowStyle = ProcessWindowStyle.Hidden,
                CreateNoWindow = true,
                UseShellExecute = false,
                RedirectStandardOutput = true,
                WorkingDirectory = targetDirectory
            };

            // Call xsltc to create persistant assembly.
            var compilerProcess = new Process
            {
                StartInfo = processStartInfo
            };

            compilerProcess.Start();
            string output = compilerProcess.StandardOutput.ReadToEnd();
            compilerProcess.WaitForExit();

            if (createFromInputFile)
            {
                SafeDeleteFile(processArguments.Substring(1));
            }

            if (expectedToSucceed)
            {
                // The Assembly was created successfully
                if (compilerProcess.ExitCode == 0)
                {
                    return output;
                }

                throw new CTestFailedException("Failed to create assembly: " + output);
            }

            return output;
        }