private void GenerateTestFile(TestManifest testManifest)
        {
            var    testClassTemplate = new SparqlTestClassTemplate(testManifest);
            String testClassContent  = testClassTemplate.TransformText();

            File.WriteAllText(testManifest.OutputFilePath, testClassContent);
        }
예제 #2
0
        /// <summary>
        /// When overridden in a derived class, executes the task.
        /// </summary>
        /// <returns>
        /// true if the task successfully executed; otherwise, false.
        /// </returns>
        public override bool Execute()
        {
            var outputDir = new DirectoryInfo(OutputDirectory);
            if (!outputDir.Exists) outputDir.Create();

            foreach (var manifestFile in ManifestFiles)
            {
                if (!File.Exists(manifestFile.ItemSpec))
                {
                    Log.LogError("The ManifestFile '{0}' could not be found", manifestFile.ItemSpec);
                    return false;
                }
                var testManifest = new TestManifest(manifestFile, outputDir, Namespace, RenameTestFiles);
                if (testManifest.IsUpToDate())
                {
                    Log.LogMessage(MessageImportance.Normal,
                                   "The target file {0} is up to date with respect to the manifest file {1}.",
                                   testManifest.OutputFilePath, testManifest.ManifestFilePath);
                }
                else
                {
                    GenerateTestFile(testManifest);
                }
            }
            return true;
        }
        /// <summary>
        /// When overridden in a derived class, executes the task.
        /// </summary>
        /// <returns>
        /// true if the task successfully executed; otherwise, false.
        /// </returns>
        public override bool Execute()
        {
            var outputDir = new DirectoryInfo(OutputDirectory);

            if (!outputDir.Exists)
            {
                outputDir.Create();
            }

            foreach (var manifestFile in ManifestFiles)
            {
                if (!File.Exists(manifestFile.ItemSpec))
                {
                    Log.LogError("The ManifestFile '{0}' could not be found", manifestFile.ItemSpec);
                    return(false);
                }
                var testManifest = new TestManifest(manifestFile, outputDir, Namespace, RenameTestFiles);
                if (testManifest.IsUpToDate())
                {
                    Log.LogMessage(MessageImportance.Normal,
                                   "The target file {0} is up to date with respect to the manifest file {1}.",
                                   testManifest.OutputFilePath, testManifest.ManifestFilePath);
                }
                else
                {
                    GenerateTestFile(testManifest);
                }
            }
            return(true);
        }
 internal SparqlTestClassTemplate(TestManifest testManifest)
 {
     _testManifest = testManifest;
 }
예제 #5
0
 private void GenerateTestFile(TestManifest testManifest)
 {
     var testClassTemplate = new SparqlTestClassTemplate(testManifest);
     String testClassContent = testClassTemplate.TransformText();
     File.WriteAllText(testManifest.OutputFilePath, testClassContent);
 }