@ai-dev-tools/csharp-copilot-core 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/ai-dev-tools-csharp-copilot-core-0.0.19.tgz +0 -0
  2. package/azure-pipelines.yml +52 -0
  3. package/out/analyze/cecil.d.ts +1 -0
  4. package/out/analyze/cecil.js +42 -0
  5. package/out/analyze/cecil.js.map +1 -0
  6. package/out/analyze/checkCodeSyntax.d.ts +7 -0
  7. package/out/analyze/checkCodeSyntax.js +67 -0
  8. package/out/analyze/checkCodeSyntax.js.map +1 -0
  9. package/out/analyze/generateCodeDependency.d.ts +6 -0
  10. package/out/analyze/generateCodeDependency.js +122 -0
  11. package/out/analyze/generateCodeDependency.js.map +1 -0
  12. package/out/analyze/installAnalyzerTool.d.ts +1 -0
  13. package/out/analyze/installAnalyzerTool.js +82 -0
  14. package/out/analyze/installAnalyzerTool.js.map +1 -0
  15. package/out/atmpCache/deps/EplantRequestCategoryCondition_Conditions_Eplant_Workflows_SharedSegmentsPlugins_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +281 -0
  16. package/out/atmpCache/deps/IdentitySelectAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
  17. package/out/atmpCache/deps/SqmidHelperTests_Utils_HttpRequestParser_Overview_Workflows_SharedSegmentsTests_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +1 -0
  18. package/out/atmpCache/deps/SqmidHelper_Utils_HttpRequestParser_Overview_Workflows_SharedSegmentsPlugins_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +1 -0
  19. package/out/atmpCache/deps/ToListCountAnalyzerTests_ToListinatorTests_test_AIUnitTestExample_code_d.deps +4037 -0
  20. package/out/atmpCache/deps/ToListCountAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
  21. package/out/atmpCache/deps/ToListCountCodeFixProvider_ToListinatorCodeFixes_src_AIUnitTestExample_code_d.deps +1 -0
  22. package/out/atmpCache/deps/ToListForEachAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
  23. package/out/atmpCache/dllref/ToListinatorTests_ToListinatorTests_test_AIUnitTestExample_code_d.dllref +202 -0
  24. package/out/batch/generateCodeTests.d.ts +6 -0
  25. package/out/batch/generateCodeTests.js +147 -0
  26. package/out/batch/generateCodeTests.js.map +1 -0
  27. package/out/batch/getFolderCodeFile.d.ts +1 -0
  28. package/out/batch/getFolderCodeFile.js +19 -0
  29. package/out/batch/getFolderCodeFile.js.map +1 -0
  30. package/out/batch/getProjectCodeFile.d.ts +4 -0
  31. package/out/batch/getProjectCodeFile.js +87 -0
  32. package/out/batch/getProjectCodeFile.js.map +1 -0
  33. package/out/batch/getSolutionCodeFile.d.ts +8 -0
  34. package/out/batch/getSolutionCodeFile.js +70 -0
  35. package/out/batch/getSolutionCodeFile.js.map +1 -0
  36. package/out/benchmark/formatToMarkdown.d.ts +2 -0
  37. package/out/benchmark/formatToMarkdown.js +101 -0
  38. package/out/benchmark/formatToMarkdown.js.map +1 -0
  39. package/out/benchmark/generateBenchmarkReport.d.ts +1 -0
  40. package/out/benchmark/generateBenchmarkReport.js +82 -0
  41. package/out/benchmark/generateBenchmarkReport.js.map +1 -0
  42. package/out/codeCoverage/codeCoverage.d.ts +6 -0
  43. package/out/codeCoverage/codeCoverage.js +35 -0
  44. package/out/codeCoverage/codeCoverage.js.map +1 -0
  45. package/out/codeCoverage/codeCoverageReport.d.ts +6 -0
  46. package/out/codeCoverage/codeCoverageReport.js +72 -0
  47. package/out/codeCoverage/codeCoverageReport.js.map +1 -0
  48. package/out/codeCoverage/extractCodeCoverageInfo.d.ts +2 -0
  49. package/out/codeCoverage/extractCodeCoverageInfo.js +80 -0
  50. package/out/codeCoverage/extractCodeCoverageInfo.js.map +1 -0
  51. package/out/codeCoverage/generateCodeCoverageReport.d.ts +1 -0
  52. package/out/codeCoverage/generateCodeCoverageReport.js +27 -0
  53. package/out/codeCoverage/generateCodeCoverageReport.js.map +1 -0
  54. package/out/codeCoverage/getCodeCoverageSetting.d.ts +1 -0
  55. package/out/codeCoverage/getCodeCoverageSetting.js +58 -0
  56. package/out/codeCoverage/getCodeCoverageSetting.js.map +1 -0
  57. package/out/codeCoverage/reportTool.d.ts +2 -0
  58. package/out/codeCoverage/reportTool.js +22 -0
  59. package/out/codeCoverage/reportTool.js.map +1 -0
  60. package/out/codeCoverage/simplifyCoverageXml.d.ts +2 -0
  61. package/out/codeCoverage/simplifyCoverageXml.js +116 -0
  62. package/out/codeCoverage/simplifyCoverageXml.js.map +1 -0
  63. package/out/codebk/250804prompt/buildAfGuidelines.liquid +15 -0
  64. package/out/codebk/250804prompt/general/generalBuildAutofixGuidelines.liquid +13 -0
  65. package/out/codebk/250804prompt/general/generalUtGuidelines.liquid +18 -0
  66. package/out/codebk/250804prompt/generateUtAutoFix.liquid +19 -0
  67. package/out/codebk/250804prompt/generateUtGuidelines.liquid +13 -0
  68. package/out/codebk/250804prompt/generateUtSystem.liquid +5 -0
  69. package/out/codebk/250804prompt/generateUtUserInput.liquid +27 -0
  70. package/out/codebk/250804prompt/testAfGuidelines.liquid +6 -0
  71. package/out/codebk/250804prompt/xap/xapBuildAutofixGuidelines.liquid +13 -0
  72. package/out/codebk/250804prompt/xap/xapCodeCodeDependency.liquid +0 -0
  73. package/out/codebk/250804prompt/xap/xapCodeSample.liquid +38 -0
  74. package/out/codebk/250804prompt/xap/xapUtGuideline-240804.liquid +36 -0
  75. package/out/codebk/250804prompt/xap/xapUtGuideline.liquid +36 -0
  76. package/out/codebk/childProcessManager.d.ts +1 -0
  77. package/out/codebk/childProcessManager.js +50 -0
  78. package/out/codebk/childProcessManager.js.map +1 -0
  79. package/out/codebk/msBuidSpawn.d.ts +1 -0
  80. package/out/codebk/msBuidSpawn.js +58 -0
  81. package/out/codebk/msBuidSpawn.js.map +1 -0
  82. package/out/codebk/msBuild.d.ts +1 -0
  83. package/out/codebk/msBuild.js +123 -0
  84. package/out/codebk/msBuild.js.map +1 -0
  85. package/out/codebk/old/generateXapTestAutoFix.liquid +12 -0
  86. package/out/codebk/old/generateXapTestGuidelines-fm.liquid +68 -0
  87. package/out/codebk/old/generateXapTestGuidelines.liquid +28 -0
  88. package/out/codebk/old/xapGuideline-fm.liquid +149 -0
  89. package/out/codebk/old/xapGuideline.liquid +37 -0
  90. package/out/codebk/oldExec/checkCodeSyntax.d.ts +1 -0
  91. package/out/codebk/oldExec/checkCodeSyntax.js +81 -0
  92. package/out/codebk/oldExec/checkCodeSyntax.js.map +1 -0
  93. package/out/codebk/oldExec/codeCoverage.d.ts +1 -0
  94. package/out/codebk/oldExec/codeCoverage.js +54 -0
  95. package/out/codebk/oldExec/codeCoverage.js.map +1 -0
  96. package/out/codebk/oldExec/codeCoverageReport.d.ts +1 -0
  97. package/out/codebk/oldExec/codeCoverageReport.js +64 -0
  98. package/out/codebk/oldExec/codeCoverageReport.js.map +1 -0
  99. package/out/codebk/oldExec/containsMethods.d.ts +1 -0
  100. package/out/codebk/oldExec/containsMethods.js +74 -0
  101. package/out/codebk/oldExec/containsMethods.js.map +1 -0
  102. package/out/codebk/oldExec/generateCodeDependency.d.ts +1 -0
  103. package/out/codebk/oldExec/generateCodeDependency.js +95 -0
  104. package/out/codebk/oldExec/generateCodeDependency.js.map +1 -0
  105. package/out/codebk/oldExec/msBuild.d.ts +1 -0
  106. package/out/codebk/oldExec/msBuild.js +53 -0
  107. package/out/codebk/oldExec/msBuild.js.map +1 -0
  108. package/out/codebk/oldExec/vsTest.d.ts +1 -0
  109. package/out/codebk/oldExec/vsTest.js +71 -0
  110. package/out/codebk/oldExec/vsTest.js.map +1 -0
  111. package/out/codebk/prompts/general/generalUnitTestGuidelines-20250702.liquid +56 -0
  112. package/out/codebk/prompts/generateXapTestGuidelines-20250704.liquid +21 -0
  113. package/out/codebk/prompts/generateXapTestGuidelines-o.liquid +29 -0
  114. package/out/codebk/prompts/xap/xapGuideline-o.liquid +45 -0
  115. package/out/codebk/testbuildkill.d.ts +1 -0
  116. package/out/codebk/testbuildkill.js +37 -0
  117. package/out/codebk/testbuildkill.js.map +1 -0
  118. package/out/command/index.d.ts +2 -0
  119. package/out/command/index.js +85 -0
  120. package/out/command/index.js.map +1 -0
  121. package/out/command/utGenWrapper.d.ts +3 -0
  122. package/out/command/utGenWrapper.js +40 -0
  123. package/out/command/utGenWrapper.js.map +1 -0
  124. package/out/exit/childProcessManager.d.ts +2 -0
  125. package/out/exit/childProcessManager.js +43 -0
  126. package/out/exit/childProcessManager.js.map +1 -0
  127. package/out/exit/setupProcessSignalHandler.d.ts +1 -0
  128. package/out/exit/setupProcessSignalHandler.js +18 -0
  129. package/out/exit/setupProcessSignalHandler.js.map +1 -0
  130. package/out/gen/autoFix.d.ts +4 -0
  131. package/out/gen/autoFix.js +125 -0
  132. package/out/gen/autoFix.js.map +1 -0
  133. package/out/gen/csharpUtGen.d.ts +2 -0
  134. package/out/gen/csharpUtGen.js +151 -0
  135. package/out/gen/csharpUtGen.js.map +1 -0
  136. package/out/gen/ensureValidLLMResponse.d.ts +1 -0
  137. package/out/gen/ensureValidLLMResponse.js +19 -0
  138. package/out/gen/ensureValidLLMResponse.js.map +1 -0
  139. package/out/gen/postGen/extractCodeFromResponse.d.ts +1 -0
  140. package/out/gen/postGen/extractCodeFromResponse.js +37 -0
  141. package/out/gen/postGen/extractCodeFromResponse.js.map +1 -0
  142. package/out/gen/postGen/postGenProcess.d.ts +1 -0
  143. package/out/gen/postGen/postGenProcess.js +36 -0
  144. package/out/gen/postGen/postGenProcess.js.map +1 -0
  145. package/out/gen/postGen/removeComments.d.ts +1 -0
  146. package/out/gen/postGen/removeComments.js +92 -0
  147. package/out/gen/postGen/removeComments.js.map +1 -0
  148. package/out/gen/postGen/removeSingleLines.d.ts +1 -0
  149. package/out/gen/postGen/removeSingleLines.js +28 -0
  150. package/out/gen/postGen/removeSingleLines.js.map +1 -0
  151. package/out/gen/postGen/repairRequiredNameSpaces.d.ts +1 -0
  152. package/out/gen/postGen/repairRequiredNameSpaces.js +116 -0
  153. package/out/gen/postGen/repairRequiredNameSpaces.js.map +1 -0
  154. package/out/gen/postGen/validateTestCode.d.ts +1 -0
  155. package/out/gen/postGen/validateTestCode.js +14 -0
  156. package/out/gen/postGen/validateTestCode.js.map +1 -0
  157. package/out/gen/preGen/excludeFileName.d.ts +1 -0
  158. package/out/gen/preGen/excludeFileName.js +49 -0
  159. package/out/gen/preGen/excludeFileName.js.map +1 -0
  160. package/out/gen/preGen/excludeSpecificTag.d.ts +1 -0
  161. package/out/gen/preGen/excludeSpecificTag.js +18 -0
  162. package/out/gen/preGen/excludeSpecificTag.js.map +1 -0
  163. package/out/gen/preGen/preGenProcess.d.ts +1 -0
  164. package/out/gen/preGen/preGenProcess.js +22 -0
  165. package/out/gen/preGen/preGenProcess.js.map +1 -0
  166. package/out/gen/preGen/validateCode.d.ts +3 -0
  167. package/out/gen/preGen/validateCode.js +62 -0
  168. package/out/gen/preGen/validateCode.js.map +1 -0
  169. package/out/index.d.ts +2 -0
  170. package/out/index.js +8 -0
  171. package/out/index.js.map +1 -0
  172. package/out/llm/model/Gpt4o.d.ts +1 -0
  173. package/out/llm/model/Gpt4o.js +91 -0
  174. package/out/llm/model/Gpt4o.js.map +1 -0
  175. package/out/llm/model/claude4.d.ts +1 -0
  176. package/out/llm/model/claude4.js +3 -0
  177. package/out/llm/model/claude4.js.map +1 -0
  178. package/out/llm/preparePrompt.d.ts +2 -0
  179. package/out/llm/preparePrompt.js +110 -0
  180. package/out/llm/preparePrompt.js.map +1 -0
  181. package/out/llm/prompt/buildAfGuidelines.liquid +15 -0
  182. package/out/llm/prompt/general/generalBuildAutofixGuidelines.liquid +13 -0
  183. package/out/llm/prompt/general/generalUtGuidelines.liquid +16 -0
  184. package/out/llm/prompt/generateUtAutoFix.liquid +19 -0
  185. package/out/llm/prompt/generateUtDependency.liquid +3 -0
  186. package/out/llm/prompt/generateUtGuidelines.liquid +29 -0
  187. package/out/llm/prompt/generateUtSystem.liquid +5 -0
  188. package/out/llm/prompt/generateUtTemplate.liquid +30 -0
  189. package/out/llm/prompt/generateUtUserInput.liquid +4 -0
  190. package/out/llm/prompt/testAfGuidelines.liquid +6 -0
  191. package/out/llm/prompt/userCustomPrompt.liquid +0 -0
  192. package/out/llm/prompt/xap/xapBuildAutofixGuidelines.liquid +13 -0
  193. package/out/llm/prompt/xap/xapCodeCodeDependency.liquid +0 -0
  194. package/out/llm/prompt/xap/xapCodeSample.liquid +38 -0
  195. package/out/llm/prompt/xap/xapUtGuideline-240804.liquid +36 -0
  196. package/out/llm/prompt/xap/xapUtGuideline.liquid +37 -0
  197. package/out/llm/sendRequestToLLM.d.ts +4 -0
  198. package/out/llm/sendRequestToLLM.js +12 -0
  199. package/out/llm/sendRequestToLLM.js.map +1 -0
  200. package/out/llm/sendRequestToSelfHostLLM.d.ts +4 -0
  201. package/out/llm/sendRequestToSelfHostLLM.js +41 -0
  202. package/out/llm/sendRequestToSelfHostLLM.js.map +1 -0
  203. package/out/metrics/appInsightTelemetry.d.ts +6 -0
  204. package/out/metrics/appInsightTelemetry.js +77 -0
  205. package/out/metrics/appInsightTelemetry.js.map +1 -0
  206. package/out/metrics/machineId.d.ts +11 -0
  207. package/out/metrics/machineId.js +85 -0
  208. package/out/metrics/machineId.js.map +1 -0
  209. package/out/setup/setup.d.ts +1 -0
  210. package/out/setup/setup.js +10 -0
  211. package/out/setup/setup.js.map +1 -0
  212. package/out/setup/setupConsole.d.ts +1 -0
  213. package/out/setup/setupConsole.js +23 -0
  214. package/out/setup/setupConsole.js.map +1 -0
  215. package/out/setup/setupLLMRequest.d.ts +2 -0
  216. package/out/setup/setupLLMRequest.js +10 -0
  217. package/out/setup/setupLLMRequest.js.map +1 -0
  218. package/out/tools/devenvcom.cmd +13 -0
  219. package/out/tools/devenvexe.cmd +13 -0
  220. package/out/tools/msbuildexe.cmd +13 -0
  221. package/out/tools/vstestexe.cmd +13 -0
  222. package/out/types/benchmark.d.ts +11 -0
  223. package/out/types/benchmark.js +3 -0
  224. package/out/types/benchmark.js.map +1 -0
  225. package/out/types/buildResult.d.ts +8 -0
  226. package/out/types/buildResult.js +3 -0
  227. package/out/types/buildResult.js.map +1 -0
  228. package/out/types/constants.d.ts +3 -0
  229. package/out/types/constants.js +7 -0
  230. package/out/types/constants.js.map +1 -0
  231. package/out/types/genResult.d.ts +10 -0
  232. package/out/types/genResult.js +3 -0
  233. package/out/types/genResult.js.map +1 -0
  234. package/out/types/testResult.d.ts +12 -0
  235. package/out/types/testResult.js +3 -0
  236. package/out/types/testResult.js.map +1 -0
  237. package/out/types/verifyResult.d.ts +8 -0
  238. package/out/types/verifyResult.js +3 -0
  239. package/out/types/verifyResult.js.map +1 -0
  240. package/out/utils/checkTestProject.d.ts +2 -0
  241. package/out/utils/checkTestProject.js +79 -0
  242. package/out/utils/checkTestProject.js.map +1 -0
  243. package/out/utils/checkXapCode.d.ts +2 -0
  244. package/out/utils/checkXapCode.js +59 -0
  245. package/out/utils/checkXapCode.js.map +1 -0
  246. package/out/utils/delay.d.ts +1 -0
  247. package/out/utils/delay.js +7 -0
  248. package/out/utils/delay.js.map +1 -0
  249. package/out/utils/detectTestFramework.d.ts +1 -0
  250. package/out/utils/detectTestFramework.js +32 -0
  251. package/out/utils/detectTestFramework.js.map +1 -0
  252. package/out/utils/fileUtils.d.ts +2 -0
  253. package/out/utils/fileUtils.js +42 -0
  254. package/out/utils/fileUtils.js.map +1 -0
  255. package/out/utils/generateCodeSha256.d.ts +1 -0
  256. package/out/utils/generateCodeSha256.js +46 -0
  257. package/out/utils/generateCodeSha256.js.map +1 -0
  258. package/out/utils/getCodeStructurePath.d.ts +5 -0
  259. package/out/utils/getCodeStructurePath.js +155 -0
  260. package/out/utils/getCodeStructurePath.js.map +1 -0
  261. package/out/utils/getOrCreateDir.d.ts +2 -0
  262. package/out/utils/getOrCreateDir.js +63 -0
  263. package/out/utils/getOrCreateDir.js.map +1 -0
  264. package/out/utils/getTestCodeInfo.d.ts +2 -0
  265. package/out/utils/getTestCodeInfo.js +121 -0
  266. package/out/utils/getTestCodeInfo.js.map +1 -0
  267. package/out/utils/getTestFile.d.ts +13 -0
  268. package/out/utils/getTestFile.js +295 -0
  269. package/out/utils/getTestFile.js.map +1 -0
  270. package/out/utils/parseBuildResult.d.ts +3 -0
  271. package/out/utils/parseBuildResult.js +44 -0
  272. package/out/utils/parseBuildResult.js.map +1 -0
  273. package/out/utils/parseSyntaxCheckResult.d.ts +2 -0
  274. package/out/utils/parseSyntaxCheckResult.js +38 -0
  275. package/out/utils/parseSyntaxCheckResult.js.map +1 -0
  276. package/out/utils/parseVstestResult.d.ts +3 -0
  277. package/out/utils/parseVstestResult.js +61 -0
  278. package/out/utils/parseVstestResult.js.map +1 -0
  279. package/out/utils/removeFailedTestMethods.d.ts +3 -0
  280. package/out/utils/removeFailedTestMethods.js +207 -0
  281. package/out/utils/removeFailedTestMethods.js.map +1 -0
  282. package/out/utils/runCommand.d.ts +1 -0
  283. package/out/utils/runCommand.js +14 -0
  284. package/out/utils/runCommand.js.map +1 -0
  285. package/out/utils/spawnExec.d.ts +1 -0
  286. package/out/utils/spawnExec.js +80 -0
  287. package/out/utils/spawnExec.js.map +1 -0
  288. package/out/utils/verifyBuildErrorCausedFile.d.ts +1 -0
  289. package/out/utils/verifyBuildErrorCausedFile.js +60 -0
  290. package/out/utils/verifyBuildErrorCausedFile.js.map +1 -0
  291. package/out/utils/verifyTestCode.d.ts +2 -0
  292. package/out/utils/verifyTestCode.js +25 -0
  293. package/out/utils/verifyTestCode.js.map +1 -0
  294. package/out/utils/writeGenCode.d.ts +1 -0
  295. package/out/utils/writeGenCode.js +50 -0
  296. package/out/utils/writeGenCode.js.map +1 -0
  297. package/out/vs/msBuild.d.ts +13 -0
  298. package/out/vs/msBuild.js +81 -0
  299. package/out/vs/msBuild.js.map +1 -0
  300. package/out/vs/vsTest.d.ts +15 -0
  301. package/out/vs/vsTest.js +107 -0
  302. package/out/vs/vsTest.js.map +1 -0
  303. package/out/vs/vsTools.d.ts +7 -0
  304. package/out/vs/vsTools.js +177 -0
  305. package/out/vs/vsTools.js.map +1 -0
  306. package/out/vsPlugin/getVsPluginVerifyResult.d.ts +2 -0
  307. package/out/vsPlugin/getVsPluginVerifyResult.js +41 -0
  308. package/out/vsPlugin/getVsPluginVerifyResult.js.map +1 -0
  309. package/out/vsPlugin/interactionConstants.d.ts +2 -0
  310. package/out/vsPlugin/interactionConstants.js +10 -0
  311. package/out/vsPlugin/interactionConstants.js.map +1 -0
  312. package/out/vsPlugin/sendStdToVsPlugin.d.ts +1 -0
  313. package/out/vsPlugin/sendStdToVsPlugin.js +12 -0
  314. package/out/vsPlugin/sendStdToVsPlugin.js.map +1 -0
  315. package/out/vsPlugin/stdListener.d.ts +3 -0
  316. package/out/vsPlugin/stdListener.js +57 -0
  317. package/out/vsPlugin/stdListener.js.map +1 -0
  318. package/package.json +33 -0
  319. package/tools/devenvcom.cmd +13 -0
  320. package/tools/devenvexe.cmd +13 -0
  321. package/tools/msbuildexe.cmd +13 -0
  322. package/tools/vstestexe.cmd +13 -0
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ // import * as path from 'path';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ // import { checkTestReportToolInstall, installTestReportTool } from './reportTool';
5
+ // import { childProcessSet } from '../exit/childProcessManager';
6
+ // import { exec } from 'child_process';
7
+ // import { runSpawn } from '../utils/spawnExec';
8
+ // export function runCodeCoverageReport2(coverageXmlPath: string): Promise<any> {
9
+ // return new Promise((resolve) => {
10
+ // if (!checkTestReportToolInstall()) {
11
+ // installTestReportTool();
12
+ // }
13
+ // const coverageName = path.basename(coverageXmlPath, ".xml")
14
+ // const coverageReportDir = `CoverageReport-${coverageName}`;
15
+ // const msbuildCommand = `reportgenerator -reports:"${coverageXmlPath}" -targetdir:"${coverageReportDir}" -reporttypes:Html`;
16
+ // const workDir = path.join(__dirname, '../tools');
17
+ // console.log(`Running Code coverage report... \n ${msbuildCommand}`);
18
+ // const startTime = Date.now();
19
+ // const codeCoverageReportProcess = exec(msbuildCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {
20
+ // console.log(`Code coverage report time: ${(Date.now() - startTime) / 1000} seconds`);
21
+ // if (error) {
22
+ // console.error(`Code coverage report failed: ${error.message}`);
23
+ // resolve({ success: false, message: stdout });
24
+ // return;
25
+ // }
26
+ // if (stderr) {
27
+ // console.warn(`Code coverage report Warnings/Errors:\n${stdout}`);
28
+ // resolve({ success: false, message: stdout });
29
+ // return;
30
+ // }
31
+ // console.log(`Code coverage report succeeded`);
32
+ // resolve({ success: true, message: stdout });
33
+ // });
34
+ // childProcessSet.add(codeCoverageReportProcess.pid);
35
+ // });
36
+ // }
37
+ // export function runCodeCoverageReport(coverageXmlPath: string): Promise<boolean> {
38
+ // if (!checkTestReportToolInstall()) {
39
+ // installTestReportTool();
40
+ // }
41
+ // const coverageName = path.basename(coverageXmlPath, ".xml")
42
+ // const coverageReportDir = `CoverageReport-${coverageName}`;
43
+ // const analyzerArgs = ['-reports:"${coverageXmlPath}"', `-targetdir:"${coverageReportDir}"`, '-reporttypes:Html'];
44
+ // const workDir = path.join(__dirname, '../tools');
45
+ // console.log(`Running Code coverage report...`);
46
+ // return runSpawn("ccanalyzer", analyzerArgs, workDir, coverageReportErrorHandler, coverageReportCloseHandler);
47
+ // }
48
+ // export function coverageReportErrorHandler(error) {
49
+ // console.error(`coverageReportErrorHandler - failed: ${error.message}`);
50
+ // return true;
51
+ // }
52
+ // export function coverageReportCloseHandler(code, stdout, stderr) {
53
+ // if (code !== 0) {
54
+ // console.error(`Code coverage report failed with exit code ${code}, stdout: ${stdout}`);
55
+ // return { success: false, message: stdout };
56
+ // }
57
+ // if (stderr) {
58
+ // console.warn(`Code coverage report Warnings/Errors:\n${stdout}`);
59
+ // return { success: false, message: stdout };
60
+ // }
61
+ // console.log(`Code coverage report succeeded`);
62
+ // return { success: true, message: stdout };
63
+ // }
64
+ //# sourceMappingURL=codeCoverageReport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeCoverageReport.js","sourceRoot":"","sources":["../../../src/codebk/oldExec/codeCoverageReport.ts"],"names":[],"mappings":";AAAA,gCAAgC;;AAEhC,oFAAoF;AAEpF,iEAAiE;AACjE,wCAAwC;AACxC,iDAAiD;AAEjD,kFAAkF;AAClF,wCAAwC;AACxC,+CAA+C;AAC/C,uCAAuC;AACvC,YAAY;AACZ,sEAAsE;AACtE,sEAAsE;AACtE,sIAAsI;AAEtI,4DAA4D;AAC5D,+EAA+E;AAC/E,wCAAwC;AACxC,6IAA6I;AAC7I,oGAAoG;AACpG,2BAA2B;AAC3B,kFAAkF;AAClF,gEAAgE;AAChE,0BAA0B;AAC1B,gBAAgB;AAEhB,4BAA4B;AAC5B,oFAAoF;AACpF,gEAAgE;AAChE,0BAA0B;AAC1B,gBAAgB;AAEhB,6DAA6D;AAC7D,2DAA2D;AAC3D,cAAc;AACd,8DAA8D;AAC9D,UAAU;AACV,IAAI;AAEJ,qFAAqF;AACrF,2CAA2C;AAC3C,mCAAmC;AACnC,QAAQ;AACR,kEAAkE;AAClE,kEAAkE;AAClE,wHAAwH;AACxH,wDAAwD;AACxD,sDAAsD;AACtD,oHAAoH;AACpH,IAAI;AAEJ,sDAAsD;AACtD,8EAA8E;AAC9E,mBAAmB;AACnB,IAAI;AAEJ,qEAAqE;AACrE,wBAAwB;AACxB,kGAAkG;AAClG,sDAAsD;AACtD,QAAQ;AAER,oBAAoB;AACpB,4EAA4E;AAC5E,sDAAsD;AACtD,QAAQ;AAER,qDAAqD;AACrD,iDAAiD;AACjD,IAAI","sourcesContent":["// import * as path from 'path';\r\n\r\n// import { checkTestReportToolInstall, installTestReportTool } from './reportTool';\r\n\r\n// import { childProcessSet } from '../exit/childProcessManager';\r\n// import { exec } from 'child_process';\r\n// import { runSpawn } from '../utils/spawnExec';\r\n\r\n// export function runCodeCoverageReport2(coverageXmlPath: string): Promise<any> {\r\n// return new Promise((resolve) => {\r\n// if (!checkTestReportToolInstall()) {\r\n// installTestReportTool();\r\n// }\r\n// const coverageName = path.basename(coverageXmlPath, \".xml\")\r\n// const coverageReportDir = `CoverageReport-${coverageName}`;\r\n// const msbuildCommand = `reportgenerator -reports:\"${coverageXmlPath}\" -targetdir:\"${coverageReportDir}\" -reporttypes:Html`;\r\n\r\n// const workDir = path.join(__dirname, '../tools');\r\n// console.log(`Running Code coverage report... \\n ${msbuildCommand}`);\r\n// const startTime = Date.now();\r\n// const codeCoverageReportProcess = exec(msbuildCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {\r\n// console.log(`Code coverage report time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// if (error) {\r\n// console.error(`Code coverage report failed: ${error.message}`);\r\n// resolve({ success: false, message: stdout });\r\n// return;\r\n// }\r\n\r\n// if (stderr) {\r\n// console.warn(`Code coverage report Warnings/Errors:\\n${stdout}`);\r\n// resolve({ success: false, message: stdout });\r\n// return;\r\n// }\r\n\r\n// console.log(`Code coverage report succeeded`);\r\n// resolve({ success: true, message: stdout });\r\n// });\r\n// childProcessSet.add(codeCoverageReportProcess.pid);\r\n// });\r\n// }\r\n\r\n// export function runCodeCoverageReport(coverageXmlPath: string): Promise<boolean> {\r\n// if (!checkTestReportToolInstall()) {\r\n// installTestReportTool();\r\n// }\r\n// const coverageName = path.basename(coverageXmlPath, \".xml\")\r\n// const coverageReportDir = `CoverageReport-${coverageName}`;\r\n// const analyzerArgs = ['-reports:\"${coverageXmlPath}\"', `-targetdir:\"${coverageReportDir}\"`, '-reporttypes:Html'];\r\n// const workDir = path.join(__dirname, '../tools');\r\n// console.log(`Running Code coverage report...`);\r\n// return runSpawn(\"ccanalyzer\", analyzerArgs, workDir, coverageReportErrorHandler, coverageReportCloseHandler);\r\n// }\r\n\r\n// export function coverageReportErrorHandler(error) {\r\n// console.error(`coverageReportErrorHandler - failed: ${error.message}`);\r\n// return true;\r\n// }\r\n\r\n// export function coverageReportCloseHandler(code, stdout, stderr) {\r\n// if (code !== 0) {\r\n// console.error(`Code coverage report failed with exit code ${code}, stdout: ${stdout}`);\r\n// return { success: false, message: stdout };\r\n// }\r\n\r\n// if (stderr) {\r\n// console.warn(`Code coverage report Warnings/Errors:\\n${stdout}`);\r\n// return { success: false, message: stdout };\r\n// }\r\n\r\n// console.log(`Code coverage report succeeded`);\r\n// return { success: true, message: stdout };\r\n// }\r\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ // import { exec } from 'child_process';
3
+ // import { runSpawn } from '../../utils/spawnExec';
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ // export function containsValidMethods2(codePath: string): Promise<boolean> {
6
+ // return new Promise((resolve) => {
7
+ // const analyzerCmd = `ccanalyzer -m "${codePath}"`;
8
+ // console.log('📦 Running Csharp valid method analyzer...');
9
+ // const startTime = Date.now();
10
+ // exec(analyzerCmd, { maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {
11
+ // console.log(`Csharp valid method analyze time: ${(Date.now() - startTime) / 1000} seconds`);
12
+ // if (error) {
13
+ // console.error(`valid method analyze failed: ${error.message}`);
14
+ // resolve(true); // If the command fails, we assume there are valid methods
15
+ // return;
16
+ // }
17
+ // if (stderr) {
18
+ // console.warn(`Warnings/Errors:\n${stderr}`);
19
+ // resolve(true);
20
+ // return;
21
+ // }
22
+ // console.log(`valid method analyze succeeded:\n${stdout}`);
23
+ // const contains = stdout.includes("true");
24
+ // resolve(contains);
25
+ // });
26
+ // });
27
+ // }
28
+ // export function containsValidMethods(codePath: string): Promise<boolean> {
29
+ // const args = ['-m', codePath];
30
+ // return runSpawn("ccanalyzer", args, ".", containsMethodErrorHandler, containsMethodCloseHandler);
31
+ // }
32
+ // export function containsMethodErrorHandler(error) {
33
+ // console.error(`containsMethodErrorHandler - failed: ${error.message}`);
34
+ // return true;
35
+ // }
36
+ // export function containsMethodCloseHandler(code, stdout, stderr) {
37
+ // if (code !== 0) {
38
+ // console.error(`valid method analyze failed with exit code ${code}, stdout: ${stdout}`);
39
+ // return true; // If the command fails, we assume there are valid methods
40
+ // }
41
+ // if (stderr) {
42
+ // console.warn(`Warnings/Errors:\n${stderr}`);
43
+ // return true;
44
+ // }
45
+ // console.log(`valid method analyze succeeded:\n${stdout}`);
46
+ // const contains = stdout.includes("true");
47
+ // return contains;
48
+ // }
49
+ // async function testMethod() {
50
+ // const testFilePaths = [
51
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantConstants.cs",
52
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantModels.cs",
53
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/Conditions/EplantRequestCategoryCondition.cs",
54
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/Conditions/EplantRequestTypeCondition.cs",
55
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantEdgePart.cs",
56
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantPostBodyContent.cs",
57
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantRank.cs",
58
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantRankRow.cs",
59
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantTreeViewModel.cs",
60
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantViewModel.cs",
61
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/HttpRequestParser/EplantHttpRequestParser.cs",
62
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/RequestBuilders/EplantUserRequestBuilder.cs",
63
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/ResponseBuilders/EplantActionResponseBuilder.cs",
64
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/ResponseBuilders/EplantPlantResponseBuilder.cs",
65
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/ResponseBuilders/EplantTreeUpdateResponseBuilder.cs",
66
+ // "D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/ResponseBuilders/EplantUserUpdateResponseBuilder.cs"
67
+ // ];
68
+ // for (const path of testFilePaths) {
69
+ // const hasNonConstructorFunction = await containsValidMethods(path);
70
+ // console.log(`${path} -> ${hasNonConstructorFunction}`);
71
+ // }
72
+ // }
73
+ // testMethod();
74
+ //# sourceMappingURL=containsMethods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"containsMethods.js","sourceRoot":"","sources":["../../../src/codebk/oldExec/containsMethods.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,oDAAoD;;AAEpD,8EAA8E;AAC9E,wCAAwC;AACxC,6DAA6D;AAC7D,uEAAuE;AACvE,wCAAwC;AACxC,0FAA0F;AAC1F,2GAA2G;AAC3G,2BAA2B;AAC3B,kFAAkF;AAClF,4FAA4F;AAC5F,0BAA0B;AAC1B,gBAAgB;AAEhB,4BAA4B;AAC5B,+DAA+D;AAC/D,iCAAiC;AACjC,0BAA0B;AAC1B,gBAAgB;AAChB,yEAAyE;AACzE,wDAAwD;AAExD,iCAAiC;AACjC,cAAc;AACd,UAAU;AACV,IAAI;AAEJ,6EAA6E;AAC7E,qCAAqC;AACrC,wGAAwG;AACxG,IAAI;AAEJ,sDAAsD;AACtD,8EAA8E;AAC9E,mBAAmB;AACnB,IAAI;AAEJ,qEAAqE;AACrE,wBAAwB;AACxB,kGAAkG;AAClG,kFAAkF;AAClF,QAAQ;AAER,oBAAoB;AACpB,uDAAuD;AACvD,uBAAuB;AACvB,QAAQ;AACR,iEAAiE;AACjE,gDAAgD;AAEhD,uBAAuB;AACvB,IAAI;AAGJ,gCAAgC;AAChC,8BAA8B;AAC9B,qIAAqI;AACrI,kIAAkI;AAClI,+JAA+J;AAC/J,2JAA2J;AAC3J,8IAA8I;AAC9I,qJAAqJ;AACrJ,0IAA0I;AAC1I,6IAA6I;AAC7I,mJAAmJ;AACnJ,+IAA+I;AAC/I,+JAA+J;AAC/J,8JAA8J;AAC9J,kKAAkK;AAClK,iKAAiK;AACjK,sKAAsK;AACtK,qKAAqK;AACrK,SAAS;AAET,0CAA0C;AAC1C,8EAA8E;AAC9E,kEAAkE;AAClE,QAAQ;AACR,IAAI;AAEJ,gBAAgB","sourcesContent":["// import { exec } from 'child_process';\r\n// import { runSpawn } from '../../utils/spawnExec';\r\n\r\n// export function containsValidMethods2(codePath: string): Promise<boolean> {\r\n// return new Promise((resolve) => {\r\n// const analyzerCmd = `ccanalyzer -m \"${codePath}\"`;\r\n// console.log('📦 Running Csharp valid method analyzer...');\r\n// const startTime = Date.now();\r\n// exec(analyzerCmd, { maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {\r\n// console.log(`Csharp valid method analyze time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// if (error) {\r\n// console.error(`valid method analyze failed: ${error.message}`);\r\n// resolve(true); // If the command fails, we assume there are valid methods\r\n// return;\r\n// }\r\n\r\n// if (stderr) {\r\n// console.warn(`Warnings/Errors:\\n${stderr}`);\r\n// resolve(true);\r\n// return;\r\n// }\r\n// console.log(`valid method analyze succeeded:\\n${stdout}`);\r\n// const contains = stdout.includes(\"true\");\r\n\r\n// resolve(contains);\r\n// });\r\n// });\r\n// }\r\n\r\n// export function containsValidMethods(codePath: string): Promise<boolean> {\r\n// const args = ['-m', codePath];\r\n// return runSpawn(\"ccanalyzer\", args, \".\", containsMethodErrorHandler, containsMethodCloseHandler);\r\n// }\r\n\r\n// export function containsMethodErrorHandler(error) {\r\n// console.error(`containsMethodErrorHandler - failed: ${error.message}`);\r\n// return true;\r\n// }\r\n\r\n// export function containsMethodCloseHandler(code, stdout, stderr) {\r\n// if (code !== 0) {\r\n// console.error(`valid method analyze failed with exit code ${code}, stdout: ${stdout}`);\r\n// return true; // If the command fails, we assume there are valid methods\r\n// }\r\n\r\n// if (stderr) {\r\n// console.warn(`Warnings/Errors:\\n${stderr}`);\r\n// return true;\r\n// }\r\n// console.log(`valid method analyze succeeded:\\n${stdout}`);\r\n// const contains = stdout.includes(\"true\");\r\n\r\n// return contains;\r\n// }\r\n\r\n\r\n// async function testMethod() {\r\n// const testFilePaths = [\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantConstants.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantModels.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/Conditions/EplantRequestCategoryCondition.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/Conditions/EplantRequestTypeCondition.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantEdgePart.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantPostBodyContent.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantRank.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantRankRow.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantTreeViewModel.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/DataModel/EplantViewModel.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/HttpRequestParser/EplantHttpRequestParser.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/RequestBuilders/EplantUserRequestBuilder.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/ResponseBuilders/EplantActionResponseBuilder.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/ResponseBuilders/EplantPlantResponseBuilder.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/ResponseBuilders/EplantTreeUpdateResponseBuilder.cs\",\r\n// \"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/ResponseBuilders/EplantUserUpdateResponseBuilder.cs\"\r\n// ];\r\n\r\n// for (const path of testFilePaths) {\r\n// const hasNonConstructorFunction = await containsValidMethods(path);\r\n// console.log(`${path} -> ${hasNonConstructorFunction}`);\r\n// }\r\n// }\r\n\r\n// testMethod();"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ // import * as fs from 'fs';
3
+ // import * as path from 'path';
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ // import { childProcessSet } from '../exit/childProcessManager';
6
+ // import { exec } from 'child_process';
7
+ // import { generateCodeSha256 } from '../utils/generateCodeSha256';
8
+ // const DepAnalyzerDir = "./deps/"
9
+ // export async function generateCodeDependency(sourceCodePath: string): Promise<string> {
10
+ // const startTime = Date.now();
11
+ // const normalizedPath = path.normalize(sourceCodePath);
12
+ // const codeDepsFileName = normalizedPath.replace(".cs", "").replace(":", "").replaceAll(".", "").split("\\").reverse().join("_");
13
+ // const codeDepsDir = getCodeDepsDir();
14
+ // const codeDepsFilePath = path.join(codeDepsDir, codeDepsFileName + ".deps");
15
+ // let depsStr;
16
+ // if (fs.existsSync(codeDepsFilePath)) {
17
+ // depsStr = getCachedCodeDeps(normalizedPath, codeDepsFilePath);
18
+ // }
19
+ // if (!depsStr) {
20
+ // const { success, message } = await runCsharpCodeAnalyzer(normalizedPath);
21
+ // if (!success) {
22
+ // console.error(`❌ Code analysis failed: ${message}`);
23
+ // return "";
24
+ // }
25
+ // depsStr = fs.readFileSync(codeDepsFilePath, 'utf-8')?.trim();
26
+ // }
27
+ // console.log(`Generate depencency time: ${(Date.now() - startTime) / 1000} seconds`);
28
+ // return depsStr;
29
+ // }
30
+ // function getCodeDepsDir() {
31
+ // try {
32
+ // const codeDepsDir = path.join(__dirname, DepAnalyzerDir);
33
+ // const resolvedPath = path.resolve(codeDepsDir);
34
+ // // Check if directory exists
35
+ // if (!fs.existsSync(resolvedPath)) {
36
+ // // Create directory recursively
37
+ // fs.mkdirSync(resolvedPath, { recursive: true });
38
+ // console.log(`Directory created: ${resolvedPath}`);
39
+ // } else {
40
+ // console.log(`Directory already exists: ${resolvedPath}`);
41
+ // }
42
+ // return codeDepsDir;
43
+ // } catch (error) {
44
+ // console.error('Error processing directory:', error);
45
+ // }
46
+ // }
47
+ // function runCsharpCodeAnalyzer(sourceCodePath: string): Promise<any> {
48
+ // return new Promise((resolve) => {
49
+ // const analyzerCmd = `ccanalyzer -c "${sourceCodePath}"`;
50
+ // console.log('📦 Running Csharp code analyzer...');
51
+ // const workDir = path.join(__dirname, DepAnalyzerDir);
52
+ // const startTime = Date.now();
53
+ // const codeAnalyzerProcess = exec(analyzerCmd, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {
54
+ // console.log(`Csharp code analyze time: ${(Date.now() - startTime) / 1000} seconds`);
55
+ // if (error) {
56
+ // console.error(`Analyze failed: ${error.message}`);
57
+ // resolve({ success: false, message: stdout });
58
+ // return;
59
+ // }
60
+ // if (stderr) {
61
+ // console.warn(`Warnings/Errors:\n${stderr}`);
62
+ // resolve({ success: false, message: stdout });
63
+ // return;
64
+ // }
65
+ // console.log(`Analyze succeeded:\n${stdout}`);
66
+ // resolve({ success: true, message: stdout });
67
+ // });
68
+ // childProcessSet.add(codeAnalyzerProcess.pid);
69
+ // });
70
+ // }
71
+ // function getCachedCodeDeps(sourceCodePath: string, depsFilePath: string) {
72
+ // try {
73
+ // const fileContent = fs.readFileSync(depsFilePath, 'utf-8');
74
+ // const lines = fileContent.split(/\r?\n/);
75
+ // const cachedSha256 = lines[0];
76
+ // const depsContent = lines.slice(1).join('\n');
77
+ // const currentSha256 = generateCodeSha256(sourceCodePath);
78
+ // if (currentSha256 === cachedSha256) {
79
+ // console.log('code unchanged, returning cached deps.');
80
+ // return depsContent;
81
+ // } else {
82
+ // console.log('code has changed.');
83
+ // return null;
84
+ // }
85
+ // } catch (err) {
86
+ // console.error('Error:', err);
87
+ // return null;
88
+ // }
89
+ // }
90
+ // // generateCodeDependency("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\Conditions\\EplantRequestCategoryCondition.cs");
91
+ // // generateCodeDependency("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\ResponseBuilders\\EplantMigrateResponseBuilder.cs");
92
+ // // generateCodeDependency("D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantConfigManager.cs");
93
+ // // generateCodeDependency("C:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\ResponseBuilders\\EplantMeResponseBuilder.cs");
94
+ // // generateCodeDependency("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\RequestBuilders\\EplantRankRequestBuilder.cs");
95
+ //# sourceMappingURL=generateCodeDependency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateCodeDependency.js","sourceRoot":"","sources":["../../../src/codebk/oldExec/generateCodeDependency.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,gCAAgC;;AAEhC,iEAAiE;AACjE,wCAAwC;AACxC,oEAAoE;AAEpE,mCAAmC;AAEnC,0FAA0F;AAC1F,oCAAoC;AAEpC,6DAA6D;AAC7D,uIAAuI;AACvI,4CAA4C;AAC5C,mFAAmF;AACnF,mBAAmB;AACnB,6CAA6C;AAC7C,yEAAyE;AACzE,QAAQ;AACR,sBAAsB;AACtB,oFAAoF;AACpF,0BAA0B;AAC1B,mEAAmE;AACnE,yBAAyB;AACzB,YAAY;AACZ,wEAAwE;AACxE,QAAQ;AAER,2FAA2F;AAE3F,sBAAsB;AACtB,IAAI;AAEJ,8BAA8B;AAC9B,YAAY;AACZ,oEAAoE;AACpE,0DAA0D;AAE1D,uCAAuC;AACvC,8CAA8C;AAC9C,8CAA8C;AAC9C,+DAA+D;AAC/D,iEAAiE;AACjE,mBAAmB;AACnB,wEAAwE;AACxE,YAAY;AACZ,8BAA8B;AAC9B,wBAAwB;AACxB,+DAA+D;AAC/D,QAAQ;AACR,IAAI;AAEJ,yEAAyE;AACzE,wCAAwC;AACxC,mEAAmE;AACnE,6DAA6D;AAC7D,gEAAgE;AAChE,wCAAwC;AACxC,oIAAoI;AACpI,mGAAmG;AACnG,2BAA2B;AAC3B,qEAAqE;AACrE,gEAAgE;AAChE,0BAA0B;AAC1B,gBAAgB;AAEhB,4BAA4B;AAC5B,+DAA+D;AAC/D,gEAAgE;AAChE,0BAA0B;AAC1B,gBAAgB;AAEhB,4DAA4D;AAC5D,2DAA2D;AAC3D,cAAc;AACd,wDAAwD;AACxD,UAAU;AACV,IAAI;AAEJ,6EAA6E;AAC7E,YAAY;AACZ,sEAAsE;AAEtE,oDAAoD;AAEpD,yCAAyC;AACzC,yDAAyD;AAEzD,oEAAoE;AAEpE,gDAAgD;AAChD,qEAAqE;AACrE,kCAAkC;AAClC,mBAAmB;AACnB,gDAAgD;AAChD,2BAA2B;AAC3B,YAAY;AACZ,sBAAsB;AACtB,wCAAwC;AACxC,uBAAuB;AACvB,QAAQ;AACR,IAAI;AAEJ,2LAA2L;AAC3L,+LAA+L;AAC/L,4JAA4J;AAC5J,0LAA0L;AAC1L,0LAA0L","sourcesContent":["// import * as fs from 'fs';\r\n// import * as path from 'path';\r\n\r\n// import { childProcessSet } from '../exit/childProcessManager';\r\n// import { exec } from 'child_process';\r\n// import { generateCodeSha256 } from '../utils/generateCodeSha256';\r\n\r\n// const DepAnalyzerDir = \"./deps/\"\r\n\r\n// export async function generateCodeDependency(sourceCodePath: string): Promise<string> {\r\n// const startTime = Date.now();\r\n\r\n// const normalizedPath = path.normalize(sourceCodePath);\r\n// const codeDepsFileName = normalizedPath.replace(\".cs\", \"\").replace(\":\", \"\").replaceAll(\".\", \"\").split(\"\\\\\").reverse().join(\"_\");\r\n// const codeDepsDir = getCodeDepsDir();\r\n// const codeDepsFilePath = path.join(codeDepsDir, codeDepsFileName + \".deps\");\r\n// let depsStr;\r\n// if (fs.existsSync(codeDepsFilePath)) {\r\n// depsStr = getCachedCodeDeps(normalizedPath, codeDepsFilePath);\r\n// }\r\n// if (!depsStr) {\r\n// const { success, message } = await runCsharpCodeAnalyzer(normalizedPath);\r\n// if (!success) {\r\n// console.error(`❌ Code analysis failed: ${message}`);\r\n// return \"\";\r\n// }\r\n// depsStr = fs.readFileSync(codeDepsFilePath, 'utf-8')?.trim();\r\n// }\r\n\r\n// console.log(`Generate depencency time: ${(Date.now() - startTime) / 1000} seconds`);\r\n\r\n// return depsStr;\r\n// }\r\n\r\n// function getCodeDepsDir() {\r\n// try {\r\n// const codeDepsDir = path.join(__dirname, DepAnalyzerDir);\r\n// const resolvedPath = path.resolve(codeDepsDir);\r\n\r\n// // Check if directory exists\r\n// if (!fs.existsSync(resolvedPath)) {\r\n// // Create directory recursively\r\n// fs.mkdirSync(resolvedPath, { recursive: true });\r\n// console.log(`Directory created: ${resolvedPath}`);\r\n// } else {\r\n// console.log(`Directory already exists: ${resolvedPath}`);\r\n// }\r\n// return codeDepsDir;\r\n// } catch (error) {\r\n// console.error('Error processing directory:', error);\r\n// }\r\n// }\r\n\r\n// function runCsharpCodeAnalyzer(sourceCodePath: string): Promise<any> {\r\n// return new Promise((resolve) => {\r\n// const analyzerCmd = `ccanalyzer -c \"${sourceCodePath}\"`;\r\n// console.log('📦 Running Csharp code analyzer...');\r\n// const workDir = path.join(__dirname, DepAnalyzerDir);\r\n// const startTime = Date.now();\r\n// const codeAnalyzerProcess = exec(analyzerCmd, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {\r\n// console.log(`Csharp code analyze time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// if (error) {\r\n// console.error(`Analyze failed: ${error.message}`);\r\n// resolve({ success: false, message: stdout });\r\n// return;\r\n// }\r\n\r\n// if (stderr) {\r\n// console.warn(`Warnings/Errors:\\n${stderr}`);\r\n// resolve({ success: false, message: stdout });\r\n// return;\r\n// }\r\n\r\n// console.log(`Analyze succeeded:\\n${stdout}`);\r\n// resolve({ success: true, message: stdout });\r\n// });\r\n// childProcessSet.add(codeAnalyzerProcess.pid);\r\n// });\r\n// }\r\n\r\n// function getCachedCodeDeps(sourceCodePath: string, depsFilePath: string) {\r\n// try {\r\n// const fileContent = fs.readFileSync(depsFilePath, 'utf-8');\r\n\r\n// const lines = fileContent.split(/\\r?\\n/);\r\n\r\n// const cachedSha256 = lines[0];\r\n// const depsContent = lines.slice(1).join('\\n');\r\n\r\n// const currentSha256 = generateCodeSha256(sourceCodePath);\r\n\r\n// if (currentSha256 === cachedSha256) {\r\n// console.log('code unchanged, returning cached deps.');\r\n// return depsContent;\r\n// } else {\r\n// console.log('code has changed.');\r\n// return null;\r\n// }\r\n// } catch (err) {\r\n// console.error('Error:', err);\r\n// return null;\r\n// }\r\n// }\r\n\r\n// // generateCodeDependency(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\Conditions\\\\EplantRequestCategoryCondition.cs\");\r\n// // generateCodeDependency(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\ResponseBuilders\\\\EplantMigrateResponseBuilder.cs\");\r\n// // generateCodeDependency(\"D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantConfigManager.cs\");\r\n// // generateCodeDependency(\"C:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\ResponseBuilders\\\\EplantMeResponseBuilder.cs\");\r\n// // generateCodeDependency(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\RequestBuilders\\\\EplantRankRequestBuilder.cs\");\r\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ // import * as path from 'path';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ // import { exec, spawn } from 'child_process';
5
+ // import { formatMsbuildResultToMarkdown, parseMsbuildErrors } from '../utils/parseBuildResult';
6
+ // import { childProcessSet } from '../exit/childProcessManager';
7
+ // import { msBuildPath } from './vsTools';
8
+ // // import { vsDevCmdPath } from './vsTools';
9
+ // export function runMsBuild(projectPath: string): Promise<any> {
10
+ // return new Promise((resolve) => {
11
+ // // in vsdevcmd env, MSBuild.exe is available
12
+ // const msbuildCommand = `"${msBuildPath}" "${projectPath}" /t:Build /m /nr:true /v:minimal`; // /p:Configuration=debug`;
13
+ // // const msbuildCommand = `"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe" "${projectPath}" /t:Build /m /nr:true /v:minimal`; // /p:Configuration=debug`;
14
+ // // const fullCommand = `cmd /c "call "${vsDevCmdPath}" && ${msbuildCommand}"`;
15
+ // const workDir = path.join(__dirname, '../tools');
16
+ // console.log(`📦 Running MSBuild... \n ${msbuildCommand}`);
17
+ // const startTime = Date.now();
18
+ // const buildProcess = exec(msbuildCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {
19
+ // console.log(`Build time: ${(Date.now() - startTime) / 1000} seconds`);
20
+ // if (error) {
21
+ // console.error(`❌ Build failed: ${error.message}`);
22
+ // const buildErrors = parseMsbuildErrors(stdout);
23
+ // const formattedBuildErrors = formatMsbuildResultToMarkdown(buildErrors);
24
+ // resolve({ success: false, message: formattedBuildErrors, buildErrors: buildErrors });
25
+ // return;
26
+ // }
27
+ // if (stderr) {
28
+ // console.warn(`⚠️ Warnings/Errors:\n${stdout}`);
29
+ // resolve({ success: false, message: stdout, buildErrors: null });
30
+ // return;
31
+ // }
32
+ // console.log(`✅ Build succeeded`);
33
+ // resolve({ success: true, message: stdout, buildErrors: null });
34
+ // });
35
+ // childProcessSet.add(buildProcess.pid);
36
+ // });
37
+ // }
38
+ // // setupSignalHandlers();
39
+ // // runMsBuild('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
40
+ // // runMsBuild3('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
41
+ // // devenv "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
42
+ // // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
43
+ // // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
44
+ // // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /build Debug // incremental compile
45
+ // // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal
46
+ // // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal
47
+ // // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal /nr:true
48
+ // // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /project "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug
49
+ // // devenvexe.cmd "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /build Debug /project "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj"
50
+ // // devenvcom.cmd "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /build Debug /project "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj"
51
+ // // msbuildexe.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /m /nr:true /v:minimal
52
+ // // runMsBuild('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
53
+ //# sourceMappingURL=msBuild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"msBuild.js","sourceRoot":"","sources":["../../../src/codebk/oldExec/msBuild.ts"],"names":[],"mappings":";AAAA,gCAAgC;;AAEhC,+CAA+C;AAC/C,iGAAiG;AAEjG,iEAAiE;AACjE,2CAA2C;AAE3C,+CAA+C;AAE/C,kEAAkE;AAClE,qCAAqC;AACrC,iDAAiD;AACjD,4HAA4H;AAC5H,wNAAwN;AAExN,mFAAmF;AAEnF,4DAA4D;AAC5D,+DAA+D;AAC/D,wCAAwC;AACxC,0HAA0H;AAC1H,qFAAqF;AACrF,kBAAkB;AAClB,yDAAyD;AACzD,kEAAkE;AAClE,2FAA2F;AAC3F,4FAA4F;AAC5F,cAAc;AACd,OAAO;AAEP,mBAAmB;AACnB,sDAAsD;AACtD,uEAAuE;AACvE,cAAc;AACd,OAAO;AAEP,uCAAuC;AACvC,sEAAsE;AACtE,QAAQ;AACR,iDAAiD;AACjD,OAAO;AACP,IAAI;AAEJ,4BAA4B;AAC5B,wIAAwI;AACxI,yIAAyI;AAEzI,kKAAkK;AAClK,sKAAsK;AACtK,sKAAsK;AACtK,yHAAyH;AACzH,2KAA2K;AAC3K,2KAA2K;AAC3K,oLAAoL;AAEpL,yNAAyN;AAEzN,4NAA4N;AAC5N,4NAA4N;AAE5N,4KAA4K;AAC5K,wIAAwI","sourcesContent":["// import * as path from 'path';\r\n\r\n// import { exec, spawn } from 'child_process';\r\n// import { formatMsbuildResultToMarkdown, parseMsbuildErrors } from '../utils/parseBuildResult';\r\n\r\n// import { childProcessSet } from '../exit/childProcessManager';\r\n// import { msBuildPath } from './vsTools';\r\n\r\n// // import { vsDevCmdPath } from './vsTools';\r\n\r\n// export function runMsBuild(projectPath: string): Promise<any> {\r\n// \treturn new Promise((resolve) => {\r\n// \t\t// in vsdevcmd env, MSBuild.exe is available\r\n// \t\tconst msbuildCommand = `\"${msBuildPath}\" \"${projectPath}\" /t:Build /m /nr:true /v:minimal`; // /p:Configuration=debug`;\r\n// \t\t// const msbuildCommand = `\"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\MSBuild\\\\Current\\\\Bin\\\\amd64\\\\MSBuild.exe\" \"${projectPath}\" /t:Build /m /nr:true /v:minimal`; // /p:Configuration=debug`;\r\n\r\n// \t\t// const fullCommand = `cmd /c \"call \"${vsDevCmdPath}\" && ${msbuildCommand}\"`;\r\n\r\n// const workDir = path.join(__dirname, '../tools');\r\n// \t\tconsole.log(`📦 Running MSBuild... \\n ${msbuildCommand}`);\r\n// const startTime = Date.now();\r\n// \t\tconst buildProcess = exec(msbuildCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {\r\n// console.log(`Build time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// \t\t\tif (error) {\r\n// \t\t\t\tconsole.error(`❌ Build failed: ${error.message}`);\r\n// const buildErrors = parseMsbuildErrors(stdout);\r\n// const formattedBuildErrors = formatMsbuildResultToMarkdown(buildErrors);\r\n// \t\t\t\tresolve({ success: false, message: formattedBuildErrors, buildErrors: buildErrors });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n\r\n// \t\t\tif (stderr) {\r\n// \t\t\t\tconsole.warn(`⚠️ Warnings/Errors:\\n${stdout}`);\r\n// \t\t\t\tresolve({ success: false, message: stdout, buildErrors: null });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n\r\n// \t\t\tconsole.log(`✅ Build succeeded`);\r\n// \t\t\tresolve({ success: true, message: stdout, buildErrors: null });\r\n// \t\t});\r\n// childProcessSet.add(buildProcess.pid);\r\n// \t});\r\n// }\r\n\r\n// // setupSignalHandlers();\r\n// // runMsBuild('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');\r\n// // runMsBuild3('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');\r\n\r\n// // devenv \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// // devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// // devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// // devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug // incremental compile\r\n// // msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal\r\n// // msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal\r\n// // msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal /nr:true\r\n\r\n// // devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug\r\n\r\n// // devenvexe.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\"\r\n// // devenvcom.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\"\r\n\r\n// // msbuildexe.cmd \\\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj\\\" /t:Build /m /nr:true /v:minimal\r\n// // runMsBuild('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // import * as path from 'path';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ // import { formatVSTestResultToMarkdown, parseVSTestOutput } from '../utils/parseVstestResult';
5
+ // import { childProcessSet } from '../exit/childProcessManager';
6
+ // import { exec } from 'child_process';
7
+ // import { setupSignalHandlers } from '../exit/setupProcessSignalHandler';
8
+ // import { vstestPath } from './vsTools';
9
+ // // const vstestPath = `"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe"`;
10
+ // export async function runSingleTestMethod(testDll: string, testMethod: string) {
11
+ // // const cmd = `vstestexe.cmd "${testDll}" /Tests:${testMethod}`;
12
+ // const cmd = `"${vstestPath}" "${testDll}" /Tests:${testMethod}`;
13
+ // return await execCommand(cmd);
14
+ // }
15
+ // export async function runTestClass(testDll: string, className: string) {
16
+ // // const cmd = `vstestexe.cmd "${testDll}" /TestCaseFilter:"FullyQualifiedName~${className}"`;
17
+ // const cmd = `"${vstestPath}" "${testDll}" /TestCaseFilter:"FullyQualifiedName~${className}"`;
18
+ // return await execCommand(cmd);
19
+ // }
20
+ // // export function runTestFile(testDll: string, fullyQualifiedNames: string[]) {
21
+ // // const testsArg = fullyQualifiedNames.map(name => `/Tests:${name}`).join(' ');
22
+ // // const cmd = `vstest.console.exe "${testDll}" ${testsArg}`;
23
+ // // execCommand(cmd);
24
+ // // }
25
+ // function execCommand(cmd: string): Promise<any> {
26
+ // return new Promise((resolve) => {
27
+ // // const fullCommand = `cmd /c "call "${vsDevCmdPath}" && ${cmd}"`;
28
+ // console.log(`▶ Running vstest:\n${cmd}\n`);
29
+ // const workDir = path.join(__dirname, '../tools/');
30
+ // const startTime = Date.now();
31
+ // const testProcess = exec(cmd, { cwd: workDir, maxBuffer: 1024 * 1024 * 10 }, (error, stdout, stderr) => {
32
+ // console.log(`VSTest time: ${(Date.now() - startTime) / 1000} seconds`);
33
+ // if (error) {
34
+ // console.error(`❌ Error: ${stdout}`);
35
+ // const vsTestResult = parseVSTestOutput(stdout);
36
+ // const formatedVSTestResult = formatVSTestResultToMarkdown(vsTestResult);
37
+ // resolve({ success: false, message: formatedVSTestResult, vsTestResult: vsTestResult });
38
+ // return;
39
+ // }
40
+ // if (stderr) {
41
+ // console.error(`⚠️ STDERR:\n${stdout}`);
42
+ // resolve({ success: false, message: stdout, vsTestResult: null });
43
+ // return;
44
+ // }
45
+ // console.log(`✅ vstest succeeded`);
46
+ // resolve({ success: true, message: stdout, vsTestResult: null });
47
+ // });
48
+ // childProcessSet.add(testProcess.pid);
49
+ // });
50
+ // }
51
+ // // runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests');
52
+ // // FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest
53
+ // // setupSignalHandlers();
54
+ // // runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest').then(result => {
55
+ // // console.log('Test Class Result:', result.success, result.message);
56
+ // // });
57
+ // // runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests.ResponseParserTests');
58
+ // // vstest.console.exe "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /TestCaseFilter:"FullyQualifiedName~${className}"
59
+ // // vstest.console.exe "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /Tests:SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId
60
+ // // ./vstest.console.exe "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /Tests:SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId
61
+ // // .\vstestexe.cmd "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /Tests:SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId
62
+ // //.\vstestexe.cmd "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /TestCaseFilter:"FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.SqmidHelperTests"
63
+ // // runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests').then(result => {
64
+ // // console.log('Test Class Result:', result.success, result.message);
65
+ // // });
66
+ // // runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_MissingUsrLocCookie_ReturnsEmptyString')
67
+ // // runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_InvalidBase64Bid_ReturnsEmptyString');
68
+ // // runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Plugins.Tests.Workflows.Eplant.Conditions.EplantRequestCategoryConditionTests').then(result => {
69
+ // // console.log('Test Class Result:', result.success, result.message);
70
+ // // });
71
+ //# sourceMappingURL=vsTest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vsTest.js","sourceRoot":"","sources":["../../../src/codebk/oldExec/vsTest.ts"],"names":[],"mappings":";AAAA,gCAAgC;;AAEhC,gGAAgG;AAEhG,iEAAiE;AACjE,wCAAwC;AACxC,2EAA2E;AAC3E,0CAA0C;AAE1C,qJAAqJ;AAErJ,mFAAmF;AACnF,qEAAqE;AACrE,oEAAoE;AACpE,kCAAkC;AAClC,IAAI;AAEJ,2EAA2E;AAC3E,kGAAkG;AAClG,iGAAiG;AACjG,kCAAkC;AAClC,IAAI;AAEJ,mFAAmF;AACnF,oFAAoF;AACpF,iEAAiE;AACjE,wBAAwB;AACxB,OAAO;AAEP,oDAAoD;AACpD,qCAAqC;AACrC,wEAAwE;AACxE,gDAAgD;AAChD,uDAAuD;AACvD,kCAAkC;AAClC,8GAA8G;AAC9G,6EAA6E;AAC7E,kBAAkB;AAClB,2CAA2C;AAC3C,sDAAsD;AACtD,+EAA+E;AAC/E,8FAA8F;AAC9F,cAAc;AACd,OAAO;AACP,mBAAmB;AACnB,8CAA8C;AAC9C,wEAAwE;AACxE,cAAc;AACd,OAAO;AAEP,wCAAwC;AACxC,sEAAsE;AACtE,QAAQ;AACR,0CAA0C;AAC1C,OAAO;AACP,IAAI;AAEJ,sNAAsN;AACtN,wFAAwF;AACxF,4BAA4B;AAC5B,sOAAsO;AACtO,yEAAyE;AACzE,SAAS;AACT,iPAAiP;AAEjP,yMAAyM;AACzM,mOAAmO;AACnO,yQAAyQ;AACzQ,oQAAoQ;AACpQ,8OAA8O;AAE9O,2NAA2N;AAC3N,yEAAyE;AACzE,SAAS;AACT,2QAA2Q;AAC3Q,yQAAyQ;AACzQ,mQAAmQ;AACnQ,yEAAyE;AACzE,SAAS","sourcesContent":["// import * as path from 'path';\r\n\r\n// import { formatVSTestResultToMarkdown, parseVSTestOutput } from '../utils/parseVstestResult';\r\n\r\n// import { childProcessSet } from '../exit/childProcessManager';\r\n// import { exec } from 'child_process';\r\n// import { setupSignalHandlers } from '../exit/setupProcessSignalHandler';\r\n// import { vstestPath } from './vsTools';\r\n\r\n// // const vstestPath = `\"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community\\\\Common7\\\\IDE\\\\Extensions\\\\TestPlatform\\\\vstest.console.exe\"`;\r\n\r\n// export async function runSingleTestMethod(testDll: string, testMethod: string) {\r\n// \t// const cmd = `vstestexe.cmd \"${testDll}\" /Tests:${testMethod}`;\r\n// \tconst cmd = `\"${vstestPath}\" \"${testDll}\" /Tests:${testMethod}`;\r\n// \treturn await execCommand(cmd);\r\n// }\r\n\r\n// export async function runTestClass(testDll: string, className: string) {\r\n// \t// const cmd = `vstestexe.cmd \"${testDll}\" /TestCaseFilter:\"FullyQualifiedName~${className}\"`;\r\n// \tconst cmd = `\"${vstestPath}\" \"${testDll}\" /TestCaseFilter:\"FullyQualifiedName~${className}\"`;\r\n// \treturn await execCommand(cmd);\r\n// }\r\n\r\n// // export function runTestFile(testDll: string, fullyQualifiedNames: string[]) {\r\n// // \tconst testsArg = fullyQualifiedNames.map(name => `/Tests:${name}`).join(' ');\r\n// // \tconst cmd = `vstest.console.exe \"${testDll}\" ${testsArg}`;\r\n// // \texecCommand(cmd);\r\n// // }\r\n\r\n// function execCommand(cmd: string): Promise<any> {\r\n// \treturn new Promise((resolve) => {\r\n// \t\t// const fullCommand = `cmd /c \"call \"${vsDevCmdPath}\" && ${cmd}\"`;\r\n// \t\tconsole.log(`▶ Running vstest:\\n${cmd}\\n`);\r\n// \t\tconst workDir = path.join(__dirname, '../tools/');\r\n// \t\tconst startTime = Date.now();\r\n// \t\tconst testProcess = exec(cmd, { cwd: workDir, maxBuffer: 1024 * 1024 * 10 }, (error, stdout, stderr) => {\r\n// \t\t\tconsole.log(`VSTest time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// \t\t\tif (error) {\r\n// \t\t\t\tconsole.error(`❌ Error: ${stdout}`);\r\n// \t\t\t\tconst vsTestResult = parseVSTestOutput(stdout);\r\n// \t\t\t\tconst formatedVSTestResult = formatVSTestResultToMarkdown(vsTestResult);\r\n// \t\t\t\tresolve({ success: false, message: formatedVSTestResult, vsTestResult: vsTestResult });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n// \t\t\tif (stderr) {\r\n// \t\t\t\tconsole.error(`⚠️ STDERR:\\n${stdout}`);\r\n// \t\t\t\tresolve({ success: false, message: stdout, vsTestResult: null });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n\t\t\t\r\n// \t\t\tconsole.log(`✅ vstest succeeded`);\r\n// \t\t\tresolve({ success: true, message: stdout, vsTestResult: null });\r\n// \t\t});\r\n// \t\tchildProcessSet.add(testProcess.pid);\r\n// \t});\r\n// }\r\n\r\n// // runTestClass('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests');\r\n// // FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest\r\n// // setupSignalHandlers();\r\n// // runTestClass('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest').then(result => {\r\n// // \tconsole.log('Test Class Result:', result.success, result.message);\r\n// // });\r\n// // runSingleTestMethod('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests.ResponseParserTests');\r\n\r\n// // vstest.console.exe \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /TestCaseFilter:\"FullyQualifiedName~${className}\"\r\n// // vstest.console.exe \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /Tests:SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId\r\n// // ./vstest.console.exe \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /Tests:SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId\r\n// // .\\vstestexe.cmd \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /Tests:SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId\r\n// //.\\vstestexe.cmd \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /TestCaseFilter:\"FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.SqmidHelperTests\"\r\n\r\n// // runTestClass('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests').then(result => {\r\n// // \tconsole.log('Test Class Result:', result.success, result.message);\r\n// // });\r\n// // runSingleTestMethod('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_MissingUsrLocCookie_ReturnsEmptyString')\r\n// // runSingleTestMethod('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_InvalidBase64Bid_ReturnsEmptyString');\r\n// // runTestClass('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Plugins.Tests.Workflows.Eplant.Conditions.EplantRequestCategoryConditionTests').then(result => {\r\n// // \tconsole.log('Test Class Result:', result.success, result.message);\r\n// // });"]}
@@ -0,0 +1,56 @@
1
+ # General Unit Test Guidelines (For All C# Code)
2
+ - Use MSTest framework for all test code.
3
+ - The test code MUST NOT contain any comments or explanations.
4
+ - Ensure the test code MUST has no syntax errors.
5
+ - DO NOT mock any functions, classes, or values that appear in source code.
6
+ - Mock all dependent methods, classes, and values not included in the user input using the Moq library.
7
+ - Test public methods of class in source code only.
8
+ - **MUST NOT** access private members (fields or methods) of the source class in test code.
9
+ - MUST follow the namespace Import Rules (CRITICAL)
10
+ - Test code MUST include a namespace declaration.
11
+ - Place all `using` statements above the namespace declaration.
12
+ - Must import source code namespace in the test code.
13
+ - Must import all required .Net namespaces if any .Net class or interface are used in the test code.
14
+ - For **every .NET class, interface, attribute, or type** used in the test code:
15
+ - The test code MUST include the correct `using` statement at the top of the file to import the corresponding namespace.
16
+ - This includes (but is not limited to):
17
+ - .NET built-in types (e.g., `List<T>`, `IEnumerable<T>`, `Task`, `Assert`, `Moq.Mock`, etc.).
18
+ - Any attribute classes (e.g., `[TestMethod]`, `[TestClass]`, etc.).
19
+ - Any LINQ or threading related classes (e.g., `System.Linq`, `System.Threading.Tasks`).
20
+ - DO NOT assume that any namespace is implicitly available.
21
+ - The test code MUST compile successfully **without manually adding missing using directives**.
22
+ - Test method names must follow the pattern: [MethodName]_[Scenario]_[ExpectedResult].
23
+ - Return the test code in the format: ```C#\n<Test code>\n```.
24
+ - Ensure the test code MUST be able to compile by Visual Studio's MSBuild and pass the test with Visual Studio's vstest.
25
+ - MUST follow Type Safety Rules (VERY IMPORTANT)
26
+ - MUST not assign null to var type value, like: var request = null, it's forbidden,
27
+ - All assignments and method arguments in test code MUST strictly match the declared types in the source code.
28
+ - DO NOT assign values with incompatible types. DO NOT rely on implicit or accidental type conversion.
29
+ - Generic type names and type parameters MUST match exactly.
30
+ - If a parameter type is `IEnumerable<SampleObject>`, you MUST pass an `IEnumerable<SampleObject>`, not a single object or a different collection type.
31
+ - If type conversion is needed (e.g., from `List<T>` to `IEnumerable<T>`), you MUST explicitly convert (e.g., `.AsEnumerable()`, `.ToList()`).
32
+ Example of correct conversion: IEnumerable<ObjectStoreResponse_2> osResponses = osResponseList.AsEnumerable();
33
+ - Before generating the unit test cases, **MUST** analyze the provided code and verify its logic by following these steps:
34
+ 1. Describe the functionality of each public method, including its inputs, outputs, and key logic.
35
+ 2. Identify all possible execution paths for public methods, including normal cases, edge cases, and error conditions.
36
+ 3. Explain any conditional branches, loops, or exception handling for public methods in the code.
37
+ 4. Based on this analysis, generate unit test cases that cover all identified execution paths, ensuring that mock data and assertions align with the code's logic.
38
+ - MUST follow the Logic Coverage and Assertion Rules to write valid and meaningful test cases:
39
+ - The unit tests **MUST include at least one dedicated test case** for each significant logical path and branch.
40
+ - For each conditional branch, the input data in the test **MUST be crafted** so that:
41
+ - The input triggers that specific branch path.
42
+ - The expected `Assert` exactly matches the runtime behavior resulting from that path.
43
+ - Example for early-return failure branches:
44
+ - If source code has a check like `if (muidUser == null) return new PluginResult(false);`, then:
45
+ - **MUST** include a test case where input data causes `muidUser` to be `null`, and:
46
+ - The corresponding `Assert` must validate that the returned result indicates failure (`Assert.IsFalse(result.Success)` in MSTest).
47
+ - The test input data and mocks **MUST accurately satisfy the condition** required for each logic path.
48
+ - For example:
49
+ - If code returns failure when a list is empty, **test must pass an empty list** to trigger that failure.
50
+ - If code requires a specific OwnerId match, **input data must set that value**.
51
+ - **MUST NOT** assume all paths result in success.
52
+ - Test case Asserts **MUST reflect the actual code behavior**, not default to IsTrue/IsNotNull.
53
+ - If unable to infer expected behavior for a branch, **prioritize strict condition-to-assert consistency over guessing**.
54
+ - **Fail the generation** if logic paths exist but the tests do not cover them.
55
+ - MUST cover these scenarios: Main logic paths (e.g., happy path, edge cases), Exception handling if applicable and Boundary conditions (e.g., zero, negative, or null inputs).
56
+
@@ -0,0 +1,21 @@
1
+ {%- if isXapTest -%}
2
+ {%- assign xapSuffix = " that is using the XAP framework" -%}
3
+ {%- else -%}
4
+ {%- assign xapSuffix = "" -%}
5
+ {%- endif -%}
6
+
7
+ You are a **highly skilled software engineer specializing in C# unit testing** and tasked with writing **unit tests** for the user-provided C# source code{{xapSuffix}}. Strictly obey the following guidelines.
8
+
9
+ Following Guidelines Application Logic:
10
+ - When the source code is NOT a XAP class:
11
+ - Apply ONLY the General Unit Test Guidelines.
12
+ - Completely IGNORE all XAP Unit Test Guidelines.
13
+ - When the source code IS a XAP class:
14
+ - Apply BOTH General and XAP Unit Test Guidelines.
15
+ - XAP Unit Test Guidelines priority is hignest.
16
+
17
+ You MUST NOT skip or ignore any applicable Guidelines from any section.
18
+
19
+ {% include 'xap/xapGuideline' %}
20
+
21
+ {% include 'general/generalUnitTestGuidelines' %}
@@ -0,0 +1,29 @@
1
+ {%- if isXapTest -%}
2
+ {%- assign xapSuffix = " with the XAP framework" -%}
3
+ {%- else -%}
4
+ {%- assign xapSuffix = "" -%}
5
+ {%- endif -%}
6
+
7
+ You are a highly skilled software engineer specializing in C# unit testing{{xapSuffix}}. Write unit tests for user-provided C# code, must obey the following guidelines:
8
+ ### Unit Test Guidelines
9
+ - Use MSTest framework for all test code.
10
+ - MUST NOT add any comments or explanations in the test code.
11
+ - Ensure the test code has no syntax errors.
12
+ - DO NOT mock the functions, classes and values in souce code.
13
+ - Mock all dependencies not included in the source code using Moq.
14
+ - Mock all the dependent methods, values and classes that are not included in user input.
15
+ - Must not access private members (fields or methods) of the source class in test code, use public methods only.
16
+ - Must include a namespace in the test code, and put using statement above namespace.
17
+ - Must import source code namespace in the test code.
18
+ - Must import required .Net namespaces if using .Net class or interface in the test code.
19
+ - Test method names must follow the pattern: [MethodName]_[Scenario]_[ExpectedResult].
20
+ - Return the test code in the format: ```C#\n<Test code>\n```.
21
+ - Write valid test cases that cover:
22
+ - Main logic paths (e.g., happy path, edge cases).
23
+ - Exception handling if applicable.
24
+ - Boundary conditions (e.g., zero, negative, or null inputs).
25
+ - Ensure the generated test code can pass the test of vstest of visual studio.
26
+
27
+ {% if isXapTest %}
28
+ {%- include 'xap/xapGuideline' -%}
29
+ {%- endif -%}