@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,4037 @@
1
+ 1c5ded8f87076b61c34d140f14727e1b3c711a455cf7cd7587bdd92caf60b28a
2
+
3
+ #### Xunit.Assert
4
+ ```C#
5
+ using System;
6
+ using System.Collections;
7
+ using System.Collections.Concurrent;
8
+ using System.Collections.Generic;
9
+ using System.Collections.Immutable;
10
+ using System.Collections.ObjectModel;
11
+ using System.ComponentModel;
12
+ using System.Diagnostics;
13
+ using System.Diagnostics.CodeAnalysis;
14
+ using System.Globalization;
15
+ using System.Linq;
16
+ using System.Reflection;
17
+ using System.Runtime.CompilerServices;
18
+ using System.Runtime.ExceptionServices;
19
+ using System.Runtime.InteropServices;
20
+ using System.Text.RegularExpressions;
21
+ using System.Threading.Tasks;
22
+ using Xunit.Internal;
23
+ using Xunit.Sdk;
24
+ namespace Xunit;
25
+ public class Assert
26
+ {
27
+ public class RaisedEvent<T>
28
+ {
29
+ public object? Sender
30
+ {
31
+ [CompilerGenerated]
32
+ get;
33
+ }
34
+ public T Arguments
35
+ {
36
+ [CompilerGenerated]
37
+ get;
38
+ }
39
+ public RaisedEvent(T args)
40
+ : this((object?)null, args)
41
+ {
42
+ }
43
+ public RaisedEvent(object? sender, T args)
44
+ {
45
+ Sender = sender;
46
+ Arguments = args;
47
+ }
48
+ }
49
+ [CompilerGenerated]
50
+ private sealed class <>c__DisplayClass133_0
51
+ {
52
+ public bool result;
53
+ internal void <RaisesAsyncInternal>b__0()
54
+ {
55
+ result = true;
56
+ }
57
+ }
58
+ [CompilerGenerated]
59
+ private sealed class <>c__DisplayClass134_0
60
+ {
61
+ public RaisedEvent<EventArgs> raisedEvent;
62
+ }
63
+ [CompilerGenerated]
64
+ private sealed class <>c__DisplayClass135_0<T> where T : notnull
65
+ {
66
+ public RaisedEvent<T> raisedEvent;
67
+ internal void <RaisesAsyncInternal>b__0(T args)
68
+ {
69
+ raisedEvent = new RaisedEvent<T>(args);
70
+ }
71
+ }
72
+ [CompilerGenerated]
73
+ private sealed class <>c__DisplayClass136_0<T> where T : notnull
74
+ {
75
+ public RaisedEvent<T> raisedEvent;
76
+ }
77
+ [CompilerGenerated]
78
+ private sealed class <>c__DisplayClass179_0
79
+ {
80
+ public bool propertyChangeHappened;
81
+ public string propertyName;
82
+ internal void <PropertyChangedAsync>b__0(object? sender, PropertyChangedEventArgs args)
83
+ {
84
+ propertyChangeHappened = propertyChangeHappened || string.IsNullOrEmpty(args.PropertyName) || propertyName.Equals(args.PropertyName, (StringComparison)5);
85
+ }
86
+ }
87
+ [CompilerGenerated]
88
+ private sealed class <>c__DisplayClass44_0<T> where T : notnull
89
+ {
90
+ [StructLayout((LayoutKind)3)]
91
+ private struct <<AllAsync>b__0>d : IAsyncStateMachine
92
+ {
93
+ public int <>1__state;
94
+ public AsyncTaskMethodBuilder <>t__builder;
95
+ public <>c__DisplayClass44_0<T> <>4__this;
96
+ public T item;
97
+ private TaskAwaiter <>u__1;
98
+ private void MoveNext()
99
+ {
100
+ int num = <>1__state;
101
+ <>c__DisplayClass44_0<T> <>c__DisplayClass44_ = <>4__this;
102
+ try
103
+ {
104
+ TaskAwaiter val;
105
+ if (num != 0)
106
+ {
107
+ val = <>c__DisplayClass44_.action.Invoke(item).GetAwaiter();
108
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
109
+ {
110
+ num = (<>1__state = 0);
111
+ <>u__1 = val;
112
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <<AllAsync>b__0>d>(ref val, ref this);
113
+ return;
114
+ }
115
+ }
116
+ else
117
+ {
118
+ val = <>u__1;
119
+ <>u__1 = default(TaskAwaiter);
120
+ num = (<>1__state = -1);
121
+ }
122
+ ((TaskAwaiter)(ref val)).GetResult();
123
+ }
124
+ catch (System.Exception exception)
125
+ {
126
+ <>1__state = -2;
127
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
128
+ return;
129
+ }
130
+ <>1__state = -2;
131
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
132
+ }
133
+ [DebuggerHidden]
134
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
135
+ {
136
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
137
+ }
138
+ }
139
+ public Func<T, System.Threading.Tasks.Task> action;
140
+ [AsyncStateMachine(typeof(<>c__DisplayClass44_0<>.<<AllAsync>b__0>d))]
141
+ internal System.Threading.Tasks.Task <AllAsync>b__0(T item, int index)
142
+ {
143
+ <<AllAsync>b__0>d <<AllAsync>b__0>d = default(<<AllAsync>b__0>d);
144
+ <<AllAsync>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create();
145
+ <<AllAsync>b__0>d.<>4__this = this;
146
+ <<AllAsync>b__0>d.item = item;
147
+ <<AllAsync>b__0>d.<>1__state = -1;
148
+ ((AsyncTaskMethodBuilder)(ref <<AllAsync>b__0>d.<>t__builder)).Start<<<AllAsync>b__0>d>(ref <<AllAsync>b__0>d);
149
+ return ((AsyncTaskMethodBuilder)(ref <<AllAsync>b__0>d.<>t__builder)).Task;
150
+ }
151
+ }
152
+ [StructLayout((LayoutKind)3)]
153
+ [CompilerGenerated]
154
+ private struct <AllAsync>d__44<T> : IAsyncStateMachine where T : notnull
155
+ {
156
+ public int <>1__state;
157
+ public AsyncTaskMethodBuilder <>t__builder;
158
+ public Func<T, System.Threading.Tasks.Task> action;
159
+ public System.Collections.Generic.IEnumerable<T> collection;
160
+ private TaskAwaiter <>u__1;
161
+ private void MoveNext()
162
+ {
163
+ int num = <>1__state;
164
+ try
165
+ {
166
+ TaskAwaiter val;
167
+ if (num != 0)
168
+ {
169
+ <>c__DisplayClass44_0<T> CS$<>8__locals2 = new <>c__DisplayClass44_0<T>
170
+ {
171
+ action = action
172
+ };
173
+ GuardArgumentNotNull("collection", collection);
174
+ GuardArgumentNotNull<Func<T, System.Threading.Tasks.Task>>("action", CS$<>8__locals2.action);
175
+ val = AllAsync(collection, (Func<T, int, System.Threading.Tasks.Task>)([AsyncStateMachine(typeof(<>c__DisplayClass44_0<>.<<AllAsync>b__0>d))] (T item, int index) =>
176
+ {
177
+ <>c__DisplayClass44_0<T>.<<AllAsync>b__0>d <<AllAsync>b__0>d = default(<>c__DisplayClass44_0<T>.<<AllAsync>b__0>d);
178
+ <<AllAsync>b__0>d.<>t__builder = AsyncTaskMethodBuilder.Create();
179
+ <<AllAsync>b__0>d.<>4__this = CS$<>8__locals2;
180
+ <<AllAsync>b__0>d.item = item;
181
+ <<AllAsync>b__0>d.<>1__state = -1;
182
+ ((AsyncTaskMethodBuilder)(ref <<AllAsync>b__0>d.<>t__builder)).Start<<>c__DisplayClass44_0<T>.<<AllAsync>b__0>d>(ref <<AllAsync>b__0>d);
183
+ return ((AsyncTaskMethodBuilder)(ref <<AllAsync>b__0>d.<>t__builder)).Task;
184
+ })).GetAwaiter();
185
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
186
+ {
187
+ num = (<>1__state = 0);
188
+ <>u__1 = val;
189
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <AllAsync>d__44<T>>(ref val, ref this);
190
+ return;
191
+ }
192
+ }
193
+ else
194
+ {
195
+ val = <>u__1;
196
+ <>u__1 = default(TaskAwaiter);
197
+ num = (<>1__state = -1);
198
+ }
199
+ ((TaskAwaiter)(ref val)).GetResult();
200
+ }
201
+ catch (System.Exception exception)
202
+ {
203
+ <>1__state = -2;
204
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
205
+ return;
206
+ }
207
+ <>1__state = -2;
208
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
209
+ }
210
+ [DebuggerHidden]
211
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
212
+ {
213
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
214
+ }
215
+ }
216
+ [StructLayout((LayoutKind)3)]
217
+ [CompilerGenerated]
218
+ private struct <AllAsync>d__45<T> : IAsyncStateMachine where T : notnull
219
+ {
220
+ public int <>1__state;
221
+ public AsyncTaskMethodBuilder <>t__builder;
222
+ public System.Collections.Generic.IEnumerable<T> collection;
223
+ public Func<T, int, System.Threading.Tasks.Task> action;
224
+ private List<Tuple<int, string, System.Exception>> <errors>5__2;
225
+ private int <idx>5__3;
226
+ private System.Collections.Generic.IEnumerator<T> <>7__wrap3;
227
+ private T <item>5__5;
228
+ private TaskAwaiter <>u__1;
229
+ private void MoveNext()
230
+ {
231
+ int num = <>1__state;
232
+ try
233
+ {
234
+ if (num != 0)
235
+ {
236
+ GuardArgumentNotNull("collection", collection);
237
+ GuardArgumentNotNull<Func<T, int, System.Threading.Tasks.Task>>("action", action);
238
+ <errors>5__2 = new List<Tuple<int, string, System.Exception>>();
239
+ <idx>5__3 = 0;
240
+ <>7__wrap3 = collection.GetEnumerator();
241
+ }
242
+ try
243
+ {
244
+ if (num == 0)
245
+ {
246
+ goto IL_006a;
247
+ }
248
+ goto IL_0122;
249
+ IL_0122:
250
+ if (((System.Collections.IEnumerator)<>7__wrap3).MoveNext())
251
+ {
252
+ <item>5__5 = <>7__wrap3.Current;
253
+ goto IL_006a;
254
+ }
255
+ goto end_IL_0050;
256
+ IL_006a:
257
+ try
258
+ {
259
+ TaskAwaiter val;
260
+ if (num != 0)
261
+ {
262
+ val = action.Invoke(<item>5__5, <idx>5__3).GetAwaiter();
263
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
264
+ {
265
+ num = (<>1__state = 0);
266
+ <>u__1 = val;
267
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <AllAsync>d__45<T>>(ref val, ref this);
268
+ return;
269
+ }
270
+ }
271
+ else
272
+ {
273
+ val = <>u__1;
274
+ <>u__1 = default(TaskAwaiter);
275
+ num = (<>1__state = -1);
276
+ }
277
+ ((TaskAwaiter)(ref val)).GetResult();
278
+ }
279
+ catch (System.Exception ex)
280
+ {
281
+ <errors>5__2.Add(new Tuple<int, string, System.Exception>(<idx>5__3, ArgumentFormatter.Format(<item>5__5), ex));
282
+ }
283
+ int num2 = <idx>5__3 + 1;
284
+ <idx>5__3 = num2;
285
+ <item>5__5 = default(T);
286
+ goto IL_0122;
287
+ end_IL_0050:;
288
+ }
289
+ finally
290
+ {
291
+ if (num < 0 && <>7__wrap3 != null)
292
+ {
293
+ ((System.IDisposable)<>7__wrap3).Dispose();
294
+ }
295
+ }
296
+ <>7__wrap3 = null;
297
+ if (<errors>5__2.Count > 0)
298
+ {
299
+ throw AllException.ForFailures(<idx>5__3, <errors>5__2.ToArray());
300
+ }
301
+ }
302
+ catch (System.Exception exception)
303
+ {
304
+ <>1__state = -2;
305
+ <errors>5__2 = null;
306
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
307
+ return;
308
+ }
309
+ <>1__state = -2;
310
+ <errors>5__2 = null;
311
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
312
+ }
313
+ [DebuggerHidden]
314
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
315
+ {
316
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
317
+ }
318
+ }
319
+ [StructLayout((LayoutKind)3)]
320
+ [CompilerGenerated]
321
+ private struct <CollectionAsync>d__47<T> : IAsyncStateMachine where T : notnull
322
+ {
323
+ public int <>1__state;
324
+ public AsyncTaskMethodBuilder <>t__builder;
325
+ public System.Collections.Generic.IEnumerable<T> collection;
326
+ public Func<T, System.Threading.Tasks.Task>[] elementInspectors;
327
+ private CollectionTracker<T> <tracker>5__2;
328
+ private int <index>5__3;
329
+ private System.Collections.Generic.IEnumerator<T> <>7__wrap3;
330
+ private TaskAwaiter <>u__1;
331
+ private void MoveNext()
332
+ {
333
+ int num = <>1__state;
334
+ try
335
+ {
336
+ if (num != 0)
337
+ {
338
+ GuardArgumentNotNull("collection", collection);
339
+ GuardArgumentNotNull("elementInspectors", elementInspectors);
340
+ <tracker>5__2 = collection.AsTracker();
341
+ }
342
+ try
343
+ {
344
+ if (num != 0)
345
+ {
346
+ <index>5__3 = 0;
347
+ <>7__wrap3 = <tracker>5__2.GetEnumerator();
348
+ }
349
+ try
350
+ {
351
+ if (num == 0)
352
+ {
353
+ goto IL_006f;
354
+ }
355
+ goto IL_0128;
356
+ IL_0128:
357
+ T current = default(T);
358
+ if (((System.Collections.IEnumerator)<>7__wrap3).MoveNext())
359
+ {
360
+ current = <>7__wrap3.Current;
361
+ goto IL_006f;
362
+ }
363
+ goto end_IL_005a;
364
+ IL_006f:
365
+ try
366
+ {
367
+ TaskAwaiter val;
368
+ if (num == 0)
369
+ {
370
+ val = <>u__1;
371
+ <>u__1 = default(TaskAwaiter);
372
+ num = (<>1__state = -1);
373
+ goto IL_00e3;
374
+ }
375
+ if (<index>5__3 < elementInspectors.Length)
376
+ {
377
+ val = elementInspectors[<index>5__3].Invoke(current).GetAwaiter();
378
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
379
+ {
380
+ num = (<>1__state = 0);
381
+ <>u__1 = val;
382
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <CollectionAsync>d__47<T>>(ref val, ref this);
383
+ return;
384
+ }
385
+ goto IL_00e3;
386
+ }
387
+ goto end_IL_006f;
388
+ IL_00e3:
389
+ ((TaskAwaiter)(ref val)).GetResult();
390
+ end_IL_006f:;
391
+ }
392
+ catch (System.Exception exception)
393
+ {
394
+ int? pointerIndent;
395
+ throw CollectionException.ForMismatchedItem(formattedCollection: <tracker>5__2.FormatIndexedMismatch(<index>5__3, out pointerIndent), exception: exception, indexFailurePoint: <index>5__3, failurePointerIndent: pointerIndent);
396
+ }
397
+ <index>5__3++;
398
+ goto IL_0128;
399
+ end_IL_005a:;
400
+ }
401
+ finally
402
+ {
403
+ if (num < 0 && <>7__wrap3 != null)
404
+ {
405
+ ((System.IDisposable)<>7__wrap3).Dispose();
406
+ }
407
+ }
408
+ <>7__wrap3 = null;
409
+ if (<tracker>5__2.IterationCount != elementInspectors.Length)
410
+ {
411
+ throw CollectionException.ForMismatchedItemCount(elementInspectors.Length, <tracker>5__2.IterationCount, <tracker>5__2.FormatStart());
412
+ }
413
+ }
414
+ finally
415
+ {
416
+ if (num < 0 && <tracker>5__2 != null)
417
+ {
418
+ ((System.IDisposable)<tracker>5__2).Dispose();
419
+ }
420
+ }
421
+ <tracker>5__2 = null;
422
+ }
423
+ catch (System.Exception exception2)
424
+ {
425
+ <>1__state = -2;
426
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception2);
427
+ return;
428
+ }
429
+ <>1__state = -2;
430
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
431
+ }
432
+ [DebuggerHidden]
433
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
434
+ {
435
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
436
+ }
437
+ }
438
+ [StructLayout((LayoutKind)3)]
439
+ [CompilerGenerated]
440
+ private struct <PropertyChangedAsync>d__179 : IAsyncStateMachine
441
+ {
442
+ public int <>1__state;
443
+ public AsyncTaskMethodBuilder <>t__builder;
444
+ public string propertyName;
445
+ public INotifyPropertyChanged @object;
446
+ public Func<System.Threading.Tasks.Task> testCode;
447
+ private <>c__DisplayClass179_0 <>8__1;
448
+ private PropertyChangedEventHandler <handler>5__2;
449
+ private TaskAwaiter <>u__1;
450
+ private void MoveNext()
451
+ {
452
+ int num = <>1__state;
453
+ try
454
+ {
455
+ if (num != 0)
456
+ {
457
+ <>8__1 = new <>c__DisplayClass179_0();
458
+ <>8__1.propertyName = propertyName;
459
+ GuardArgumentNotNull<INotifyPropertyChanged>("object", @object);
460
+ GuardArgumentNotNull("propertyName", <>8__1.propertyName);
461
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
462
+ <>8__1.propertyChangeHappened = false;
463
+ <handler>5__2 = (PropertyChangedEventHandler)delegate(object? sender, PropertyChangedEventArgs args)
464
+ {
465
+ <>8__1.propertyChangeHappened = <>8__1.propertyChangeHappened || string.IsNullOrEmpty(args.PropertyName) || <>8__1.propertyName.Equals(args.PropertyName, (StringComparison)5);
466
+ };
467
+ @object.PropertyChanged += <handler>5__2;
468
+ }
469
+ try
470
+ {
471
+ TaskAwaiter val;
472
+ if (num != 0)
473
+ {
474
+ val = testCode.Invoke().GetAwaiter();
475
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
476
+ {
477
+ num = (<>1__state = 0);
478
+ <>u__1 = val;
479
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <PropertyChangedAsync>d__179>(ref val, ref this);
480
+ return;
481
+ }
482
+ }
483
+ else
484
+ {
485
+ val = <>u__1;
486
+ <>u__1 = default(TaskAwaiter);
487
+ num = (<>1__state = -1);
488
+ }
489
+ ((TaskAwaiter)(ref val)).GetResult();
490
+ if (!<>8__1.propertyChangeHappened)
491
+ {
492
+ throw PropertyChangedException.ForUnsetProperty(<>8__1.propertyName);
493
+ }
494
+ }
495
+ finally
496
+ {
497
+ if (num < 0)
498
+ {
499
+ @object.PropertyChanged -= <handler>5__2;
500
+ }
501
+ }
502
+ }
503
+ catch (System.Exception exception)
504
+ {
505
+ <>1__state = -2;
506
+ <>8__1 = null;
507
+ <handler>5__2 = null;
508
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
509
+ return;
510
+ }
511
+ <>1__state = -2;
512
+ <>8__1 = null;
513
+ <handler>5__2 = null;
514
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
515
+ }
516
+ [DebuggerHidden]
517
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
518
+ {
519
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
520
+ }
521
+ }
522
+ [StructLayout((LayoutKind)3)]
523
+ [CompilerGenerated]
524
+ private struct <RaisesAnyAsync>d__122 : IAsyncStateMachine
525
+ {
526
+ public int <>1__state;
527
+ public AsyncTaskMethodBuilder<RaisedEvent<EventArgs>> <>t__builder;
528
+ public Action<EventHandler> attach;
529
+ public Action<EventHandler> detach;
530
+ public Func<System.Threading.Tasks.Task> testCode;
531
+ private TaskAwaiter<RaisedEvent<EventArgs>?> <>u__1;
532
+ private void MoveNext()
533
+ {
534
+ int num = <>1__state;
535
+ RaisedEvent<EventArgs> result;
536
+ try
537
+ {
538
+ TaskAwaiter<RaisedEvent<EventArgs>> val;
539
+ if (num != 0)
540
+ {
541
+ val = RaisesAsyncInternal(attach, detach, testCode).GetAwaiter();
542
+ if (!val.IsCompleted)
543
+ {
544
+ num = (<>1__state = 0);
545
+ <>u__1 = val;
546
+ <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<RaisedEvent<EventArgs>>, <RaisesAnyAsync>d__122>(ref val, ref this);
547
+ return;
548
+ }
549
+ }
550
+ else
551
+ {
552
+ val = <>u__1;
553
+ <>u__1 = default(TaskAwaiter<RaisedEvent<EventArgs>>);
554
+ num = (<>1__state = -1);
555
+ }
556
+ result = val.GetResult() ?? throw RaisesAnyException.ForNoEvent(typeof(EventArgs));
557
+ }
558
+ catch (System.Exception exception)
559
+ {
560
+ <>1__state = -2;
561
+ <>t__builder.SetException(exception);
562
+ return;
563
+ }
564
+ <>1__state = -2;
565
+ <>t__builder.SetResult(result);
566
+ }
567
+ [DebuggerHidden]
568
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
569
+ {
570
+ <>t__builder.SetStateMachine(stateMachine);
571
+ }
572
+ }
573
+ [StructLayout((LayoutKind)3)]
574
+ [CompilerGenerated]
575
+ private struct <RaisesAnyAsync>d__123<T> : IAsyncStateMachine where T : notnull
576
+ {
577
+ public int <>1__state;
578
+ public AsyncTaskMethodBuilder<RaisedEvent<T>> <>t__builder;
579
+ public Action<Action<T>> attach;
580
+ public Action<Action<T>> detach;
581
+ public Func<System.Threading.Tasks.Task> testCode;
582
+ private TaskAwaiter<RaisedEvent<T>?> <>u__1;
583
+ private unsafe void MoveNext()
584
+ {
585
+ int num = <>1__state;
586
+ RaisedEvent<T> result;
587
+ try
588
+ {
589
+ TaskAwaiter<RaisedEvent<T>> val;
590
+ if (num != 0)
591
+ {
592
+ val = ((System.Threading.Tasks.Task<RaisedEvent<RaisedEvent<T>>>)(object)RaisesAsyncInternal<T>(attach, detach, testCode)).GetAwaiter();
593
+ if (!((TaskAwaiter<RaisedEvent<RaisedEvent<T>>>*)(&val))->IsCompleted)
594
+ {
595
+ num = (<>1__state = 0);
596
+ <>u__1 = val;
597
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).AwaitUnsafeOnCompleted<TaskAwaiter<RaisedEvent<T>>, <RaisesAnyAsync>d__123<T>>(ref val, ref this);
598
+ return;
599
+ }
600
+ }
601
+ else
602
+ {
603
+ val = <>u__1;
604
+ <>u__1 = default(TaskAwaiter<RaisedEvent<T>>);
605
+ num = (<>1__state = -1);
606
+ }
607
+ result = ((TaskAwaiter<RaisedEvent<RaisedEvent<T>>>*)(&val))->GetResult() ?? throw RaisesAnyException.ForNoEvent(typeof(T));
608
+ }
609
+ catch (System.Exception exception)
610
+ {
611
+ <>1__state = -2;
612
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetException(exception);
613
+ return;
614
+ }
615
+ <>1__state = -2;
616
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetResult((RaisedEvent<RaisedEvent<T>>)(object)result);
617
+ }
618
+ [DebuggerHidden]
619
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
620
+ {
621
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetStateMachine(stateMachine);
622
+ }
623
+ }
624
+ [StructLayout((LayoutKind)3)]
625
+ [CompilerGenerated]
626
+ private struct <RaisesAnyAsync>d__124<T> : IAsyncStateMachine where T : notnull
627
+ {
628
+ public int <>1__state;
629
+ public AsyncTaskMethodBuilder<RaisedEvent<T>> <>t__builder;
630
+ public Action<EventHandler<T>> attach;
631
+ public Action<EventHandler<T>> detach;
632
+ public Func<System.Threading.Tasks.Task> testCode;
633
+ private TaskAwaiter<RaisedEvent<T>?> <>u__1;
634
+ private unsafe void MoveNext()
635
+ {
636
+ int num = <>1__state;
637
+ RaisedEvent<T> result;
638
+ try
639
+ {
640
+ TaskAwaiter<RaisedEvent<T>> val;
641
+ if (num != 0)
642
+ {
643
+ val = ((System.Threading.Tasks.Task<RaisedEvent<RaisedEvent<T>>>)(object)RaisesAsyncInternal<T>(attach, detach, testCode)).GetAwaiter();
644
+ if (!((TaskAwaiter<RaisedEvent<RaisedEvent<T>>>*)(&val))->IsCompleted)
645
+ {
646
+ num = (<>1__state = 0);
647
+ <>u__1 = val;
648
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).AwaitUnsafeOnCompleted<TaskAwaiter<RaisedEvent<T>>, <RaisesAnyAsync>d__124<T>>(ref val, ref this);
649
+ return;
650
+ }
651
+ }
652
+ else
653
+ {
654
+ val = <>u__1;
655
+ <>u__1 = default(TaskAwaiter<RaisedEvent<T>>);
656
+ num = (<>1__state = -1);
657
+ }
658
+ result = ((TaskAwaiter<RaisedEvent<RaisedEvent<T>>>*)(&val))->GetResult() ?? throw RaisesAnyException.ForNoEvent(typeof(T));
659
+ }
660
+ catch (System.Exception exception)
661
+ {
662
+ <>1__state = -2;
663
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetException(exception);
664
+ return;
665
+ }
666
+ <>1__state = -2;
667
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetResult((RaisedEvent<RaisedEvent<T>>)(object)result);
668
+ }
669
+ [DebuggerHidden]
670
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
671
+ {
672
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetStateMachine(stateMachine);
673
+ }
674
+ }
675
+ [StructLayout((LayoutKind)3)]
676
+ [CompilerGenerated]
677
+ private struct <RaisesAsync>d__125 : IAsyncStateMachine
678
+ {
679
+ public int <>1__state;
680
+ public AsyncTaskMethodBuilder <>t__builder;
681
+ public Action<Action> attach;
682
+ public Action<Action> detach;
683
+ public Func<System.Threading.Tasks.Task> testCode;
684
+ private TaskAwaiter<bool> <>u__1;
685
+ private void MoveNext()
686
+ {
687
+ int num = <>1__state;
688
+ try
689
+ {
690
+ TaskAwaiter<bool> val;
691
+ if (num != 0)
692
+ {
693
+ val = RaisesAsyncInternal(attach, detach, testCode).GetAwaiter();
694
+ if (!val.IsCompleted)
695
+ {
696
+ num = (<>1__state = 0);
697
+ <>u__1 = val;
698
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter<bool>, <RaisesAsync>d__125>(ref val, ref this);
699
+ return;
700
+ }
701
+ }
702
+ else
703
+ {
704
+ val = <>u__1;
705
+ <>u__1 = default(TaskAwaiter<bool>);
706
+ num = (<>1__state = -1);
707
+ }
708
+ if (!val.GetResult())
709
+ {
710
+ throw RaisesException.ForNoEvent();
711
+ }
712
+ }
713
+ catch (System.Exception exception)
714
+ {
715
+ <>1__state = -2;
716
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
717
+ return;
718
+ }
719
+ <>1__state = -2;
720
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
721
+ }
722
+ [DebuggerHidden]
723
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
724
+ {
725
+ ((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
726
+ }
727
+ }
728
+ [StructLayout((LayoutKind)3)]
729
+ [CompilerGenerated]
730
+ private struct <RaisesAsync>d__126<T> : IAsyncStateMachine where T : notnull
731
+ {
732
+ public int <>1__state;
733
+ public AsyncTaskMethodBuilder<RaisedEvent<T>> <>t__builder;
734
+ public Action<Action<T>> attach;
735
+ public Action<Action<T>> detach;
736
+ public Func<System.Threading.Tasks.Task> testCode;
737
+ private TaskAwaiter<RaisedEvent<T>?> <>u__1;
738
+ private unsafe void MoveNext()
739
+ {
740
+ int num = <>1__state;
741
+ RaisedEvent<T> result2;
742
+ try
743
+ {
744
+ TaskAwaiter<RaisedEvent<T>> val;
745
+ if (num != 0)
746
+ {
747
+ val = ((System.Threading.Tasks.Task<RaisedEvent<RaisedEvent<T>>>)(object)RaisesAsyncInternal<T>(attach, detach, testCode)).GetAwaiter();
748
+ if (!((TaskAwaiter<RaisedEvent<RaisedEvent<T>>>*)(&val))->IsCompleted)
749
+ {
750
+ num = (<>1__state = 0);
751
+ <>u__1 = val;
752
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).AwaitUnsafeOnCompleted<TaskAwaiter<RaisedEvent<T>>, <RaisesAsync>d__126<T>>(ref val, ref this);
753
+ return;
754
+ }
755
+ }
756
+ else
757
+ {
758
+ val = <>u__1;
759
+ <>u__1 = default(TaskAwaiter<RaisedEvent<T>>);
760
+ num = (<>1__state = -1);
761
+ }
762
+ RaisedEvent<T> result = ((TaskAwaiter<RaisedEvent<RaisedEvent<T>>>*)(&val))->GetResult();
763
+ if (result == null)
764
+ {
765
+ throw RaisesException.ForNoEvent(typeof(T));
766
+ }
767
+ if (result.Arguments != null && !((object)result.Arguments/*cast due to .constrained prefix*/).GetType().Equals(typeof(T)))
768
+ {
769
+ throw RaisesException.ForIncorrectType(typeof(T), ((object)result.Arguments/*cast due to .constrained prefix*/).GetType());
770
+ }
771
+ result2 = result;
772
+ }
773
+ catch (System.Exception exception)
774
+ {
775
+ <>1__state = -2;
776
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetException(exception);
777
+ return;
778
+ }
779
+ <>1__state = -2;
780
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetResult((RaisedEvent<RaisedEvent<T>>)(object)result2);
781
+ }
782
+ [DebuggerHidden]
783
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
784
+ {
785
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetStateMachine(stateMachine);
786
+ }
787
+ }
788
+ [StructLayout((LayoutKind)3)]
789
+ [CompilerGenerated]
790
+ private struct <RaisesAsync>d__127<T> : IAsyncStateMachine where T : notnull
791
+ {
792
+ public int <>1__state;
793
+ public AsyncTaskMethodBuilder<RaisedEvent<T>> <>t__builder;
794
+ public Action<EventHandler<T>> attach;
795
+ public Action<EventHandler<T>> detach;
796
+ public Func<System.Threading.Tasks.Task> testCode;
797
+ private TaskAwaiter<RaisedEvent<T>?> <>u__1;
798
+ private unsafe void MoveNext()
799
+ {
800
+ int num = <>1__state;
801
+ RaisedEvent<T> result2;
802
+ try
803
+ {
804
+ TaskAwaiter<RaisedEvent<T>> val;
805
+ if (num != 0)
806
+ {
807
+ val = ((System.Threading.Tasks.Task<RaisedEvent<RaisedEvent<T>>>)(object)RaisesAsyncInternal<T>(attach, detach, testCode)).GetAwaiter();
808
+ if (!((TaskAwaiter<RaisedEvent<RaisedEvent<T>>>*)(&val))->IsCompleted)
809
+ {
810
+ num = (<>1__state = 0);
811
+ <>u__1 = val;
812
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).AwaitUnsafeOnCompleted<TaskAwaiter<RaisedEvent<T>>, <RaisesAsync>d__127<T>>(ref val, ref this);
813
+ return;
814
+ }
815
+ }
816
+ else
817
+ {
818
+ val = <>u__1;
819
+ <>u__1 = default(TaskAwaiter<RaisedEvent<T>>);
820
+ num = (<>1__state = -1);
821
+ }
822
+ RaisedEvent<T> result = ((TaskAwaiter<RaisedEvent<RaisedEvent<T>>>*)(&val))->GetResult();
823
+ if (result == null)
824
+ {
825
+ throw RaisesException.ForNoEvent(typeof(T));
826
+ }
827
+ if (result.Arguments != null && !((object)result.Arguments/*cast due to .constrained prefix*/).GetType().Equals(typeof(T)))
828
+ {
829
+ throw RaisesException.ForIncorrectType(typeof(T), ((object)result.Arguments/*cast due to .constrained prefix*/).GetType());
830
+ }
831
+ result2 = result;
832
+ }
833
+ catch (System.Exception exception)
834
+ {
835
+ <>1__state = -2;
836
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetException(exception);
837
+ return;
838
+ }
839
+ <>1__state = -2;
840
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetResult((RaisedEvent<RaisedEvent<T>>)(object)result2);
841
+ }
842
+ [DebuggerHidden]
843
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
844
+ {
845
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetStateMachine(stateMachine);
846
+ }
847
+ }
848
+ [StructLayout((LayoutKind)3)]
849
+ [CompilerGenerated]
850
+ private struct <RaisesAsyncInternal>d__133 : IAsyncStateMachine
851
+ {
852
+ public int <>1__state;
853
+ public AsyncTaskMethodBuilder<bool> <>t__builder;
854
+ public Action<Action> attach;
855
+ public Action<Action> detach;
856
+ public Func<System.Threading.Tasks.Task> testCode;
857
+ private <>c__DisplayClass133_0 <>8__1;
858
+ private Action <handler>5__2;
859
+ private TaskAwaiter <>u__1;
860
+ private void MoveNext()
861
+ {
862
+ int num = <>1__state;
863
+ bool result;
864
+ try
865
+ {
866
+ TaskAwaiter val;
867
+ if (num != 0)
868
+ {
869
+ <>8__1 = new <>c__DisplayClass133_0();
870
+ GuardArgumentNotNull<Action<Action>>("attach", attach);
871
+ GuardArgumentNotNull<Action<Action>>("detach", detach);
872
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
873
+ <>8__1.result = false;
874
+ <handler>5__2 = (Action)delegate
875
+ {
876
+ <>8__1.result = true;
877
+ };
878
+ attach.Invoke(<handler>5__2);
879
+ val = testCode.Invoke().GetAwaiter();
880
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
881
+ {
882
+ num = (<>1__state = 0);
883
+ <>u__1 = val;
884
+ <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, <RaisesAsyncInternal>d__133>(ref val, ref this);
885
+ return;
886
+ }
887
+ }
888
+ else
889
+ {
890
+ val = <>u__1;
891
+ <>u__1 = default(TaskAwaiter);
892
+ num = (<>1__state = -1);
893
+ }
894
+ ((TaskAwaiter)(ref val)).GetResult();
895
+ detach.Invoke(<handler>5__2);
896
+ result = <>8__1.result;
897
+ }
898
+ catch (System.Exception exception)
899
+ {
900
+ <>1__state = -2;
901
+ <>8__1 = null;
902
+ <handler>5__2 = null;
903
+ <>t__builder.SetException(exception);
904
+ return;
905
+ }
906
+ <>1__state = -2;
907
+ <>8__1 = null;
908
+ <handler>5__2 = null;
909
+ <>t__builder.SetResult(result);
910
+ }
911
+ [DebuggerHidden]
912
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
913
+ {
914
+ <>t__builder.SetStateMachine(stateMachine);
915
+ }
916
+ }
917
+ [StructLayout((LayoutKind)3)]
918
+ [CompilerGenerated]
919
+ private struct <RaisesAsyncInternal>d__134 : IAsyncStateMachine
920
+ {
921
+ public int <>1__state;
922
+ public AsyncTaskMethodBuilder<RaisedEvent<EventArgs>> <>t__builder;
923
+ public Action<EventHandler> attach;
924
+ public Action<EventHandler> detach;
925
+ public Func<System.Threading.Tasks.Task> testCode;
926
+ private <>c__DisplayClass134_0 <>8__1;
927
+ private TaskAwaiter <>u__1;
928
+ private void MoveNext()
929
+ {
930
+ int num = <>1__state;
931
+ RaisedEvent<EventArgs> result;
932
+ try
933
+ {
934
+ TaskAwaiter val;
935
+ if (num != 0)
936
+ {
937
+ <>8__1 = new <>c__DisplayClass134_0();
938
+ GuardArgumentNotNull<Action<EventHandler>>("attach", attach);
939
+ GuardArgumentNotNull<Action<EventHandler>>("detach", detach);
940
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
941
+ <>8__1.raisedEvent = null;
942
+ attach.Invoke(new EventHandler(handler));
943
+ val = testCode.Invoke().GetAwaiter();
944
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
945
+ {
946
+ num = (<>1__state = 0);
947
+ <>u__1 = val;
948
+ <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, <RaisesAsyncInternal>d__134>(ref val, ref this);
949
+ return;
950
+ }
951
+ }
952
+ else
953
+ {
954
+ val = <>u__1;
955
+ <>u__1 = default(TaskAwaiter);
956
+ num = (<>1__state = -1);
957
+ }
958
+ ((TaskAwaiter)(ref val)).GetResult();
959
+ detach.Invoke(new EventHandler(handler));
960
+ result = <>8__1.raisedEvent;
961
+ }
962
+ catch (System.Exception exception)
963
+ {
964
+ <>1__state = -2;
965
+ <>8__1 = null;
966
+ <>t__builder.SetException(exception);
967
+ return;
968
+ }
969
+ <>1__state = -2;
970
+ <>8__1 = null;
971
+ <>t__builder.SetResult(result);
972
+ void handler(object? s, EventArgs args)
973
+ {
974
+ ((<>c__DisplayClass134_0)(object)this).raisedEvent = new RaisedEvent<EventArgs>(s, args);
975
+ }
976
+ }
977
+ [DebuggerHidden]
978
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
979
+ {
980
+ <>t__builder.SetStateMachine(stateMachine);
981
+ }
982
+ }
983
+ [StructLayout((LayoutKind)3)]
984
+ [CompilerGenerated]
985
+ private struct <RaisesAsyncInternal>d__135<T> : IAsyncStateMachine where T : notnull
986
+ {
987
+ public int <>1__state;
988
+ public AsyncTaskMethodBuilder<RaisedEvent<T>> <>t__builder;
989
+ public Action<Action<T>> attach;
990
+ public Action<Action<T>> detach;
991
+ public Func<System.Threading.Tasks.Task> testCode;
992
+ private <>c__DisplayClass135_0<T> <>8__1;
993
+ private Action<T> <handler>5__2;
994
+ private TaskAwaiter <>u__1;
995
+ private void MoveNext()
996
+ {
997
+ int num = <>1__state;
998
+ RaisedEvent<T> result;
999
+ try
1000
+ {
1001
+ TaskAwaiter val;
1002
+ if (num != 0)
1003
+ {
1004
+ <>8__1 = new <>c__DisplayClass135_0<T>();
1005
+ GuardArgumentNotNull<Action<Action<T>>>("attach", attach);
1006
+ GuardArgumentNotNull<Action<Action<T>>>("detach", detach);
1007
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
1008
+ <>8__1.raisedEvent = null;
1009
+ <handler>5__2 = delegate(T args)
1010
+ {
1011
+ <>8__1.raisedEvent = new RaisedEvent<T>(args);
1012
+ };
1013
+ ((Action<Action<Action<T>>>)(object)attach).Invoke((Action<Action<T>>)(object)<handler>5__2);
1014
+ val = testCode.Invoke().GetAwaiter();
1015
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
1016
+ {
1017
+ num = (<>1__state = 0);
1018
+ <>u__1 = val;
1019
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).AwaitUnsafeOnCompleted<TaskAwaiter, <RaisesAsyncInternal>d__135<T>>(ref val, ref this);
1020
+ return;
1021
+ }
1022
+ }
1023
+ else
1024
+ {
1025
+ val = <>u__1;
1026
+ <>u__1 = default(TaskAwaiter);
1027
+ num = (<>1__state = -1);
1028
+ }
1029
+ ((TaskAwaiter)(ref val)).GetResult();
1030
+ ((Action<Action<Action<T>>>)(object)detach).Invoke((Action<Action<T>>)(object)<handler>5__2);
1031
+ result = <>8__1.raisedEvent;
1032
+ }
1033
+ catch (System.Exception exception)
1034
+ {
1035
+ <>1__state = -2;
1036
+ <>8__1 = null;
1037
+ <handler>5__2 = null;
1038
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetException(exception);
1039
+ return;
1040
+ }
1041
+ <>1__state = -2;
1042
+ <>8__1 = null;
1043
+ <handler>5__2 = null;
1044
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetResult((RaisedEvent<RaisedEvent<T>>)(object)result);
1045
+ }
1046
+ [DebuggerHidden]
1047
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
1048
+ {
1049
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetStateMachine(stateMachine);
1050
+ }
1051
+ }
1052
+ [StructLayout((LayoutKind)3)]
1053
+ [CompilerGenerated]
1054
+ private struct <RaisesAsyncInternal>d__136<T> : IAsyncStateMachine where T : notnull
1055
+ {
1056
+ public int <>1__state;
1057
+ public AsyncTaskMethodBuilder<RaisedEvent<T>> <>t__builder;
1058
+ public Action<EventHandler<T>> attach;
1059
+ public Action<EventHandler<T>> detach;
1060
+ public Func<System.Threading.Tasks.Task> testCode;
1061
+ private <>c__DisplayClass136_0<T> <>8__1;
1062
+ private TaskAwaiter <>u__1;
1063
+ private void MoveNext()
1064
+ {
1065
+ int num = <>1__state;
1066
+ RaisedEvent<T> result;
1067
+ try
1068
+ {
1069
+ TaskAwaiter val;
1070
+ if (num != 0)
1071
+ {
1072
+ <>8__1 = new <>c__DisplayClass136_0<T>();
1073
+ GuardArgumentNotNull<Action<EventHandler<T>>>("attach", attach);
1074
+ GuardArgumentNotNull<Action<EventHandler<T>>>("detach", detach);
1075
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
1076
+ <>8__1.raisedEvent = null;
1077
+ ((Action<EventHandler<EventHandler<T>>>)(object)attach).Invoke((EventHandler<EventHandler<T>>)(object)new EventHandler<T>(handler));
1078
+ val = testCode.Invoke().GetAwaiter();
1079
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
1080
+ {
1081
+ num = (<>1__state = 0);
1082
+ <>u__1 = val;
1083
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).AwaitUnsafeOnCompleted<TaskAwaiter, <RaisesAsyncInternal>d__136<T>>(ref val, ref this);
1084
+ return;
1085
+ }
1086
+ }
1087
+ else
1088
+ {
1089
+ val = <>u__1;
1090
+ <>u__1 = default(TaskAwaiter);
1091
+ num = (<>1__state = -1);
1092
+ }
1093
+ ((TaskAwaiter)(ref val)).GetResult();
1094
+ ((Action<EventHandler<EventHandler<T>>>)(object)detach).Invoke((EventHandler<EventHandler<T>>)(object)new EventHandler<T>(handler));
1095
+ result = <>8__1.raisedEvent;
1096
+ }
1097
+ catch (System.Exception exception)
1098
+ {
1099
+ <>1__state = -2;
1100
+ <>8__1 = null;
1101
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetException(exception);
1102
+ return;
1103
+ }
1104
+ <>1__state = -2;
1105
+ <>8__1 = null;
1106
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetResult((RaisedEvent<RaisedEvent<T>>)(object)result);
1107
+ void handler(object? s, T args)
1108
+ {
1109
+ ((<>c__DisplayClass136_0<T>)(object)this).raisedEvent = new RaisedEvent<T>(s, args);
1110
+ }
1111
+ }
1112
+ [DebuggerHidden]
1113
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
1114
+ {
1115
+ System.Runtime.CompilerServices.Unsafe.As<AsyncTaskMethodBuilder<RaisedEvent<T>>, AsyncTaskMethodBuilder<RaisedEvent<RaisedEvent<T>>>>(ref <>t__builder).SetStateMachine(stateMachine);
1116
+ }
1117
+ }
1118
+ [StructLayout((LayoutKind)3)]
1119
+ [CompilerGenerated]
1120
+ private struct <RecordExceptionAsync>d__187 : IAsyncStateMachine
1121
+ {
1122
+ public int <>1__state;
1123
+ public AsyncTaskMethodBuilder<System.Exception> <>t__builder;
1124
+ public Func<System.Threading.Tasks.Task> testCode;
1125
+ private TaskAwaiter <>u__1;
1126
+ private void MoveNext()
1127
+ {
1128
+ int num = <>1__state;
1129
+ System.Exception result;
1130
+ try
1131
+ {
1132
+ if (num != 0)
1133
+ {
1134
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
1135
+ }
1136
+ try
1137
+ {
1138
+ TaskAwaiter val;
1139
+ if (num != 0)
1140
+ {
1141
+ val = testCode.Invoke().GetAwaiter();
1142
+ if (!((TaskAwaiter)(ref val)).IsCompleted)
1143
+ {
1144
+ num = (<>1__state = 0);
1145
+ <>u__1 = val;
1146
+ <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter, <RecordExceptionAsync>d__187>(ref val, ref this);
1147
+ return;
1148
+ }
1149
+ }
1150
+ else
1151
+ {
1152
+ val = <>u__1;
1153
+ <>u__1 = default(TaskAwaiter);
1154
+ num = (<>1__state = -1);
1155
+ }
1156
+ ((TaskAwaiter)(ref val)).GetResult();
1157
+ result = null;
1158
+ }
1159
+ catch (System.Exception ex)
1160
+ {
1161
+ result = ex;
1162
+ }
1163
+ }
1164
+ catch (System.Exception exception)
1165
+ {
1166
+ <>1__state = -2;
1167
+ <>t__builder.SetException(exception);
1168
+ return;
1169
+ }
1170
+ <>1__state = -2;
1171
+ <>t__builder.SetResult(result);
1172
+ }
1173
+ [DebuggerHidden]
1174
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
1175
+ {
1176
+ <>t__builder.SetStateMachine(stateMachine);
1177
+ }
1178
+ }
1179
+ [StructLayout((LayoutKind)3)]
1180
+ [CompilerGenerated]
1181
+ private struct <ThrowsAnyAsync>d__152<T> : IAsyncStateMachine where T : notnull, System.Exception
1182
+ {
1183
+ public int <>1__state;
1184
+ public AsyncTaskMethodBuilder<T> <>t__builder;
1185
+ public Func<System.Threading.Tasks.Task> testCode;
1186
+ private System.Type <>7__wrap1;
1187
+ private TaskAwaiter<System.Exception?> <>u__1;
1188
+ private void MoveNext()
1189
+ {
1190
+ int num = <>1__state;
1191
+ T result2;
1192
+ try
1193
+ {
1194
+ TaskAwaiter<System.Exception> val;
1195
+ if (num != 0)
1196
+ {
1197
+ <>7__wrap1 = typeof(T);
1198
+ val = RecordExceptionAsync(testCode).GetAwaiter();
1199
+ if (!val.IsCompleted)
1200
+ {
1201
+ num = (<>1__state = 0);
1202
+ <>u__1 = val;
1203
+ <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<System.Exception>, <ThrowsAnyAsync>d__152<T>>(ref val, ref this);
1204
+ return;
1205
+ }
1206
+ }
1207
+ else
1208
+ {
1209
+ val = <>u__1;
1210
+ <>u__1 = default(TaskAwaiter<System.Exception>);
1211
+ num = (<>1__state = -1);
1212
+ }
1213
+ System.Exception result = val.GetResult();
1214
+ result2 = (T)ThrowsAny(<>7__wrap1, result);
1215
+ }
1216
+ catch (System.Exception exception)
1217
+ {
1218
+ <>1__state = -2;
1219
+ <>t__builder.SetException(exception);
1220
+ return;
1221
+ }
1222
+ <>1__state = -2;
1223
+ <>t__builder.SetResult(result2);
1224
+ }
1225
+ [DebuggerHidden]
1226
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
1227
+ {
1228
+ <>t__builder.SetStateMachine(stateMachine);
1229
+ }
1230
+ }
1231
+ [StructLayout((LayoutKind)3)]
1232
+ [CompilerGenerated]
1233
+ private struct <ThrowsAsync>d__153 : IAsyncStateMachine
1234
+ {
1235
+ public int <>1__state;
1236
+ public AsyncTaskMethodBuilder<System.Exception> <>t__builder;
1237
+ public System.Type exceptionType;
1238
+ public Func<System.Threading.Tasks.Task> testCode;
1239
+ private System.Type <>7__wrap1;
1240
+ private TaskAwaiter<System.Exception?> <>u__1;
1241
+ private void MoveNext()
1242
+ {
1243
+ int num = <>1__state;
1244
+ System.Exception result2;
1245
+ try
1246
+ {
1247
+ TaskAwaiter<System.Exception> val;
1248
+ if (num != 0)
1249
+ {
1250
+ <>7__wrap1 = exceptionType;
1251
+ val = RecordExceptionAsync(testCode).GetAwaiter();
1252
+ if (!val.IsCompleted)
1253
+ {
1254
+ num = (<>1__state = 0);
1255
+ <>u__1 = val;
1256
+ <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<System.Exception>, <ThrowsAsync>d__153>(ref val, ref this);
1257
+ return;
1258
+ }
1259
+ }
1260
+ else
1261
+ {
1262
+ val = <>u__1;
1263
+ <>u__1 = default(TaskAwaiter<System.Exception>);
1264
+ num = (<>1__state = -1);
1265
+ }
1266
+ System.Exception result = val.GetResult();
1267
+ result2 = Throws(<>7__wrap1, result);
1268
+ }
1269
+ catch (System.Exception exception)
1270
+ {
1271
+ <>1__state = -2;
1272
+ <>t__builder.SetException(exception);
1273
+ return;
1274
+ }
1275
+ <>1__state = -2;
1276
+ <>t__builder.SetResult(result2);
1277
+ }
1278
+ [DebuggerHidden]
1279
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
1280
+ {
1281
+ <>t__builder.SetStateMachine(stateMachine);
1282
+ }
1283
+ }
1284
+ [StructLayout((LayoutKind)3)]
1285
+ [CompilerGenerated]
1286
+ private struct <ThrowsAsync>d__154<T> : IAsyncStateMachine where T : notnull, System.Exception
1287
+ {
1288
+ public int <>1__state;
1289
+ public AsyncTaskMethodBuilder<T> <>t__builder;
1290
+ public Func<System.Threading.Tasks.Task> testCode;
1291
+ private System.Type <>7__wrap1;
1292
+ private TaskAwaiter<System.Exception?> <>u__1;
1293
+ private void MoveNext()
1294
+ {
1295
+ int num = <>1__state;
1296
+ T result2;
1297
+ try
1298
+ {
1299
+ TaskAwaiter<System.Exception> val;
1300
+ if (num != 0)
1301
+ {
1302
+ <>7__wrap1 = typeof(T);
1303
+ val = RecordExceptionAsync(testCode).GetAwaiter();
1304
+ if (!val.IsCompleted)
1305
+ {
1306
+ num = (<>1__state = 0);
1307
+ <>u__1 = val;
1308
+ <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<System.Exception>, <ThrowsAsync>d__154<T>>(ref val, ref this);
1309
+ return;
1310
+ }
1311
+ }
1312
+ else
1313
+ {
1314
+ val = <>u__1;
1315
+ <>u__1 = default(TaskAwaiter<System.Exception>);
1316
+ num = (<>1__state = -1);
1317
+ }
1318
+ System.Exception result = val.GetResult();
1319
+ result2 = (T)Throws(<>7__wrap1, result);
1320
+ }
1321
+ catch (System.Exception exception)
1322
+ {
1323
+ <>1__state = -2;
1324
+ <>t__builder.SetException(exception);
1325
+ return;
1326
+ }
1327
+ <>1__state = -2;
1328
+ <>t__builder.SetResult(result2);
1329
+ }
1330
+ [DebuggerHidden]
1331
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
1332
+ {
1333
+ <>t__builder.SetStateMachine(stateMachine);
1334
+ }
1335
+ }
1336
+ [StructLayout((LayoutKind)3)]
1337
+ [CompilerGenerated]
1338
+ private struct <ThrowsAsync>d__155<T> : IAsyncStateMachine where T : notnull, ArgumentException
1339
+ {
1340
+ public int <>1__state;
1341
+ public AsyncTaskMethodBuilder<T> <>t__builder;
1342
+ public Func<System.Threading.Tasks.Task> testCode;
1343
+ public string paramName;
1344
+ private TaskAwaiter<T> <>u__1;
1345
+ private void MoveNext()
1346
+ {
1347
+ int num = <>1__state;
1348
+ T result2;
1349
+ try
1350
+ {
1351
+ TaskAwaiter<T> val;
1352
+ if (num != 0)
1353
+ {
1354
+ val = Assert.ThrowsAsync<T>(testCode).GetAwaiter();
1355
+ if (!val.IsCompleted)
1356
+ {
1357
+ num = (<>1__state = 0);
1358
+ <>u__1 = val;
1359
+ <>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<T>, <ThrowsAsync>d__155<T>>(ref val, ref this);
1360
+ return;
1361
+ }
1362
+ }
1363
+ else
1364
+ {
1365
+ val = <>u__1;
1366
+ <>u__1 = default(TaskAwaiter<T>);
1367
+ num = (<>1__state = -1);
1368
+ }
1369
+ T result = val.GetResult();
1370
+ if (paramName != ((ArgumentException)result).ParamName)
1371
+ {
1372
+ throw ThrowsException.ForIncorrectParameterName(typeof(T), paramName, ((ArgumentException)result).ParamName);
1373
+ }
1374
+ result2 = result;
1375
+ }
1376
+ catch (System.Exception exception)
1377
+ {
1378
+ <>1__state = -2;
1379
+ <>t__builder.SetException(exception);
1380
+ return;
1381
+ }
1382
+ <>1__state = -2;
1383
+ <>t__builder.SetResult(result2);
1384
+ }
1385
+ [DebuggerHidden]
1386
+ private void SetStateMachine(IAsyncStateMachine stateMachine)
1387
+ {
1388
+ <>t__builder.SetStateMachine(stateMachine);
1389
+ }
1390
+ }
1391
+ private static readonly System.Type typeofDictionary = typeof(Dictionary<, >);
1392
+ private static readonly System.Type typeofHashSet = typeof(HashSet<>);
1393
+ private static readonly System.Type typeofSet = typeof(ISet<>);
1394
+ private static readonly HashSet<char> charsLineEndings;
1395
+ private static readonly HashSet<char> charsWhitespace;
1396
+ protected Assert()
1397
+ {
1398
+ }
1399
+ [Obsolete("This is an override of Object.Equals(). Call Assert.Equal() instead.", true)]
1400
+ [EditorBrowsable(/*Could not decode attribute arguments.*/)]
1401
+ public static bool Equals(object a, object b)
1402
+ {
1403
+ throw new InvalidOperationException("Assert.Equals should not be used");
1404
+ }
1405
+ [Obsolete("This is an override of Object.ReferenceEquals(). Call Assert.Same() instead.", true)]
1406
+ [EditorBrowsable(/*Could not decode attribute arguments.*/)]
1407
+ public static bool ReferenceEquals(object a, object b)
1408
+ {
1409
+ throw new InvalidOperationException("Assert.ReferenceEquals should not be used");
1410
+ }
1411
+ private static System.Type? SafeGetGenericTypeDefinition(System.Type? type)
1412
+ {
1413
+ if (type == (System.Type)null)
1414
+ {
1415
+ return null;
1416
+ }
1417
+ if (!type.IsGenericType)
1418
+ {
1419
+ return null;
1420
+ }
1421
+ try
1422
+ {
1423
+ return type.GetGenericTypeDefinition();
1424
+ }
1425
+ catch (InvalidOperationException)
1426
+ {
1427
+ return null;
1428
+ }
1429
+ }
1430
+ public static void All<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, Action<T> action)
1431
+ {
1432
+ All(AssertHelper.ToEnumerable(collection), action);
1433
+ }
1434
+ public static void All<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, Action<T, int> action)
1435
+ {
1436
+ All(AssertHelper.ToEnumerable(collection), action);
1437
+ }
1438
+ public static System.Threading.Tasks.Task AllAsync<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, Func<T, System.Threading.Tasks.Task> action)
1439
+ {
1440
+ return AllAsync(AssertHelper.ToEnumerable(collection), action);
1441
+ }
1442
+ public static System.Threading.Tasks.Task AllAsync<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, Func<T, int, System.Threading.Tasks.Task> action)
1443
+ {
1444
+ return AllAsync(AssertHelper.ToEnumerable(collection), action);
1445
+ }
1446
+ public static void Collection<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, params Action<T>[] elementInspectors)
1447
+ {
1448
+ Collection(AssertHelper.ToEnumerable(collection), elementInspectors);
1449
+ }
1450
+ public static System.Threading.Tasks.Task CollectionAsync<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, params Func<T, System.Threading.Tasks.Task>[] elementInspectors)
1451
+ {
1452
+ return CollectionAsync(AssertHelper.ToEnumerable(collection), elementInspectors);
1453
+ }
1454
+ public static void Contains<T>(T expected, System.Collections.Generic.IAsyncEnumerable<T> collection)
1455
+ {
1456
+ Contains(expected, AssertHelper.ToEnumerable(collection));
1457
+ }
1458
+ public static void Contains<T>(T expected, System.Collections.Generic.IAsyncEnumerable<T> collection, IEqualityComparer<T> comparer)
1459
+ {
1460
+ Contains(expected, AssertHelper.ToEnumerable(collection), comparer);
1461
+ }
1462
+ public static void Contains<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, Predicate<T> filter)
1463
+ {
1464
+ Contains(AssertHelper.ToEnumerable(collection), filter);
1465
+ }
1466
+ public static void Distinct<T>(System.Collections.Generic.IAsyncEnumerable<T> collection)
1467
+ {
1468
+ Distinct(AssertHelper.ToEnumerable(collection), (IEqualityComparer<T>)(object)EqualityComparer<T>.Default);
1469
+ }
1470
+ public static void Distinct<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, IEqualityComparer<T> comparer)
1471
+ {
1472
+ Distinct(AssertHelper.ToEnumerable(collection), comparer);
1473
+ }
1474
+ public static void DoesNotContain<T>(T expected, System.Collections.Generic.IAsyncEnumerable<T> collection)
1475
+ {
1476
+ DoesNotContain(expected, AssertHelper.ToEnumerable(collection));
1477
+ }
1478
+ public static void DoesNotContain<T>(T expected, System.Collections.Generic.IAsyncEnumerable<T> collection, IEqualityComparer<T> comparer)
1479
+ {
1480
+ DoesNotContain(expected, AssertHelper.ToEnumerable(collection), comparer);
1481
+ }
1482
+ public static void DoesNotContain<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, Predicate<T> filter)
1483
+ {
1484
+ DoesNotContain(AssertHelper.ToEnumerable(collection), filter);
1485
+ }
1486
+ public static void Empty<T>(System.Collections.Generic.IAsyncEnumerable<T> collection)
1487
+ {
1488
+ Empty((System.Collections.IEnumerable)AssertHelper.ToEnumerable(collection));
1489
+ }
1490
+ public static void Equal<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual)
1491
+ {
1492
+ Equal(expected, AssertHelper.ToEnumerable(actual), GetEqualityComparer<T>());
1493
+ }
1494
+ public static void Equal<T>(System.Collections.Generic.IAsyncEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual)
1495
+ {
1496
+ Equal(AssertHelper.ToEnumerable(expected), AssertHelper.ToEnumerable(actual), GetEqualityComparer<T>());
1497
+ }
1498
+ public static void Equal<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual, IEqualityComparer<T> comparer)
1499
+ {
1500
+ Assert.Equal<System.Collections.Generic.IEnumerable<T>>(expected, AssertHelper.ToEnumerable(actual), GetEqualityComparer<System.Collections.Generic.IEnumerable<T>>((IEqualityComparer?)(object)new AssertEqualityComparerAdapter<T>(comparer)));
1501
+ }
1502
+ public static void Equal<T>(System.Collections.Generic.IAsyncEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual, IEqualityComparer<T> comparer)
1503
+ {
1504
+ Equal(AssertHelper.ToEnumerable(expected), AssertHelper.ToEnumerable(actual), GetEqualityComparer<System.Collections.Generic.IEnumerable<T>>((IEqualityComparer?)(object)new AssertEqualityComparerAdapter<T>(comparer)));
1505
+ }
1506
+ public static void Equal<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual, Func<T, T, bool> comparer)
1507
+ {
1508
+ Equal(expected, AssertHelper.ToEnumerable(actual), AssertEqualityComparer<T>.FromComparer(comparer));
1509
+ }
1510
+ public static void Equal<T>(System.Collections.Generic.IAsyncEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual, Func<T, T, bool> comparer)
1511
+ {
1512
+ Equal(AssertHelper.ToEnumerable(expected), AssertHelper.ToEnumerable(actual), AssertEqualityComparer<T>.FromComparer(comparer));
1513
+ }
1514
+ public static void NotEmpty<T>(System.Collections.Generic.IAsyncEnumerable<T> collection)
1515
+ {
1516
+ NotEmpty((System.Collections.IEnumerable)AssertHelper.ToEnumerable(collection));
1517
+ }
1518
+ public static void NotEqual<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual)
1519
+ {
1520
+ NotEqual(expected, AssertHelper.ToEnumerable(actual), GetEqualityComparer<T>());
1521
+ }
1522
+ public static void NotEqual<T>(System.Collections.Generic.IAsyncEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual)
1523
+ {
1524
+ NotEqual(AssertHelper.ToEnumerable(expected), AssertHelper.ToEnumerable(actual), GetEqualityComparer<T>());
1525
+ }
1526
+ public static void NotEqual<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual, IEqualityComparer<T> comparer)
1527
+ {
1528
+ Assert.NotEqual<System.Collections.Generic.IEnumerable<T>>(expected, AssertHelper.ToEnumerable(actual), GetEqualityComparer<System.Collections.Generic.IEnumerable<T>>((IEqualityComparer?)(object)new AssertEqualityComparerAdapter<T>(comparer)));
1529
+ }
1530
+ public static void NotEqual<T>(System.Collections.Generic.IAsyncEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual, IEqualityComparer<T> comparer)
1531
+ {
1532
+ NotEqual(AssertHelper.ToEnumerable(expected), AssertHelper.ToEnumerable(actual), GetEqualityComparer<System.Collections.Generic.IEnumerable<T>>((IEqualityComparer?)(object)new AssertEqualityComparerAdapter<T>(comparer)));
1533
+ }
1534
+ public static void NotEqual<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual, Func<T, T, bool> comparer)
1535
+ {
1536
+ NotEqual(expected, AssertHelper.ToEnumerable(actual), AssertEqualityComparer<T>.FromComparer(comparer));
1537
+ }
1538
+ public static void NotEqual<T>(System.Collections.Generic.IAsyncEnumerable<T>? expected, System.Collections.Generic.IAsyncEnumerable<T>? actual, Func<T, T, bool> comparer)
1539
+ {
1540
+ NotEqual(AssertHelper.ToEnumerable(expected), AssertHelper.ToEnumerable(actual), AssertEqualityComparer<T>.FromComparer(comparer));
1541
+ }
1542
+ public static T Single<T>(System.Collections.Generic.IAsyncEnumerable<T> collection)
1543
+ {
1544
+ return Single(AssertHelper.ToEnumerable(collection));
1545
+ }
1546
+ public static T Single<T>(System.Collections.Generic.IAsyncEnumerable<T> collection, Predicate<T> predicate)
1547
+ {
1548
+ return Single(AssertHelper.ToEnumerable(collection), predicate);
1549
+ }
1550
+ public static void False([DoesNotReturnIf(true)] bool condition)
1551
+ {
1552
+ False((bool?)condition, (string?)null);
1553
+ }
1554
+ public static void False([DoesNotReturnIf(true)] bool? condition)
1555
+ {
1556
+ False(condition, null);
1557
+ }
1558
+ public static void False([DoesNotReturnIf(true)] bool condition, string? userMessage)
1559
+ {
1560
+ False((bool?)condition, userMessage);
1561
+ }
1562
+ public static void False([DoesNotReturnIf(true)] bool? condition, string? userMessage)
1563
+ {
1564
+ if (condition ?? true)
1565
+ {
1566
+ throw FalseException.ForNonFalseValue(userMessage, condition);
1567
+ }
1568
+ }
1569
+ public static void True([DoesNotReturnIf(false)] bool condition)
1570
+ {
1571
+ True((bool?)condition, (string?)null);
1572
+ }
1573
+ public static void True([DoesNotReturnIf(false)] bool? condition)
1574
+ {
1575
+ True(condition, null);
1576
+ }
1577
+ public static void True([DoesNotReturnIf(false)] bool condition, string? userMessage)
1578
+ {
1579
+ True((bool?)condition, userMessage);
1580
+ }
1581
+ public static void True([DoesNotReturnIf(false)] bool? condition, string? userMessage)
1582
+ {
1583
+ if ((!condition) ?? true)
1584
+ {
1585
+ throw TrueException.ForNonTrueValue(userMessage, condition);
1586
+ }
1587
+ }
1588
+ public static void All<T>(System.Collections.Generic.IEnumerable<T> collection, Action<T> action)
1589
+ {
1590
+ GuardArgumentNotNull("collection", collection);
1591
+ GuardArgumentNotNull<Action<T>>("action", action);
1592
+ All(collection, (Action<T, int>)delegate(T item, int index)
1593
+ {
1594
+ action.Invoke(item);
1595
+ });
1596
+ }
1597
+ public static void All<T>(System.Collections.Generic.IEnumerable<T> collection, Action<T, int> action)
1598
+ {
1599
+ GuardArgumentNotNull("collection", collection);
1600
+ GuardArgumentNotNull<Action<T, int>>("action", action);
1601
+ List<Tuple<int, string, System.Exception>> val = new List<Tuple<int, string, System.Exception>>();
1602
+ int num = 0;
1603
+ System.Collections.Generic.IEnumerator<T> enumerator = collection.GetEnumerator();
1604
+ try
1605
+ {
1606
+ while (((System.Collections.IEnumerator)enumerator).MoveNext())
1607
+ {
1608
+ T current = enumerator.Current;
1609
+ try
1610
+ {
1611
+ action.Invoke(current, num);
1612
+ }
1613
+ catch (System.Exception ex)
1614
+ {
1615
+ val.Add(new Tuple<int, string, System.Exception>(num, ArgumentFormatter.Format(current), ex));
1616
+ }
1617
+ num++;
1618
+ }
1619
+ }
1620
+ finally
1621
+ {
1622
+ ((System.IDisposable)enumerator)?.Dispose();
1623
+ }
1624
+ if (val.Count > 0)
1625
+ {
1626
+ throw AllException.ForFailures(num, (System.Collections.Generic.IReadOnlyList<Tuple<int, string, System.Exception>>)val);
1627
+ }
1628
+ }
1629
+ [AsyncStateMachine(typeof(<AllAsync>d__44<>))]
1630
+ public static System.Threading.Tasks.Task AllAsync<T>(System.Collections.Generic.IEnumerable<T> collection, Func<T, System.Threading.Tasks.Task> action)
1631
+ {
1632
+ <AllAsync>d__44<T> <AllAsync>d__ = default(<AllAsync>d__44<T>);
1633
+ <AllAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
1634
+ <AllAsync>d__.collection = collection;
1635
+ <AllAsync>d__.action = action;
1636
+ <AllAsync>d__.<>1__state = -1;
1637
+ ((AsyncTaskMethodBuilder)(ref <AllAsync>d__.<>t__builder)).Start<<AllAsync>d__44<T>>(ref <AllAsync>d__);
1638
+ return ((AsyncTaskMethodBuilder)(ref <AllAsync>d__.<>t__builder)).Task;
1639
+ }
1640
+ [AsyncStateMachine(typeof(<AllAsync>d__45<>))]
1641
+ public static System.Threading.Tasks.Task AllAsync<T>(System.Collections.Generic.IEnumerable<T> collection, Func<T, int, System.Threading.Tasks.Task> action)
1642
+ {
1643
+ <AllAsync>d__45<T> <AllAsync>d__ = default(<AllAsync>d__45<T>);
1644
+ <AllAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
1645
+ <AllAsync>d__.collection = collection;
1646
+ <AllAsync>d__.action = action;
1647
+ <AllAsync>d__.<>1__state = -1;
1648
+ ((AsyncTaskMethodBuilder)(ref <AllAsync>d__.<>t__builder)).Start<<AllAsync>d__45<T>>(ref <AllAsync>d__);
1649
+ return ((AsyncTaskMethodBuilder)(ref <AllAsync>d__.<>t__builder)).Task;
1650
+ }
1651
+ public static void Collection<T>(System.Collections.Generic.IEnumerable<T> collection, params Action<T>[] elementInspectors)
1652
+ {
1653
+ GuardArgumentNotNull("collection", collection);
1654
+ GuardArgumentNotNull("elementInspectors", elementInspectors);
1655
+ using CollectionTracker<T> collectionTracker = collection.AsTracker();
1656
+ int num = 0;
1657
+ System.Collections.Generic.IEnumerator<T> enumerator = collectionTracker.GetEnumerator();
1658
+ try
1659
+ {
1660
+ while (((System.Collections.IEnumerator)enumerator).MoveNext())
1661
+ {
1662
+ T current = enumerator.Current;
1663
+ try
1664
+ {
1665
+ if (num < elementInspectors.Length)
1666
+ {
1667
+ elementInspectors[num].Invoke(current);
1668
+ }
1669
+ }
1670
+ catch (System.Exception exception)
1671
+ {
1672
+ int? pointerIndent;
1673
+ throw CollectionException.ForMismatchedItem(formattedCollection: collectionTracker.FormatIndexedMismatch(num, out pointerIndent), exception: exception, indexFailurePoint: num, failurePointerIndent: pointerIndent);
1674
+ }
1675
+ num++;
1676
+ }
1677
+ }
1678
+ finally
1679
+ {
1680
+ ((System.IDisposable)enumerator)?.Dispose();
1681
+ }
1682
+ if (collectionTracker.IterationCount != elementInspectors.Length)
1683
+ {
1684
+ throw CollectionException.ForMismatchedItemCount(elementInspectors.Length, collectionTracker.IterationCount, collectionTracker.FormatStart());
1685
+ }
1686
+ }
1687
+ [AsyncStateMachine(typeof(<CollectionAsync>d__47<>))]
1688
+ public static System.Threading.Tasks.Task CollectionAsync<T>(System.Collections.Generic.IEnumerable<T> collection, params Func<T, System.Threading.Tasks.Task>[] elementInspectors)
1689
+ {
1690
+ <CollectionAsync>d__47<T> <CollectionAsync>d__ = default(<CollectionAsync>d__47<T>);
1691
+ <CollectionAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
1692
+ <CollectionAsync>d__.collection = collection;
1693
+ <CollectionAsync>d__.elementInspectors = elementInspectors;
1694
+ <CollectionAsync>d__.<>1__state = -1;
1695
+ ((AsyncTaskMethodBuilder)(ref <CollectionAsync>d__.<>t__builder)).Start<<CollectionAsync>d__47<T>>(ref <CollectionAsync>d__);
1696
+ return ((AsyncTaskMethodBuilder)(ref <CollectionAsync>d__.<>t__builder)).Task;
1697
+ }
1698
+ public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection)
1699
+ {
1700
+ GuardArgumentNotNull("collection", collection);
1701
+ if (collection is ISet<T> set)
1702
+ {
1703
+ Contains(expected, set);
1704
+ }
1705
+ else if (collection is IReadOnlySet<T> set2)
1706
+ {
1707
+ Contains(expected, set2);
1708
+ }
1709
+ else
1710
+ {
1711
+ Contains(expected, collection, GetEqualityComparer<T>());
1712
+ }
1713
+ }
1714
+ public static void Contains<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, IEqualityComparer<T> comparer)
1715
+ {
1716
+ GuardArgumentNotNull("collection", collection);
1717
+ GuardArgumentNotNull<IEqualityComparer<T>>("comparer", comparer);
1718
+ using CollectionTracker<T> collectionTracker = collection.AsTracker();
1719
+ if (!Enumerable.Contains<T>((System.Collections.Generic.IEnumerable<T>)collectionTracker, expected, comparer))
1720
+ {
1721
+ throw ContainsException.ForCollectionItemNotFound(ArgumentFormatter.Format(expected), collectionTracker.FormatStart());
1722
+ }
1723
+ }
1724
+ public static void Contains<T>(System.Collections.Generic.IEnumerable<T> collection, Predicate<T> filter)
1725
+ {
1726
+ GuardArgumentNotNull("collection", collection);
1727
+ GuardArgumentNotNull<Predicate<T>>("filter", filter);
1728
+ using CollectionTracker<T> collectionTracker = collection.AsTracker();
1729
+ System.Collections.Generic.IEnumerator<T> enumerator = collectionTracker.GetEnumerator();
1730
+ try
1731
+ {
1732
+ while (((System.Collections.IEnumerator)enumerator).MoveNext())
1733
+ {
1734
+ T current = enumerator.Current;
1735
+ if (filter.Invoke(current))
1736
+ {
1737
+ return;
1738
+ }
1739
+ }
1740
+ }
1741
+ finally
1742
+ {
1743
+ ((System.IDisposable)enumerator)?.Dispose();
1744
+ }
1745
+ throw ContainsException.ForCollectionFilterNotMatched(collectionTracker.FormatStart());
1746
+ }
1747
+ public static void Distinct<T>(System.Collections.Generic.IEnumerable<T> collection)
1748
+ {
1749
+ Distinct(collection, (IEqualityComparer<T>)(object)EqualityComparer<T>.Default);
1750
+ }
1751
+ public static void Distinct<T>(System.Collections.Generic.IEnumerable<T> collection, IEqualityComparer<T> comparer)
1752
+ {
1753
+ GuardArgumentNotNull("collection", collection);
1754
+ GuardArgumentNotNull<IEqualityComparer<T>>("comparer", comparer);
1755
+ using CollectionTracker<T> collectionTracker = collection.AsTracker();
1756
+ HashSet<T> val = new HashSet<T>(comparer);
1757
+ System.Collections.Generic.IEnumerator<T> enumerator = collectionTracker.GetEnumerator();
1758
+ try
1759
+ {
1760
+ while (((System.Collections.IEnumerator)enumerator).MoveNext())
1761
+ {
1762
+ T current = enumerator.Current;
1763
+ if (!val.Add(current))
1764
+ {
1765
+ throw DistinctException.ForDuplicateItem(ArgumentFormatter.Format(current), collectionTracker.FormatStart());
1766
+ }
1767
+ }
1768
+ }
1769
+ finally
1770
+ {
1771
+ ((System.IDisposable)enumerator)?.Dispose();
1772
+ }
1773
+ }
1774
+ public static void DoesNotContain<T>(T expected, System.Collections.Generic.IEnumerable<T> collection)
1775
+ {
1776
+ GuardArgumentNotNull("collection", collection);
1777
+ if (collection is ISet<T> set)
1778
+ {
1779
+ DoesNotContain(expected, set);
1780
+ }
1781
+ else if (collection is IReadOnlySet<T> set2)
1782
+ {
1783
+ DoesNotContain(expected, set2);
1784
+ }
1785
+ else
1786
+ {
1787
+ DoesNotContain(expected, collection, GetEqualityComparer<T>());
1788
+ }
1789
+ }
1790
+ public static void DoesNotContain<T>(T expected, System.Collections.Generic.IEnumerable<T> collection, IEqualityComparer<T> comparer)
1791
+ {
1792
+ GuardArgumentNotNull("collection", collection);
1793
+ GuardArgumentNotNull<IEqualityComparer<T>>("comparer", comparer);
1794
+ using CollectionTracker<T> collectionTracker = collection.AsTracker();
1795
+ int num = 0;
1796
+ System.Collections.Generic.IEnumerator<T> enumerator = collectionTracker.GetEnumerator();
1797
+ try
1798
+ {
1799
+ while (((System.Collections.IEnumerator)enumerator).MoveNext())
1800
+ {
1801
+ T current = enumerator.Current;
1802
+ if (comparer.Equals(current, expected))
1803
+ {
1804
+ int? pointerIndent;
1805
+ string collection2 = collectionTracker.FormatIndexedMismatch(num, out pointerIndent);
1806
+ throw DoesNotContainException.ForCollectionItemFound(ArgumentFormatter.Format(expected), num, pointerIndent, collection2);
1807
+ }
1808
+ num++;
1809
+ }
1810
+ }
1811
+ finally
1812
+ {
1813
+ ((System.IDisposable)enumerator)?.Dispose();
1814
+ }
1815
+ }
1816
+ public static void DoesNotContain<T>(System.Collections.Generic.IEnumerable<T> collection, Predicate<T> filter)
1817
+ {
1818
+ GuardArgumentNotNull("collection", collection);
1819
+ GuardArgumentNotNull<Predicate<T>>("filter", filter);
1820
+ using CollectionTracker<T> collectionTracker = collection.AsTracker();
1821
+ int num = 0;
1822
+ System.Collections.Generic.IEnumerator<T> enumerator = collectionTracker.GetEnumerator();
1823
+ try
1824
+ {
1825
+ while (((System.Collections.IEnumerator)enumerator).MoveNext())
1826
+ {
1827
+ T current = enumerator.Current;
1828
+ if (filter.Invoke(current))
1829
+ {
1830
+ int? pointerIndent;
1831
+ string collection2 = collectionTracker.FormatIndexedMismatch(num, out pointerIndent);
1832
+ throw DoesNotContainException.ForCollectionFilterMatched(num, pointerIndent, collection2);
1833
+ }
1834
+ num++;
1835
+ }
1836
+ }
1837
+ finally
1838
+ {
1839
+ ((System.IDisposable)enumerator)?.Dispose();
1840
+ }
1841
+ }
1842
+ public static void Empty(System.Collections.IEnumerable collection)
1843
+ {
1844
+ GuardArgumentNotNull("collection", collection);
1845
+ using CollectionTracker collectionTracker = collection.AsTracker();
1846
+ if (collectionTracker.GetEnumerator().MoveNext())
1847
+ {
1848
+ throw EmptyException.ForNonEmptyCollection(collectionTracker.FormatStart());
1849
+ }
1850
+ }
1851
+ public static void Equal<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IEnumerable<T>? actual)
1852
+ {
1853
+ Assert.Equal<System.Collections.Generic.IEnumerable<T>>(expected, actual, GetEqualityComparer<System.Collections.Generic.IEnumerable<T>>());
1854
+ }
1855
+ public static void Equal<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IEnumerable<T>? actual, IEqualityComparer<T> comparer)
1856
+ {
1857
+ Assert.Equal<System.Collections.Generic.IEnumerable<T>>(expected, actual, GetEqualityComparer<System.Collections.Generic.IEnumerable<T>>((IEqualityComparer?)(object)new AssertEqualityComparerAdapter<T>(comparer)));
1858
+ }
1859
+ public static void Equal<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IEnumerable<T>? actual, Func<T, T, bool> comparer)
1860
+ {
1861
+ Equal(expected, actual, AssertEqualityComparer<T>.FromComparer(comparer));
1862
+ }
1863
+ public static void NotEmpty(System.Collections.IEnumerable collection)
1864
+ {
1865
+ GuardArgumentNotNull("collection", collection);
1866
+ System.Collections.IEnumerator enumerator = collection.GetEnumerator();
1867
+ try
1868
+ {
1869
+ if (!enumerator.MoveNext())
1870
+ {
1871
+ throw NotEmptyException.ForNonEmptyCollection();
1872
+ }
1873
+ }
1874
+ finally
1875
+ {
1876
+ System.IDisposable disposable = enumerator as System.IDisposable;
1877
+ if (disposable != null)
1878
+ {
1879
+ disposable.Dispose();
1880
+ }
1881
+ }
1882
+ }
1883
+ public static void NotEqual<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IEnumerable<T>? actual)
1884
+ {
1885
+ Assert.NotEqual<System.Collections.Generic.IEnumerable<T>>(expected, actual, GetEqualityComparer<System.Collections.Generic.IEnumerable<T>>());
1886
+ }
1887
+ public static void NotEqual<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IEnumerable<T>? actual, IEqualityComparer<T> comparer)
1888
+ {
1889
+ Assert.NotEqual<System.Collections.Generic.IEnumerable<T>>(expected, actual, GetEqualityComparer<System.Collections.Generic.IEnumerable<T>>((IEqualityComparer?)(object)new AssertEqualityComparerAdapter<T>(comparer)));
1890
+ }
1891
+ public static void NotEqual<T>(System.Collections.Generic.IEnumerable<T>? expected, System.Collections.Generic.IEnumerable<T>? actual, Func<T, T, bool> comparer)
1892
+ {
1893
+ NotEqual(expected, actual, AssertEqualityComparer<T>.FromComparer(comparer));
1894
+ }
1895
+ public static object? Single(System.Collections.IEnumerable collection)
1896
+ {
1897
+ GuardArgumentNotNull("collection", collection);
1898
+ return Single(Enumerable.Cast<object>(collection));
1899
+ }
1900
+ public static void Single(System.Collections.IEnumerable collection, object? expected)
1901
+ {
1902
+ GuardArgumentNotNull("collection", collection);
1903
+ GetSingleResult(Enumerable.Cast<object>(collection), (object item) => object.Equals(item, expected), ArgumentFormatter.Format(expected));
1904
+ }
1905
+ public static T Single<T>(System.Collections.Generic.IEnumerable<T> collection)
1906
+ {
1907
+ GuardArgumentNotNull("collection", collection);
1908
+ return GetSingleResult(collection, null, null);
1909
+ }
1910
+ public static T Single<T>(System.Collections.Generic.IEnumerable<T> collection, Predicate<T> predicate)
1911
+ {
1912
+ GuardArgumentNotNull("collection", collection);
1913
+ GuardArgumentNotNull<Predicate<T>>("predicate", predicate);
1914
+ return GetSingleResult(collection, predicate, "(predicate expression)");
1915
+ }
1916
+ private static T GetSingleResult<T>(System.Collections.Generic.IEnumerable<T> collection, Predicate<T>? predicate, string? expected)
1917
+ {
1918
+ int num = 0;
1919
+ int num2 = 0;
1920
+ List<int> val = new List<int>();
1921
+ T val2 = default(T);
1922
+ using CollectionTracker<T> collectionTracker = collection.AsTracker();
1923
+ System.Collections.Generic.IEnumerator<T> enumerator = collectionTracker.GetEnumerator();
1924
+ try
1925
+ {
1926
+ while (((System.Collections.IEnumerator)enumerator).MoveNext())
1927
+ {
1928
+ T current = enumerator.Current;
1929
+ if (predicate == null || predicate.Invoke(current))
1930
+ {
1931
+ if (++num == 1)
1932
+ {
1933
+ val2 = current;
1934
+ }
1935
+ if (predicate != null)
1936
+ {
1937
+ val.Add(num2);
1938
+ }
1939
+ }
1940
+ num2++;
1941
+ }
1942
+ }
1943
+ finally
1944
+ {
1945
+ ((System.IDisposable)enumerator)?.Dispose();
1946
+ }
1947
+ return num switch
1948
+ {
1949
+ 0 => throw SingleException.Empty(expected, collectionTracker.FormatStart()),
1950
+ 1 => val2,
1951
+ _ => throw SingleException.MoreThanOne(num, expected, collectionTracker.FormatStart(), (System.Collections.Generic.ICollection<int>)val),
1952
+ };
1953
+ }
1954
+ private static IEqualityComparer<T?> GetEqualityComparer<T>(IEqualityComparer? innerComparer = null)
1955
+ {
1956
+ return (IEqualityComparer<T?>)(object)new AssertEqualityComparer<T>(innerComparer);
1957
+ }
1958
+ private static IComparer<T> GetRangeComparer<T>() where T : IComparable
1959
+ {
1960
+ return (IComparer<T>)(object)new AssertRangeComparer<T>();
1961
+ }
1962
+ public static TValue Contains<TKey, TValue>(TKey expected, IDictionary<TKey, TValue> collection) where TKey : notnull
1963
+ {
1964
+ GuardArgumentNotNull("expected", expected);
1965
+ GuardArgumentNotNull<IDictionary<TKey, TValue>>("collection", collection);
1966
+ TValue result = default(TValue);
1967
+ if (!collection.TryGetValue(expected, ref result))
1968
+ {
1969
+ throw ContainsException.ForKeyNotFound(ArgumentFormatter.Format(expected), CollectionTracker<TKey>.FormatStart((System.Collections.Generic.IEnumerable<TKey>)collection.Keys));
1970
+ }
1971
+ return result;
1972
+ }
1973
+ public static TValue Contains<TKey, TValue>(TKey expected, IReadOnlyDictionary<TKey, TValue> collection) where TKey : notnull
1974
+ {
1975
+ GuardArgumentNotNull("expected", expected);
1976
+ GuardArgumentNotNull<IReadOnlyDictionary<TKey, TValue>>("collection", collection);
1977
+ TValue result = default(TValue);
1978
+ if (!collection.TryGetValue(expected, ref result))
1979
+ {
1980
+ throw ContainsException.ForKeyNotFound(ArgumentFormatter.Format(expected), CollectionTracker<TKey>.FormatStart(collection.Keys));
1981
+ }
1982
+ return result;
1983
+ }
1984
+ public static TValue Contains<TKey, TValue>(TKey expected, ConcurrentDictionary<TKey, TValue> collection) where TKey : notnull
1985
+ {
1986
+ return Contains<TKey, TValue>(expected, (IReadOnlyDictionary<TKey, TValue>)(object)collection);
1987
+ }
1988
+ public static TValue Contains<TKey, TValue>(TKey expected, Dictionary<TKey, TValue> collection) where TKey : notnull
1989
+ {
1990
+ return Contains<TKey, TValue>(expected, (IReadOnlyDictionary<TKey, TValue>)(object)collection);
1991
+ }
1992
+ public static TValue Contains<TKey, TValue>(TKey expected, ReadOnlyDictionary<TKey, TValue> collection) where TKey : notnull
1993
+ {
1994
+ return Contains<TKey, TValue>(expected, (IReadOnlyDictionary<TKey, TValue>)(object)collection);
1995
+ }
1996
+ public static TValue Contains<TKey, TValue>(TKey expected, ImmutableDictionary<TKey, TValue> collection) where TKey : notnull
1997
+ {
1998
+ return Contains<TKey, TValue>(expected, (IReadOnlyDictionary<TKey, TValue>)(object)collection);
1999
+ }
2000
+ public static void DoesNotContain<TKey, TValue>(TKey expected, IDictionary<TKey, TValue> collection) where TKey : notnull
2001
+ {
2002
+ GuardArgumentNotNull("expected", expected);
2003
+ GuardArgumentNotNull<IDictionary<TKey, TValue>>("collection", collection);
2004
+ if (collection.ContainsKey(expected))
2005
+ {
2006
+ throw DoesNotContainException.ForKeyFound(ArgumentFormatter.Format(expected), CollectionTracker<TKey>.FormatStart((System.Collections.Generic.IEnumerable<TKey>)collection.Keys));
2007
+ }
2008
+ }
2009
+ public static void DoesNotContain<TKey, TValue>(TKey expected, IReadOnlyDictionary<TKey, TValue> collection) where TKey : notnull
2010
+ {
2011
+ GuardArgumentNotNull("expected", expected);
2012
+ GuardArgumentNotNull<IReadOnlyDictionary<TKey, TValue>>("collection", collection);
2013
+ if (collection.ContainsKey(expected))
2014
+ {
2015
+ throw DoesNotContainException.ForKeyFound(ArgumentFormatter.Format(expected), CollectionTracker<TKey>.FormatStart(collection.Keys));
2016
+ }
2017
+ }
2018
+ public static void DoesNotContain<TKey, TValue>(TKey expected, ConcurrentDictionary<TKey, TValue> collection) where TKey : notnull
2019
+ {
2020
+ DoesNotContain<TKey, TValue>(expected, (IReadOnlyDictionary<TKey, TValue>)(object)collection);
2021
+ }
2022
+ public static void DoesNotContain<TKey, TValue>(TKey expected, Dictionary<TKey, TValue> collection) where TKey : notnull
2023
+ {
2024
+ DoesNotContain<TKey, TValue>(expected, (IReadOnlyDictionary<TKey, TValue>)(object)collection);
2025
+ }
2026
+ public static void DoesNotContain<TKey, TValue>(TKey expected, ReadOnlyDictionary<TKey, TValue> collection) where TKey : notnull
2027
+ {
2028
+ DoesNotContain<TKey, TValue>(expected, (IReadOnlyDictionary<TKey, TValue>)(object)collection);
2029
+ }
2030
+ public static void DoesNotContain<TKey, TValue>(TKey expected, ImmutableDictionary<TKey, TValue> collection) where TKey : notnull
2031
+ {
2032
+ DoesNotContain<TKey, TValue>(expected, (IReadOnlyDictionary<TKey, TValue>)(object)collection);
2033
+ }
2034
+ public static void Equal<T>([AllowNull] T[] expected, [AllowNull] T[] actual) where T : unmanaged, IEquatable<T>
2035
+ {
2036
+ if ((expected != null || actual != null) && (expected == null || actual == null || !MemoryExtensions.SequenceEqual<T>(MemoryExtensions.AsSpan<T>(expected), System.ReadOnlySpan<T>.op_Implicit(actual))))
2037
+ {
2038
+ Equal((object)expected, (object)actual);
2039
+ }
2040
+ }
2041
+ public static void Equal<T>([AllowNull] T expected, [AllowNull] T actual)
2042
+ {
2043
+ Equal(expected, actual, GetEqualityComparer<T>());
2044
+ }
2045
+ public static void Equal<T>([AllowNull] T expected, [AllowNull] T actual, Func<T, T, bool> comparer)
2046
+ {
2047
+ Equal(expected, actual, AssertEqualityComparer<T>.FromComparer(comparer));
2048
+ }
2049
+ public static void Equal<T>([AllowNull] T expected, [AllowNull] T actual, IEqualityComparer<T> comparer)
2050
+ {
2051
+ GuardArgumentNotNull<IEqualityComparer<T>>("comparer", comparer);
2052
+ if (expected == null && actual == null)
2053
+ {
2054
+ return;
2055
+ }
2056
+ CollectionTracker collectionTracker = expected.AsNonStringTracker();
2057
+ CollectionTracker collectionTracker2 = actual.AsNonStringTracker();
2058
+ System.Exception error = null;
2059
+ try
2060
+ {
2061
+ if ((collectionTracker == null || collectionTracker2 == null) && (collectionTracker == null || actual != null) && (expected != null || collectionTracker2 == null))
2062
+ {
2063
+ try
2064
+ {
2065
+ if (comparer.Equals(expected, actual))
2066
+ {
2067
+ return;
2068
+ }
2069
+ }
2070
+ catch (System.Exception ex)
2071
+ {
2072
+ error = ex;
2073
+ }
2074
+ throw EqualException.ForMismatchedValuesWithError(expected, actual, error);
2075
+ }
2076
+ int? mismatchedIndex = null;
2077
+ IEqualityComparer val = null;
2078
+ AssertEqualityComparer<T> assertEqualityComparer = comparer as AssertEqualityComparer<T>;
2079
+ if (assertEqualityComparer != null)
2080
+ {
2081
+ val = assertEqualityComparer.InnerComparer;
2082
+ }
2083
+ else if ((object)comparer == EqualityComparer<T>.Default)
2084
+ {
2085
+ val = (IEqualityComparer)(object)EqualityComparer<object>.Default;
2086
+ }
2087
+ int? pointerIndent = null;
2088
+ int? pointerIndent2 = null;
2089
+ string expectedType = null;
2090
+ string actualType = null;
2091
+ string text;
2092
+ string text2;
2093
+ if (val != null)
2094
+ {
2095
+ try
2096
+ {
2097
+ if (assertEqualityComparer?.Equals(expected, collectionTracker, actual, collectionTracker2, out mismatchedIndex) ?? CollectionTracker.AreCollectionsEqual(collectionTracker, collectionTracker2, val, val == AssertEqualityComparer<T>.DefaultInnerComparer, out mismatchedIndex))
2098
+ {
2099
+ return;
2100
+ }
2101
+ }
2102
+ catch (System.Exception ex2)
2103
+ {
2104
+ error = ex2;
2105
+ }
2106
+ int startIndex = -1;
2107
+ int endIndex = -1;
2108
+ collectionTracker?.GetMismatchExtents(mismatchedIndex, out startIndex, out endIndex);
2109
+ int startIndex2 = -1;
2110
+ int endIndex2 = -1;
2111
+ collectionTracker2?.GetMismatchExtents(mismatchedIndex, out startIndex2, out endIndex2);
2112
+ if (mismatchedIndex.HasValue)
2113
+ {
2114
+ if (startIndex > -1 && endIndex < mismatchedIndex.Value)
2115
+ {
2116
+ startIndex = startIndex2;
2117
+ }
2118
+ else if (startIndex2 > -1 && endIndex2 < mismatchedIndex.Value)
2119
+ {
2120
+ startIndex2 = startIndex;
2121
+ }
2122
+ }
2123
+ pointerIndent = null;
2124
+ text = collectionTracker?.FormatIndexedMismatch(startIndex, endIndex, mismatchedIndex, out pointerIndent) ?? ArgumentFormatter.Format(expected);
2125
+ expectedType = collectionTracker?.TypeAt(mismatchedIndex);
2126
+ pointerIndent2 = null;
2127
+ text2 = collectionTracker2?.FormatIndexedMismatch(startIndex2, endIndex2, mismatchedIndex, out pointerIndent2) ?? ArgumentFormatter.Format(actual);
2128
+ actualType = collectionTracker2?.TypeAt(mismatchedIndex);
2129
+ }
2130
+ else
2131
+ {
2132
+ try
2133
+ {
2134
+ if (comparer.Equals(expected, actual))
2135
+ {
2136
+ return;
2137
+ }
2138
+ }
2139
+ catch (System.Exception ex3)
2140
+ {
2141
+ error = ex3;
2142
+ }
2143
+ text = ArgumentFormatter.Format(expected);
2144
+ text2 = ArgumentFormatter.Format(actual);
2145
+ }
2146
+ string collectionDisplay = null;
2147
+ ref T reference = ref expected;
2148
+ T val2 = default(T);
2149
+ object obj;
2150
+ if (val2 == null)
2151
+ {
2152
+ val2 = reference;
2153
+ reference = ref val2;
2154
+ if (val2 == null)
2155
+ {
2156
+ obj = null;
2157
+ goto IL_024a;
2158
+ }
2159
+ }
2160
+ obj = ((object)reference/*cast due to .constrained prefix*/).GetType();
2161
+ goto IL_024a;
2162
+ IL_024a:
2163
+ System.Type type = (System.Type)obj;
2164
+ System.Type type2 = SafeGetGenericTypeDefinition(type);
2165
+ System.Collections.Generic.IEnumerable<System.Type> enumerable = ((type != null) ? Enumerable.Select<System.Type, System.Type>(Enumerable.Where<System.Type>(IntrospectionExtensions.GetTypeInfo(type).ImplementedInterfaces, (Func<System.Type, bool>)((System.Type i) => ((System.Type)(object)IntrospectionExtensions.GetTypeInfo(i)).IsGenericType)), (Func<System.Type, System.Type>)((System.Type i) => i.GetGenericTypeDefinition())) : null);
2166
+ ref T reference2 = ref actual;
2167
+ val2 = default(T);
2168
+ object obj2;
2169
+ if (val2 == null)
2170
+ {
2171
+ val2 = reference2;
2172
+ reference2 = ref val2;
2173
+ if (val2 == null)
2174
+ {
2175
+ obj2 = null;
2176
+ goto IL_02e6;
2177
+ }
2178
+ }
2179
+ obj2 = ((object)reference2/*cast due to .constrained prefix*/).GetType();
2180
+ goto IL_02e6;
2181
+ IL_02e6:
2182
+ System.Type type3 = (System.Type)obj2;
2183
+ System.Type type4 = SafeGetGenericTypeDefinition(type3);
2184
+ System.Collections.Generic.IEnumerable<System.Type> enumerable2 = ((type3 != null) ? Enumerable.Select<System.Type, System.Type>(Enumerable.Where<System.Type>(IntrospectionExtensions.GetTypeInfo(type3).ImplementedInterfaces, (Func<System.Type, bool>)((System.Type i) => ((System.Type)(object)IntrospectionExtensions.GetTypeInfo(i)).IsGenericType)), (Func<System.Type, System.Type>)((System.Type i) => i.GetGenericTypeDefinition())) : null);
2185
+ if (type2 == typeofDictionary && type4 == typeofDictionary)
2186
+ {
2187
+ collectionDisplay = "Dictionaries";
2188
+ }
2189
+ else if (type2 == typeofHashSet && type4 == typeofHashSet)
2190
+ {
2191
+ collectionDisplay = "HashSets";
2192
+ }
2193
+ else if (enumerable != null && enumerable2 != null && Enumerable.Contains<System.Type>(enumerable, typeofSet) && Enumerable.Contains<System.Type>(enumerable2, typeofSet))
2194
+ {
2195
+ collectionDisplay = "Sets";
2196
+ }
2197
+ if (type != type3)
2198
+ {
2199
+ string obj3 = ((type == (System.Type)null) ? "" : (AssertHelper.IsCompilerGenerated(type) ? "<generated> " : (ArgumentFormatter.FormatTypeName(type) + " ")));
2200
+ string text3 = ((type3 == (System.Type)null) ? "" : (AssertHelper.IsCompilerGenerated(type3) ? "<generated> " : (ArgumentFormatter.FormatTypeName(type3) + " ")));
2201
+ int num = Math.Max(obj3.Length, text3.Length);
2202
+ text = obj3.PadRight(num) + text;
2203
+ text2 = text3.PadRight(num) + text2;
2204
+ if (pointerIndent.HasValue)
2205
+ {
2206
+ pointerIndent += num;
2207
+ }
2208
+ if (pointerIndent2.HasValue)
2209
+ {
2210
+ pointerIndent2 += num;
2211
+ }
2212
+ }
2213
+ throw EqualException.ForMismatchedCollectionsWithError(mismatchedIndex, text, pointerIndent, expectedType, text2, pointerIndent2, actualType, error, collectionDisplay);
2214
+ }
2215
+ finally
2216
+ {
2217
+ collectionTracker?.Dispose();
2218
+ collectionTracker2?.Dispose();
2219
+ }
2220
+ }
2221
+ public static void Equal(double expected, double actual, int precision)
2222
+ {
2223
+ double num = Math.Round(expected, precision);
2224
+ double num2 = Math.Round(actual, precision);
2225
+ if (!object.Equals((object)num, (object)num2))
2226
+ {
2227
+ throw EqualException.ForMismatchedValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G17} (rounded from {1:G17})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G17} (rounded from {1:G17})", (object)num2, (object)actual), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are not within {0} decimal place{1}", (object)precision, (object)((precision == 1) ? "" : "s")));
2228
+ }
2229
+ }
2230
+ public static void Equal(double expected, double actual, int precision, MidpointRounding rounding)
2231
+ {
2232
+ double num = Math.Round(expected, precision, rounding);
2233
+ double num2 = Math.Round(actual, precision, rounding);
2234
+ if (!object.Equals((object)num, (object)num2))
2235
+ {
2236
+ throw EqualException.ForMismatchedValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G17} (rounded from {1:G17})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G17} (rounded from {1:G17})", (object)num2, (object)actual), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are not within {0} decimal place{1}", (object)precision, (object)((precision == 1) ? "" : "s")));
2237
+ }
2238
+ }
2239
+ public static void Equal(double expected, double actual, double tolerance)
2240
+ {
2241
+ if (double.IsNaN(tolerance) || double.IsNegativeInfinity(tolerance) || tolerance < 0.0)
2242
+ {
2243
+ throw new ArgumentException("Tolerance must be greater than or equal to zero", "tolerance");
2244
+ }
2245
+ if (!object.Equals((object)expected, (object)actual) && !(Math.Abs(expected - actual) <= tolerance))
2246
+ {
2247
+ throw EqualException.ForMismatchedValues(expected.ToString("G17", (IFormatProvider)(object)CultureInfo.CurrentCulture), actual.ToString("G17", (IFormatProvider)(object)CultureInfo.CurrentCulture), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are not within tolerance {0:G17}", (object)tolerance));
2248
+ }
2249
+ }
2250
+ public static void Equal(float expected, float actual, int precision)
2251
+ {
2252
+ double num = Math.Round((double)expected, precision);
2253
+ double num2 = Math.Round((double)actual, precision);
2254
+ if (!object.Equals((object)num, (object)num2))
2255
+ {
2256
+ throw EqualException.ForMismatchedValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G9} (rounded from {1:G9})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G9} (rounded from {1:G9})", (object)num2, (object)actual), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are not within {0} decimal place{1}", (object)precision, (object)((precision == 1) ? "" : "s")));
2257
+ }
2258
+ }
2259
+ public static void Equal(float expected, float actual, int precision, MidpointRounding rounding)
2260
+ {
2261
+ double num = Math.Round((double)expected, precision, rounding);
2262
+ double num2 = Math.Round((double)actual, precision, rounding);
2263
+ if (!object.Equals((object)num, (object)num2))
2264
+ {
2265
+ throw EqualException.ForMismatchedValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G9} (rounded from {1:G9})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G9} (rounded from {1:G9})", (object)num2, (object)actual), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are not within {0} decimal place{1}", (object)precision, (object)((precision == 1) ? "" : "s")));
2266
+ }
2267
+ }
2268
+ public static void Equal(float expected, float actual, float tolerance)
2269
+ {
2270
+ if (float.IsNaN(tolerance) || float.IsNegativeInfinity(tolerance) || (double)tolerance < 0.0)
2271
+ {
2272
+ throw new ArgumentException("Tolerance must be greater than or equal to zero", "tolerance");
2273
+ }
2274
+ if (!object.Equals((object)expected, (object)actual) && !(Math.Abs(expected - actual) <= tolerance))
2275
+ {
2276
+ throw EqualException.ForMismatchedValues(expected.ToString("G9", (IFormatProvider)(object)CultureInfo.CurrentCulture), actual.ToString("G9", (IFormatProvider)(object)CultureInfo.CurrentCulture), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are not within tolerance {0:G9}", (object)tolerance));
2277
+ }
2278
+ }
2279
+ public static void Equal(decimal expected, decimal actual, int precision)
2280
+ {
2281
+ decimal num = Math.Round(expected, precision);
2282
+ decimal num2 = Math.Round(actual, precision);
2283
+ if (num != num2)
2284
+ {
2285
+ throw EqualException.ForMismatchedValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0} (rounded from {1})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0} (rounded from {1})", (object)num2, (object)actual));
2286
+ }
2287
+ }
2288
+ public static void Equal(System.DateTime expected, System.DateTime actual)
2289
+ {
2290
+ Equal(expected, actual, TimeSpan.Zero);
2291
+ }
2292
+ public static void Equal(System.DateTime expected, System.DateTime actual, TimeSpan precision)
2293
+ {
2294
+ TimeSpan val = expected - actual;
2295
+ TimeSpan val2 = ((TimeSpan)(ref val)).Duration();
2296
+ if (val2 > precision)
2297
+ {
2298
+ string actual2 = ArgumentFormatter.Format(actual) + ((precision == TimeSpan.Zero) ? "" : string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, " (difference {0} is larger than {1})", (object)val2, (object)precision));
2299
+ throw EqualException.ForMismatchedValues(expected, actual2);
2300
+ }
2301
+ }
2302
+ public static void Equal(DateTimeOffset expected, DateTimeOffset actual)
2303
+ {
2304
+ Equal(expected, actual, TimeSpan.Zero);
2305
+ }
2306
+ public static void Equal(DateTimeOffset expected, DateTimeOffset actual, TimeSpan precision)
2307
+ {
2308
+ TimeSpan val = expected - actual;
2309
+ TimeSpan val2 = ((TimeSpan)(ref val)).Duration();
2310
+ if (val2 > precision)
2311
+ {
2312
+ string actual2 = ArgumentFormatter.Format(actual) + ((precision == TimeSpan.Zero) ? "" : string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, " (difference {0} is larger than {1})", (object)val2, (object)precision));
2313
+ throw EqualException.ForMismatchedValues(expected, actual2);
2314
+ }
2315
+ }
2316
+ public static void NotEqual<T>([AllowNull] T[] expected, [AllowNull] T[] actual) where T : unmanaged, IEquatable<T>
2317
+ {
2318
+ if (expected == null && actual == null)
2319
+ {
2320
+ NotEqual((object)expected, (object)actual);
2321
+ }
2322
+ if (expected != null && actual != null && MemoryExtensions.SequenceEqual<T>(MemoryExtensions.AsSpan<T>(expected), System.ReadOnlySpan<T>.op_Implicit(actual)))
2323
+ {
2324
+ NotEqual((object)expected, (object)actual);
2325
+ }
2326
+ }
2327
+ public static void NotEqual<T>([AllowNull] T expected, [AllowNull] T actual)
2328
+ {
2329
+ NotEqual(expected, actual, GetEqualityComparer<T>());
2330
+ }
2331
+ public static void NotEqual<T>([AllowNull] T expected, [AllowNull] T actual, Func<T, T, bool> comparer)
2332
+ {
2333
+ NotEqual(expected, actual, AssertEqualityComparer<T>.FromComparer(comparer));
2334
+ }
2335
+ public static void NotEqual<T>([AllowNull] T expected, [AllowNull] T actual, IEqualityComparer<T> comparer)
2336
+ {
2337
+ GuardArgumentNotNull<IEqualityComparer<T>>("comparer", comparer);
2338
+ CollectionTracker collectionTracker = expected.AsNonStringTracker();
2339
+ CollectionTracker collectionTracker2 = actual.AsNonStringTracker();
2340
+ System.Exception error = null;
2341
+ try
2342
+ {
2343
+ if ((collectionTracker == null || collectionTracker2 == null) && (collectionTracker == null || actual != null) && (expected != null || collectionTracker2 == null))
2344
+ {
2345
+ try
2346
+ {
2347
+ if (!comparer.Equals(expected, actual))
2348
+ {
2349
+ return;
2350
+ }
2351
+ }
2352
+ catch (System.Exception ex)
2353
+ {
2354
+ error = ex;
2355
+ }
2356
+ string expected2 = ArgumentFormatter.Format(expected);
2357
+ string actual2 = ArgumentFormatter.Format(actual);
2358
+ bool flag = expected is string;
2359
+ bool flag2 = actual is string;
2360
+ if ((flag && actual == null) || (flag2 && expected == null) || (flag && flag2))
2361
+ {
2362
+ throw NotEqualException.ForEqualCollectionsWithError(null, expected2, null, actual2, null, error, "Strings");
2363
+ }
2364
+ throw NotEqualException.ForEqualValuesWithError(expected2, actual2, error);
2365
+ }
2366
+ int? mismatchedIndex = null;
2367
+ IEqualityComparer val = null;
2368
+ AssertEqualityComparer<T> assertEqualityComparer = comparer as AssertEqualityComparer<T>;
2369
+ if (assertEqualityComparer != null)
2370
+ {
2371
+ val = assertEqualityComparer.InnerComparer;
2372
+ }
2373
+ else if ((object)comparer == EqualityComparer<T>.Default)
2374
+ {
2375
+ val = (IEqualityComparer)(object)EqualityComparer<object>.Default;
2376
+ }
2377
+ int? pointerIndent = null;
2378
+ int? pointerIndent2 = null;
2379
+ string text;
2380
+ string text2;
2381
+ if (val != null)
2382
+ {
2383
+ try
2384
+ {
2385
+ if (!(assertEqualityComparer?.Equals(expected, collectionTracker, actual, collectionTracker2, out mismatchedIndex) ?? CollectionTracker.AreCollectionsEqual(collectionTracker, collectionTracker2, val, val == AssertEqualityComparer<T>.DefaultInnerComparer, out mismatchedIndex)))
2386
+ {
2387
+ return;
2388
+ }
2389
+ text = collectionTracker?.FormatStart() ?? "null";
2390
+ text2 = collectionTracker2?.FormatStart() ?? "null";
2391
+ }
2392
+ catch (System.Exception ex2)
2393
+ {
2394
+ error = ex2;
2395
+ int startIndex = -1;
2396
+ int endIndex = -1;
2397
+ collectionTracker?.GetMismatchExtents(mismatchedIndex, out startIndex, out endIndex);
2398
+ int startIndex2 = -1;
2399
+ int endIndex2 = -1;
2400
+ collectionTracker2?.GetMismatchExtents(mismatchedIndex, out startIndex2, out endIndex2);
2401
+ pointerIndent = null;
2402
+ text = collectionTracker?.FormatIndexedMismatch(startIndex, endIndex, mismatchedIndex, out pointerIndent) ?? ArgumentFormatter.Format(expected);
2403
+ pointerIndent2 = null;
2404
+ text2 = collectionTracker2?.FormatIndexedMismatch(startIndex2, endIndex2, mismatchedIndex, out pointerIndent2) ?? ArgumentFormatter.Format(actual);
2405
+ }
2406
+ }
2407
+ else
2408
+ {
2409
+ try
2410
+ {
2411
+ if (!comparer.Equals(expected, actual))
2412
+ {
2413
+ return;
2414
+ }
2415
+ }
2416
+ catch (System.Exception ex3)
2417
+ {
2418
+ error = ex3;
2419
+ }
2420
+ text = ArgumentFormatter.Format(expected);
2421
+ text2 = ArgumentFormatter.Format(actual);
2422
+ }
2423
+ string collectionDisplay = null;
2424
+ ref T reference = ref expected;
2425
+ T val2 = default(T);
2426
+ object obj;
2427
+ if (val2 == null)
2428
+ {
2429
+ val2 = reference;
2430
+ reference = ref val2;
2431
+ if (val2 == null)
2432
+ {
2433
+ obj = null;
2434
+ goto IL_029b;
2435
+ }
2436
+ }
2437
+ obj = ((object)reference/*cast due to .constrained prefix*/).GetType();
2438
+ goto IL_029b;
2439
+ IL_029b:
2440
+ System.Type type = (System.Type)obj;
2441
+ System.Type type2 = SafeGetGenericTypeDefinition(type);
2442
+ System.Collections.Generic.IEnumerable<System.Type> enumerable = ((type != null) ? Enumerable.Select<System.Type, System.Type>(Enumerable.Where<System.Type>(IntrospectionExtensions.GetTypeInfo(type).ImplementedInterfaces, (Func<System.Type, bool>)((System.Type i) => ((System.Type)(object)IntrospectionExtensions.GetTypeInfo(i)).IsGenericType)), (Func<System.Type, System.Type>)((System.Type i) => i.GetGenericTypeDefinition())) : null);
2443
+ ref T reference2 = ref actual;
2444
+ val2 = default(T);
2445
+ object obj2;
2446
+ if (val2 == null)
2447
+ {
2448
+ val2 = reference2;
2449
+ reference2 = ref val2;
2450
+ if (val2 == null)
2451
+ {
2452
+ obj2 = null;
2453
+ goto IL_0337;
2454
+ }
2455
+ }
2456
+ obj2 = ((object)reference2/*cast due to .constrained prefix*/).GetType();
2457
+ goto IL_0337;
2458
+ IL_0337:
2459
+ System.Type type3 = (System.Type)obj2;
2460
+ System.Type type4 = SafeGetGenericTypeDefinition(type3);
2461
+ System.Collections.Generic.IEnumerable<System.Type> enumerable2 = ((type3 != null) ? Enumerable.Select<System.Type, System.Type>(Enumerable.Where<System.Type>(IntrospectionExtensions.GetTypeInfo(type3).ImplementedInterfaces, (Func<System.Type, bool>)((System.Type i) => ((System.Type)(object)IntrospectionExtensions.GetTypeInfo(i)).IsGenericType)), (Func<System.Type, System.Type>)((System.Type i) => i.GetGenericTypeDefinition())) : null);
2462
+ if (type2 == typeofDictionary && type4 == typeofDictionary)
2463
+ {
2464
+ collectionDisplay = "Dictionaries";
2465
+ }
2466
+ else if (type2 == typeofHashSet && type4 == typeofHashSet)
2467
+ {
2468
+ collectionDisplay = "HashSets";
2469
+ }
2470
+ else if (enumerable != null && enumerable2 != null && Enumerable.Contains<System.Type>(enumerable, typeofSet) && Enumerable.Contains<System.Type>(enumerable2, typeofSet))
2471
+ {
2472
+ collectionDisplay = "Sets";
2473
+ }
2474
+ if (type != type3)
2475
+ {
2476
+ string obj3 = ((type == (System.Type)null) ? "" : (AssertHelper.IsCompilerGenerated(type) ? "<generated> " : (ArgumentFormatter.FormatTypeName(type) + " ")));
2477
+ string text3 = ((type3 == (System.Type)null) ? "" : (AssertHelper.IsCompilerGenerated(type3) ? "<generated> " : (ArgumentFormatter.FormatTypeName(type3) + " ")));
2478
+ int num = Math.Max(obj3.Length, text3.Length);
2479
+ text = obj3.PadRight(num) + text;
2480
+ text2 = text3.PadRight(num) + text2;
2481
+ if (pointerIndent.HasValue)
2482
+ {
2483
+ pointerIndent += num;
2484
+ }
2485
+ if (pointerIndent2.HasValue)
2486
+ {
2487
+ pointerIndent2 += num;
2488
+ }
2489
+ }
2490
+ throw NotEqualException.ForEqualCollectionsWithError(mismatchedIndex, text, pointerIndent, text2, pointerIndent2, error, collectionDisplay);
2491
+ }
2492
+ finally
2493
+ {
2494
+ collectionTracker?.Dispose();
2495
+ collectionTracker2?.Dispose();
2496
+ }
2497
+ }
2498
+ public static void NotEqual(double expected, double actual, int precision)
2499
+ {
2500
+ double num = Math.Round(expected, precision);
2501
+ double num2 = Math.Round(actual, precision);
2502
+ if (object.Equals((object)num, (object)num2))
2503
+ {
2504
+ throw NotEqualException.ForEqualValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G17} (rounded from {1:G17})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G17} (rounded from {1:G17})", (object)num2, (object)actual), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are within {0} decimal places", (object)precision));
2505
+ }
2506
+ }
2507
+ public static void NotEqual(double expected, double actual, int precision, MidpointRounding rounding)
2508
+ {
2509
+ double num = Math.Round(expected, precision, rounding);
2510
+ double num2 = Math.Round(actual, precision, rounding);
2511
+ if (object.Equals((object)num, (object)num2))
2512
+ {
2513
+ throw NotEqualException.ForEqualValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G17} (rounded from {1:G17})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G17} (rounded from {1:G17})", (object)num2, (object)actual), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are within {0} decimal places", (object)precision));
2514
+ }
2515
+ }
2516
+ public static void NotEqual(double expected, double actual, double tolerance)
2517
+ {
2518
+ if (double.IsNaN(tolerance) || double.IsNegativeInfinity(tolerance) || tolerance < 0.0)
2519
+ {
2520
+ throw new ArgumentException("Tolerance must be greater than or equal to zero", "tolerance");
2521
+ }
2522
+ if (object.Equals((object)expected, (object)actual) || Math.Abs(expected - actual) <= tolerance)
2523
+ {
2524
+ throw NotEqualException.ForEqualValues(expected.ToString("G17", (IFormatProvider)(object)CultureInfo.CurrentCulture), actual.ToString("G17", (IFormatProvider)(object)CultureInfo.CurrentCulture), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are within tolerance {0:G17}", (object)tolerance));
2525
+ }
2526
+ }
2527
+ public static void NotEqual(float expected, float actual, int precision)
2528
+ {
2529
+ double num = Math.Round((double)expected, precision);
2530
+ double num2 = Math.Round((double)actual, precision);
2531
+ if (object.Equals((object)num, (object)num2))
2532
+ {
2533
+ throw NotEqualException.ForEqualValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G9} (rounded from {1:G9})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G9} (rounded from {1:G9})", (object)num2, (object)actual), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are within {0} decimal places", (object)precision));
2534
+ }
2535
+ }
2536
+ public static void NotEqual(float expected, float actual, int precision, MidpointRounding rounding)
2537
+ {
2538
+ double num = Math.Round((double)expected, precision, rounding);
2539
+ double num2 = Math.Round((double)actual, precision, rounding);
2540
+ if (object.Equals((object)num, (object)num2))
2541
+ {
2542
+ throw NotEqualException.ForEqualValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G9} (rounded from {1:G9})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0:G9} (rounded from {1:G9})", (object)num2, (object)actual), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are within {0} decimal places", (object)precision));
2543
+ }
2544
+ }
2545
+ public static void NotEqual(float expected, float actual, float tolerance)
2546
+ {
2547
+ if (float.IsNaN(tolerance) || float.IsNegativeInfinity(tolerance) || (double)tolerance < 0.0)
2548
+ {
2549
+ throw new ArgumentException("Tolerance must be greater than or equal to zero", "tolerance");
2550
+ }
2551
+ if (object.Equals((object)expected, (object)actual) || Math.Abs(expected - actual) <= tolerance)
2552
+ {
2553
+ throw NotEqualException.ForEqualValues(expected.ToString("G9", (IFormatProvider)(object)CultureInfo.CurrentCulture), actual.ToString("G9", (IFormatProvider)(object)CultureInfo.CurrentCulture), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "Values are within tolerance {0:G9}", (object)tolerance));
2554
+ }
2555
+ }
2556
+ public static void NotEqual(decimal expected, decimal actual, int precision)
2557
+ {
2558
+ decimal num = Math.Round(expected, precision);
2559
+ decimal num2 = Math.Round(actual, precision);
2560
+ if (num == num2)
2561
+ {
2562
+ throw NotEqualException.ForEqualValues(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0} (rounded from {1})", (object)num, (object)expected), string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "{0} (rounded from {1})", (object)num2, (object)actual));
2563
+ }
2564
+ }
2565
+ public static void NotStrictEqual<T>([AllowNull] T expected, [AllowNull] T actual)
2566
+ {
2567
+ if (!EqualityComparer<T>.Default.Equals(expected, actual))
2568
+ {
2569
+ return;
2570
+ }
2571
+ throw NotStrictEqualException.ForEqualValues(ArgumentFormatter.Format(expected), ArgumentFormatter.Format(actual));
2572
+ }
2573
+ public static void StrictEqual<T>([AllowNull] T expected, [AllowNull] T actual)
2574
+ {
2575
+ if (EqualityComparer<T>.Default.Equals(expected, actual))
2576
+ {
2577
+ return;
2578
+ }
2579
+ throw StrictEqualException.ForEqualValues(ArgumentFormatter.Format(expected), ArgumentFormatter.Format(actual));
2580
+ }
2581
+ public static void Equivalent(object? expected, object? actual, bool strict = false)
2582
+ {
2583
+ EquivalentException ex = AssertHelper.VerifyEquivalence(expected, actual, strict);
2584
+ if (ex != null)
2585
+ {
2586
+ throw ex;
2587
+ }
2588
+ }
2589
+ public static void Raises(Action<Action> attach, Action<Action> detach, Action testCode)
2590
+ {
2591
+ if (!RaisesInternal(attach, detach, testCode))
2592
+ {
2593
+ throw RaisesException.ForNoEvent();
2594
+ }
2595
+ }
2596
+ public static RaisedEvent<T> Raises<T>(Action<Action<T>> attach, Action<Action<T>> detach, Action testCode)
2597
+ {
2598
+ RaisedEvent<T> raisedEvent = RaisesInternal<T>(attach, detach, testCode);
2599
+ if (raisedEvent == null)
2600
+ {
2601
+ throw RaisesException.ForNoEvent(typeof(T));
2602
+ }
2603
+ if (raisedEvent.Arguments != null && !((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType().Equals(typeof(T)))
2604
+ {
2605
+ throw RaisesException.ForIncorrectType(typeof(T), ((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType());
2606
+ }
2607
+ return raisedEvent;
2608
+ }
2609
+ public static RaisedEvent<T> Raises<T>(Action<EventHandler<T>> attach, Action<EventHandler<T>> detach, Action testCode)
2610
+ {
2611
+ RaisedEvent<T> raisedEvent = RaisesInternal<T>(attach, detach, testCode);
2612
+ if (raisedEvent == null)
2613
+ {
2614
+ throw RaisesException.ForNoEvent(typeof(T));
2615
+ }
2616
+ if (raisedEvent.Arguments != null && !((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType().Equals(typeof(T)))
2617
+ {
2618
+ throw RaisesException.ForIncorrectType(typeof(T), ((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType());
2619
+ }
2620
+ return raisedEvent;
2621
+ }
2622
+ public static RaisedEvent<T> Raises<T>(Func<RaisedEvent<T>?> handler, Action attach, Action detach, Action testCode)
2623
+ {
2624
+ RaisedEvent<T> raisedEvent = RaisesInternal<T>(handler, attach, detach, testCode);
2625
+ if (raisedEvent == null)
2626
+ {
2627
+ throw RaisesException.ForNoEvent(typeof(T));
2628
+ }
2629
+ if (raisedEvent.Arguments != null && !((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType().Equals(typeof(T)))
2630
+ {
2631
+ throw RaisesException.ForIncorrectType(typeof(T), ((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType());
2632
+ }
2633
+ return raisedEvent;
2634
+ }
2635
+ public static RaisedEvent<EventArgs> RaisesAny(Action<EventHandler> attach, Action<EventHandler> detach, Action testCode)
2636
+ {
2637
+ return RaisesInternal(attach, detach, testCode) ?? throw RaisesAnyException.ForNoEvent(typeof(EventArgs));
2638
+ }
2639
+ public static RaisedEvent<T> RaisesAny<T>(Action<Action<T>> attach, Action<Action<T>> detach, Action testCode)
2640
+ {
2641
+ return RaisesInternal<T>(attach, detach, testCode) ?? throw RaisesAnyException.ForNoEvent(typeof(T));
2642
+ }
2643
+ public static RaisedEvent<T> RaisesAny<T>(Action<EventHandler<T>> attach, Action<EventHandler<T>> detach, Action testCode)
2644
+ {
2645
+ return RaisesInternal<T>(attach, detach, testCode) ?? throw RaisesAnyException.ForNoEvent(typeof(T));
2646
+ }
2647
+ [AsyncStateMachine(typeof(<RaisesAnyAsync>d__122))]
2648
+ public static async System.Threading.Tasks.Task<RaisedEvent<EventArgs>> RaisesAnyAsync(Action<EventHandler> attach, Action<EventHandler> detach, Func<System.Threading.Tasks.Task> testCode)
2649
+ {
2650
+ return (await RaisesAsyncInternal(attach, detach, testCode)) ?? throw RaisesAnyException.ForNoEvent(typeof(EventArgs));
2651
+ }
2652
+ [AsyncStateMachine(typeof(<RaisesAnyAsync>d__123<>))]
2653
+ public static async System.Threading.Tasks.Task<RaisedEvent<T>> RaisesAnyAsync<T>(Action<Action<T>> attach, Action<Action<T>> detach, Func<System.Threading.Tasks.Task> testCode)
2654
+ {
2655
+ return (await RaisesAsyncInternal<T>(attach, detach, testCode)) ?? throw RaisesAnyException.ForNoEvent(typeof(T));
2656
+ }
2657
+ [AsyncStateMachine(typeof(<RaisesAnyAsync>d__124<>))]
2658
+ public static async System.Threading.Tasks.Task<RaisedEvent<T>> RaisesAnyAsync<T>(Action<EventHandler<T>> attach, Action<EventHandler<T>> detach, Func<System.Threading.Tasks.Task> testCode)
2659
+ {
2660
+ return (await RaisesAsyncInternal<T>(attach, detach, testCode)) ?? throw RaisesAnyException.ForNoEvent(typeof(T));
2661
+ }
2662
+ [AsyncStateMachine(typeof(<RaisesAsync>d__125))]
2663
+ public static System.Threading.Tasks.Task RaisesAsync(Action<Action> attach, Action<Action> detach, Func<System.Threading.Tasks.Task> testCode)
2664
+ {
2665
+ <RaisesAsync>d__125 <RaisesAsync>d__ = default(<RaisesAsync>d__125);
2666
+ <RaisesAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
2667
+ <RaisesAsync>d__.attach = attach;
2668
+ <RaisesAsync>d__.detach = detach;
2669
+ <RaisesAsync>d__.testCode = testCode;
2670
+ <RaisesAsync>d__.<>1__state = -1;
2671
+ ((AsyncTaskMethodBuilder)(ref <RaisesAsync>d__.<>t__builder)).Start<<RaisesAsync>d__125>(ref <RaisesAsync>d__);
2672
+ return ((AsyncTaskMethodBuilder)(ref <RaisesAsync>d__.<>t__builder)).Task;
2673
+ }
2674
+ [AsyncStateMachine(typeof(<RaisesAsync>d__126<>))]
2675
+ public static async System.Threading.Tasks.Task<RaisedEvent<T>> RaisesAsync<T>(Action<Action<T>> attach, Action<Action<T>> detach, Func<System.Threading.Tasks.Task> testCode)
2676
+ {
2677
+ RaisedEvent<T> raisedEvent = await RaisesAsyncInternal<T>(attach, detach, testCode);
2678
+ if (raisedEvent == null)
2679
+ {
2680
+ throw RaisesException.ForNoEvent(typeof(T));
2681
+ }
2682
+ if (raisedEvent.Arguments != null && !((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType().Equals(typeof(T)))
2683
+ {
2684
+ throw RaisesException.ForIncorrectType(typeof(T), ((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType());
2685
+ }
2686
+ return raisedEvent;
2687
+ }
2688
+ [AsyncStateMachine(typeof(<RaisesAsync>d__127<>))]
2689
+ public static async System.Threading.Tasks.Task<RaisedEvent<T>> RaisesAsync<T>(Action<EventHandler<T>> attach, Action<EventHandler<T>> detach, Func<System.Threading.Tasks.Task> testCode)
2690
+ {
2691
+ RaisedEvent<T> raisedEvent = await RaisesAsyncInternal<T>(attach, detach, testCode);
2692
+ if (raisedEvent == null)
2693
+ {
2694
+ throw RaisesException.ForNoEvent(typeof(T));
2695
+ }
2696
+ if (raisedEvent.Arguments != null && !((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType().Equals(typeof(T)))
2697
+ {
2698
+ throw RaisesException.ForIncorrectType(typeof(T), ((object)raisedEvent.Arguments/*cast due to .constrained prefix*/).GetType());
2699
+ }
2700
+ return raisedEvent;
2701
+ }
2702
+ private static bool RaisesInternal(Action<Action> attach, Action<Action> detach, Action testCode)
2703
+ {
2704
+ GuardArgumentNotNull<Action<Action>>("attach", attach);
2705
+ GuardArgumentNotNull<Action<Action>>("detach", detach);
2706
+ GuardArgumentNotNull<Action>("testCode", testCode);
2707
+ bool result = false;
2708
+ Action val = (Action)delegate
2709
+ {
2710
+ result = true;
2711
+ };
2712
+ attach.Invoke(val);
2713
+ testCode.Invoke();
2714
+ detach.Invoke(val);
2715
+ return result;
2716
+ }
2717
+ private static RaisedEvent<EventArgs>? RaisesInternal(Action<EventHandler> attach, Action<EventHandler> detach, Action testCode)
2718
+ {
2719
+ GuardArgumentNotNull<Action<EventHandler>>("attach", attach);
2720
+ GuardArgumentNotNull<Action<EventHandler>>("detach", detach);
2721
+ GuardArgumentNotNull<Action>("testCode", testCode);
2722
+ RaisedEvent<EventArgs> raisedEvent = null;
2723
+ attach.Invoke(new EventHandler(handler));
2724
+ testCode.Invoke();
2725
+ detach.Invoke(new EventHandler(handler));
2726
+ return raisedEvent;
2727
+ void handler(object? s, EventArgs args)
2728
+ {
2729
+ raisedEvent = new RaisedEvent<EventArgs>(s, args);
2730
+ }
2731
+ }
2732
+ private static RaisedEvent<T>? RaisesInternal<T>(Action<Action<T>> attach, Action<Action<T>> detach, Action testCode)
2733
+ {
2734
+ RaisedEvent<T> raisedEvent = null;
2735
+ Action<T> handler = delegate(T args)
2736
+ {
2737
+ raisedEvent = new RaisedEvent<T>(args);
2738
+ };
2739
+ return RaisesInternal<T>(() => raisedEvent, (Action)delegate
2740
+ {
2741
+ attach.Invoke(handler);
2742
+ }, (Action)delegate
2743
+ {
2744
+ detach.Invoke(handler);
2745
+ }, testCode);
2746
+ }
2747
+ private static RaisedEvent<T>? RaisesInternal<T>(Action<EventHandler<T>> attach, Action<EventHandler<T>> detach, Action testCode)
2748
+ {
2749
+ RaisedEvent<T> raisedEvent = null;
2750
+ return RaisesInternal<T>(() => raisedEvent, (Action)delegate
2751
+ {
2752
+ attach.Invoke((EventHandler<T>)handler);
2753
+ }, (Action)delegate
2754
+ {
2755
+ detach.Invoke((EventHandler<T>)handler);
2756
+ }, testCode);
2757
+ void handler(object? s, T args)
2758
+ {
2759
+ raisedEvent = new RaisedEvent<T>(s, args);
2760
+ }
2761
+ }
2762
+ private static RaisedEvent<T>? RaisesInternal<T>(Func<RaisedEvent<T>?> handler, Action attach, Action detach, Action testCode)
2763
+ {
2764
+ GuardArgumentNotNull<Func<RaisedEvent<T>>>("handler", handler);
2765
+ GuardArgumentNotNull<Action>("attach", attach);
2766
+ GuardArgumentNotNull<Action>("detach", detach);
2767
+ GuardArgumentNotNull<Action>("testCode", testCode);
2768
+ attach.Invoke();
2769
+ testCode.Invoke();
2770
+ detach.Invoke();
2771
+ return handler.Invoke();
2772
+ }
2773
+ [AsyncStateMachine(typeof(<RaisesAsyncInternal>d__133))]
2774
+ private static async System.Threading.Tasks.Task<bool> RaisesAsyncInternal(Action<Action> attach, Action<Action> detach, Func<System.Threading.Tasks.Task> testCode)
2775
+ {
2776
+ GuardArgumentNotNull<Action<Action>>("attach", attach);
2777
+ GuardArgumentNotNull<Action<Action>>("detach", detach);
2778
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
2779
+ bool result = false;
2780
+ Action handler = (Action)delegate
2781
+ {
2782
+ result = true;
2783
+ };
2784
+ attach.Invoke(handler);
2785
+ await testCode.Invoke();
2786
+ detach.Invoke(handler);
2787
+ return result;
2788
+ }
2789
+ [AsyncStateMachine(typeof(<RaisesAsyncInternal>d__134))]
2790
+ private static async System.Threading.Tasks.Task<RaisedEvent<EventArgs>?> RaisesAsyncInternal(Action<EventHandler> attach, Action<EventHandler> detach, Func<System.Threading.Tasks.Task> testCode)
2791
+ {
2792
+ GuardArgumentNotNull<Action<EventHandler>>("attach", attach);
2793
+ GuardArgumentNotNull<Action<EventHandler>>("detach", detach);
2794
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
2795
+ RaisedEvent<EventArgs> raisedEvent = null;
2796
+ attach.Invoke(new EventHandler(handler));
2797
+ await testCode.Invoke();
2798
+ detach.Invoke(new EventHandler(handler));
2799
+ return raisedEvent;
2800
+ void handler(object? s, EventArgs args)
2801
+ {
2802
+ raisedEvent = new RaisedEvent<EventArgs>(s, args);
2803
+ }
2804
+ }
2805
+ [AsyncStateMachine(typeof(<RaisesAsyncInternal>d__135<>))]
2806
+ private static async System.Threading.Tasks.Task<RaisedEvent<T>?> RaisesAsyncInternal<T>(Action<Action<T>> attach, Action<Action<T>> detach, Func<System.Threading.Tasks.Task> testCode)
2807
+ {
2808
+ GuardArgumentNotNull<Action<Action<T>>>("attach", attach);
2809
+ GuardArgumentNotNull<Action<Action<T>>>("detach", detach);
2810
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
2811
+ RaisedEvent<T> raisedEvent = null;
2812
+ Action<T> handler = delegate(T args)
2813
+ {
2814
+ raisedEvent = new RaisedEvent<T>(args);
2815
+ };
2816
+ attach.Invoke(handler);
2817
+ await testCode.Invoke();
2818
+ detach.Invoke(handler);
2819
+ return raisedEvent;
2820
+ }
2821
+ [AsyncStateMachine(typeof(<RaisesAsyncInternal>d__136<>))]
2822
+ private static async System.Threading.Tasks.Task<RaisedEvent<T>?> RaisesAsyncInternal<T>(Action<EventHandler<T>> attach, Action<EventHandler<T>> detach, Func<System.Threading.Tasks.Task> testCode)
2823
+ {
2824
+ GuardArgumentNotNull<Action<EventHandler<T>>>("attach", attach);
2825
+ GuardArgumentNotNull<Action<EventHandler<T>>>("detach", detach);
2826
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
2827
+ RaisedEvent<T> raisedEvent = null;
2828
+ attach.Invoke((EventHandler<T>)handler);
2829
+ await testCode.Invoke();
2830
+ detach.Invoke((EventHandler<T>)handler);
2831
+ return raisedEvent;
2832
+ void handler(object? s, T args)
2833
+ {
2834
+ raisedEvent = new RaisedEvent<T>(s, args);
2835
+ }
2836
+ }
2837
+ private static System.Exception Throws(System.Type exceptionType, System.Exception? exception)
2838
+ {
2839
+ GuardArgumentNotNull("exceptionType", exceptionType);
2840
+ if (exception == null)
2841
+ {
2842
+ throw ThrowsException.ForNoException(exceptionType);
2843
+ }
2844
+ if (!exceptionType.Equals(exception.GetType()))
2845
+ {
2846
+ throw ThrowsException.ForIncorrectExceptionType(exceptionType, exception);
2847
+ }
2848
+ return exception;
2849
+ }
2850
+ public static System.Exception Throws(System.Type exceptionType, Action testCode)
2851
+ {
2852
+ return Throws(exceptionType, RecordException(testCode));
2853
+ }
2854
+ public static System.Exception Throws(System.Type exceptionType, Func<object?> testCode)
2855
+ {
2856
+ return Throws(exceptionType, RecordException(testCode, "ThrowsAsync"));
2857
+ }
2858
+ [EditorBrowsable(/*Could not decode attribute arguments.*/)]
2859
+ [Obsolete("You must call Assert.ThrowsAsync (and await the result) when testing async code.", true)]
2860
+ public static System.Exception Throws(System.Type exceptionType, Func<System.Threading.Tasks.Task> testCode)
2861
+ {
2862
+ throw new NotImplementedException("You must call Assert.ThrowsAsync (and await the result) when testing async code.");
2863
+ }
2864
+ public static T Throws<T>(Action testCode) where T : System.Exception
2865
+ {
2866
+ return (T)Throws(typeof(T), RecordException(testCode));
2867
+ }
2868
+ public static T Throws<T>(Func<object?> testCode) where T : System.Exception
2869
+ {
2870
+ return (T)Throws(typeof(T), RecordException(testCode, "ThrowsAsync"));
2871
+ }
2872
+ [EditorBrowsable(/*Could not decode attribute arguments.*/)]
2873
+ [Obsolete("You must call Assert.ThrowsAsync<T> (and await the result) when testing async code.", true)]
2874
+ public static T Throws<T>(Func<System.Threading.Tasks.Task> testCode) where T : System.Exception
2875
+ {
2876
+ throw new NotImplementedException("You must call Assert.ThrowsAsync<T> (and await the result) when testing async code.");
2877
+ }
2878
+ public static T Throws<T>(string? paramName, Action testCode) where T : ArgumentException
2879
+ {
2880
+ T val = Assert.Throws<T>(testCode);
2881
+ if (paramName != ((ArgumentException)val).ParamName)
2882
+ {
2883
+ throw ThrowsException.ForIncorrectParameterName(typeof(T), paramName, ((ArgumentException)val).ParamName);
2884
+ }
2885
+ return val;
2886
+ }
2887
+ public static T Throws<T>(string? paramName, Func<object?> testCode) where T : ArgumentException
2888
+ {
2889
+ T val = Assert.Throws<T>(testCode);
2890
+ if (paramName != ((ArgumentException)val).ParamName)
2891
+ {
2892
+ throw ThrowsException.ForIncorrectParameterName(typeof(T), paramName, ((ArgumentException)val).ParamName);
2893
+ }
2894
+ return val;
2895
+ }
2896
+ [EditorBrowsable(/*Could not decode attribute arguments.*/)]
2897
+ [Obsolete("You must call Assert.ThrowsAsync<T> (and await the result) when testing async code.", true)]
2898
+ public static T Throws<T>(string? paramName, Func<System.Threading.Tasks.Task> testCode) where T : ArgumentException
2899
+ {
2900
+ throw new NotImplementedException("You must call Assert.ThrowsAsync<T> (and await the result) when testing async code.");
2901
+ }
2902
+ private static System.Exception ThrowsAny(System.Type exceptionType, System.Exception? exception)
2903
+ {
2904
+ GuardArgumentNotNull("exceptionType", exceptionType);
2905
+ if (exception == null)
2906
+ {
2907
+ throw ThrowsAnyException.ForNoException(exceptionType);
2908
+ }
2909
+ if (!IntrospectionExtensions.GetTypeInfo(exceptionType).IsAssignableFrom(IntrospectionExtensions.GetTypeInfo(exception.GetType())))
2910
+ {
2911
+ throw ThrowsAnyException.ForIncorrectExceptionType(exceptionType, exception);
2912
+ }
2913
+ return exception;
2914
+ }
2915
+ public static T ThrowsAny<T>(Action testCode) where T : System.Exception
2916
+ {
2917
+ return (T)ThrowsAny(typeof(T), RecordException(testCode));
2918
+ }
2919
+ public static T ThrowsAny<T>(Func<object?> testCode) where T : System.Exception
2920
+ {
2921
+ return (T)ThrowsAny(typeof(T), RecordException(testCode, "ThrowsAnyAsync"));
2922
+ }
2923
+ [EditorBrowsable(/*Could not decode attribute arguments.*/)]
2924
+ [Obsolete("You must call Assert.ThrowsAnyAsync<T> (and await the result) when testing async code.", true)]
2925
+ public static T ThrowsAny<T>(Func<System.Threading.Tasks.Task> testCode) where T : System.Exception
2926
+ {
2927
+ throw new NotImplementedException("You must call Assert.ThrowsAnyAsync<T> (and await the result) when testing async code.");
2928
+ }
2929
+ [AsyncStateMachine(typeof(<ThrowsAnyAsync>d__152<>))]
2930
+ public static async System.Threading.Tasks.Task<T> ThrowsAnyAsync<T>(Func<System.Threading.Tasks.Task> testCode) where T : System.Exception
2931
+ {
2932
+ System.Type typeFromHandle = typeof(T);
2933
+ return (T)ThrowsAny(typeFromHandle, await RecordExceptionAsync(testCode));
2934
+ }
2935
+ [AsyncStateMachine(typeof(<ThrowsAsync>d__153))]
2936
+ public static async System.Threading.Tasks.Task<System.Exception> ThrowsAsync(System.Type exceptionType, Func<System.Threading.Tasks.Task> testCode)
2937
+ {
2938
+ return Throws(exceptionType, await RecordExceptionAsync(testCode));
2939
+ }
2940
+ [AsyncStateMachine(typeof(<ThrowsAsync>d__154<>))]
2941
+ public static async System.Threading.Tasks.Task<T> ThrowsAsync<T>(Func<System.Threading.Tasks.Task> testCode) where T : System.Exception
2942
+ {
2943
+ System.Type typeFromHandle = typeof(T);
2944
+ return (T)Throws(typeFromHandle, await RecordExceptionAsync(testCode));
2945
+ }
2946
+ [AsyncStateMachine(typeof(<ThrowsAsync>d__155<>))]
2947
+ public static async System.Threading.Tasks.Task<T> ThrowsAsync<T>(string? paramName, Func<System.Threading.Tasks.Task> testCode) where T : ArgumentException
2948
+ {
2949
+ T val = await Assert.ThrowsAsync<T>(testCode);
2950
+ if (paramName != ((ArgumentException)val).ParamName)
2951
+ {
2952
+ throw ThrowsException.ForIncorrectParameterName(typeof(T), paramName, ((ArgumentException)val).ParamName);
2953
+ }
2954
+ return val;
2955
+ }
2956
+ [DoesNotReturn]
2957
+ public static void Fail(string? message = null)
2958
+ {
2959
+ throw FailException.ForFailure(message);
2960
+ }
2961
+ [return: NotNull]
2962
+ internal static T GuardArgumentNotNull<T>(string argName, [NotNull] T? argValue)
2963
+ {
2964
+ if (argValue == null)
2965
+ {
2966
+ throw new ArgumentNullException(argName.TrimStart('@'));
2967
+ }
2968
+ return argValue;
2969
+ }
2970
+ public static void NotSame(object? expected, object? actual)
2971
+ {
2972
+ if (expected == actual)
2973
+ {
2974
+ throw NotSameException.ForSameValues();
2975
+ }
2976
+ }
2977
+ public static void Same(object? expected, object? actual)
2978
+ {
2979
+ if (expected != actual)
2980
+ {
2981
+ throw SameException.ForFailure(ArgumentFormatter.Format(expected), ArgumentFormatter.Format(actual));
2982
+ }
2983
+ }
2984
+ public static void Contains<T>(System.Memory<T> expectedSubMemory, System.Memory<T> actualMemory) where T : IEquatable<T>
2985
+ {
2986
+ Assert.Contains<T>(System.Memory<T>.op_Implicit(expectedSubMemory), System.Memory<T>.op_Implicit(actualMemory));
2987
+ }
2988
+ public static void Contains<T>(System.Memory<T> expectedSubMemory, ReadOnlyMemory<T> actualMemory) where T : IEquatable<T>
2989
+ {
2990
+ Assert.Contains<T>(System.Memory<T>.op_Implicit(expectedSubMemory), actualMemory);
2991
+ }
2992
+ public static void Contains<T>(ReadOnlyMemory<T> expectedSubMemory, System.Memory<T> actualMemory) where T : IEquatable<T>
2993
+ {
2994
+ Assert.Contains<T>(expectedSubMemory, System.Memory<T>.op_Implicit(actualMemory));
2995
+ }
2996
+ public static void Contains<T>(ReadOnlyMemory<T> expectedSubMemory, ReadOnlyMemory<T> actualMemory) where T : IEquatable<T>
2997
+ {
2998
+ GuardArgumentNotNull<ReadOnlyMemory<T>>("expectedSubMemory", expectedSubMemory);
2999
+ if (MemoryExtensions.IndexOf<T>(actualMemory.Span, expectedSubMemory.Span) < 0)
3000
+ {
3001
+ throw ContainsException.ForSubMemoryNotFound(CollectionTracker<T>.FormatStart(expectedSubMemory.Span), CollectionTracker<T>.FormatStart(actualMemory.Span));
3002
+ }
3003
+ }
3004
+ public static void DoesNotContain<T>(System.Memory<T> expectedSubMemory, System.Memory<T> actualMemory) where T : IEquatable<T>
3005
+ {
3006
+ Assert.DoesNotContain<T>(System.Memory<T>.op_Implicit(expectedSubMemory), System.Memory<T>.op_Implicit(actualMemory));
3007
+ }
3008
+ public static void DoesNotContain<T>(System.Memory<T> expectedSubMemory, ReadOnlyMemory<T> actualMemory) where T : IEquatable<T>
3009
+ {
3010
+ Assert.DoesNotContain<T>(System.Memory<T>.op_Implicit(expectedSubMemory), actualMemory);
3011
+ }
3012
+ public static void DoesNotContain<T>(ReadOnlyMemory<T> expectedSubMemory, System.Memory<T> actualMemory) where T : IEquatable<T>
3013
+ {
3014
+ Assert.DoesNotContain<T>(expectedSubMemory, System.Memory<T>.op_Implicit(actualMemory));
3015
+ }
3016
+ public static void DoesNotContain<T>(ReadOnlyMemory<T> expectedSubMemory, ReadOnlyMemory<T> actualMemory) where T : IEquatable<T>
3017
+ {
3018
+ GuardArgumentNotNull<ReadOnlyMemory<T>>("expectedSubMemory", expectedSubMemory);
3019
+ System.ReadOnlySpan<T> span = expectedSubMemory.Span;
3020
+ System.ReadOnlySpan<T> span2 = actualMemory.Span;
3021
+ int num = MemoryExtensions.IndexOf<T>(span2, span);
3022
+ int? pointerIndent;
3023
+ if (num > -1)
3024
+ {
3025
+ throw DoesNotContainException.ForSubMemoryFound(CollectionTracker<T>.FormatStart(span), memory: CollectionTracker<T>.FormatIndexedMismatch(span2, num, out pointerIndent), indexFailurePoint: num, failurePointerIndent: pointerIndent);
3026
+ }
3027
+ }
3028
+ public static void Equal<T>(System.Memory<T> expectedMemory, System.Memory<T> actualMemory) where T : IEquatable<T>
3029
+ {
3030
+ Assert.Equal<T>(System.Memory<T>.op_Implicit(expectedMemory), System.Memory<T>.op_Implicit(actualMemory));
3031
+ }
3032
+ public static void Equal<T>(System.Memory<T> expectedMemory, ReadOnlyMemory<T> actualMemory) where T : IEquatable<T>
3033
+ {
3034
+ Assert.Equal<T>(System.Memory<T>.op_Implicit(expectedMemory), actualMemory);
3035
+ }
3036
+ public static void Equal<T>(ReadOnlyMemory<T> expectedMemory, System.Memory<T> actualMemory) where T : IEquatable<T>
3037
+ {
3038
+ Assert.Equal<T>(expectedMemory, System.Memory<T>.op_Implicit(actualMemory));
3039
+ }
3040
+ public static void Equal<T>(ReadOnlyMemory<T> expectedMemory, ReadOnlyMemory<T> actualMemory) where T : IEquatable<T>
3041
+ {
3042
+ GuardArgumentNotNull<ReadOnlyMemory<T>>("expectedMemory", expectedMemory);
3043
+ if (!MemoryExtensions.SequenceEqual<T>(expectedMemory.Span, actualMemory.Span))
3044
+ {
3045
+ Equal((object)expectedMemory.Span.ToArray(), (object)actualMemory.Span.ToArray());
3046
+ }
3047
+ }
3048
+ public static void Multiple(params Action[] checks)
3049
+ {
3050
+ if (checks == null || checks.Length == 0)
3051
+ {
3052
+ return;
3053
+ }
3054
+ List<System.Exception> val = new List<System.Exception>();
3055
+ foreach (Action val2 in checks)
3056
+ {
3057
+ try
3058
+ {
3059
+ val2.Invoke();
3060
+ }
3061
+ catch (System.Exception ex)
3062
+ {
3063
+ val.Add(ex);
3064
+ }
3065
+ }
3066
+ if (val.Count == 0)
3067
+ {
3068
+ return;
3069
+ }
3070
+ if (val.Count == 1)
3071
+ {
3072
+ ExceptionDispatchInfo.Capture(val[0]).Throw();
3073
+ }
3074
+ throw MultipleException.ForFailures((System.Collections.Generic.IReadOnlyCollection<System.Exception>)val);
3075
+ }
3076
+ public static void NotNull([NotNull] object? @object)
3077
+ {
3078
+ if (@object == null)
3079
+ {
3080
+ throw NotNullException.ForNullValue();
3081
+ }
3082
+ }
3083
+ public static T NotNull<T>([NotNull] T? value) where T : struct
3084
+ {
3085
+ if (!value.HasValue)
3086
+ {
3087
+ throw NotNullException.ForNullStruct(typeof(T));
3088
+ }
3089
+ return value.Value;
3090
+ }
3091
+ public static void Null([MaybeNull] object? @object)
3092
+ {
3093
+ if (@object != null)
3094
+ {
3095
+ throw NullException.ForNonNullValue(@object);
3096
+ }
3097
+ }
3098
+ public static void Null<T>(T? value) where T : struct
3099
+ {
3100
+ if (value.HasValue)
3101
+ {
3102
+ throw NullException.ForNonNullStruct(typeof(T), value);
3103
+ }
3104
+ }
3105
+ public static void PropertyChanged(INotifyPropertyChanged @object, string propertyName, Action testCode)
3106
+ {
3107
+ GuardArgumentNotNull<INotifyPropertyChanged>("object", @object);
3108
+ GuardArgumentNotNull("propertyName", propertyName);
3109
+ GuardArgumentNotNull<Action>("testCode", testCode);
3110
+ bool propertyChangeHappened = false;
3111
+ PropertyChangedEventHandler val = (PropertyChangedEventHandler)delegate(object? sender, PropertyChangedEventArgs args)
3112
+ {
3113
+ propertyChangeHappened = propertyChangeHappened || string.IsNullOrEmpty(args.PropertyName) || propertyName.Equals(args.PropertyName, (StringComparison)5);
3114
+ };
3115
+ @object.PropertyChanged += val;
3116
+ try
3117
+ {
3118
+ testCode.Invoke();
3119
+ if (!propertyChangeHappened)
3120
+ {
3121
+ throw PropertyChangedException.ForUnsetProperty(propertyName);
3122
+ }
3123
+ }
3124
+ finally
3125
+ {
3126
+ @object.PropertyChanged -= val;
3127
+ }
3128
+ }
3129
+ [EditorBrowsable(/*Could not decode attribute arguments.*/)]
3130
+ [Obsolete("You must call Assert.PropertyChangedAsync (and await the result) when testing async code.", true)]
3131
+ public static void PropertyChanged(INotifyPropertyChanged @object, string propertyName, Func<System.Threading.Tasks.Task> testCode)
3132
+ {
3133
+ throw new NotImplementedException("You must call Assert.PropertyChangedAsync (and await the result) when testing async code.");
3134
+ }
3135
+ [AsyncStateMachine(typeof(<PropertyChangedAsync>d__179))]
3136
+ public static System.Threading.Tasks.Task PropertyChangedAsync(INotifyPropertyChanged @object, string propertyName, Func<System.Threading.Tasks.Task> testCode)
3137
+ {
3138
+ <PropertyChangedAsync>d__179 <PropertyChangedAsync>d__ = default(<PropertyChangedAsync>d__179);
3139
+ <PropertyChangedAsync>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
3140
+ <PropertyChangedAsync>d__.@object = @object;
3141
+ <PropertyChangedAsync>d__.propertyName = propertyName;
3142
+ <PropertyChangedAsync>d__.testCode = testCode;
3143
+ <PropertyChangedAsync>d__.<>1__state = -1;
3144
+ ((AsyncTaskMethodBuilder)(ref <PropertyChangedAsync>d__.<>t__builder)).Start<<PropertyChangedAsync>d__179>(ref <PropertyChangedAsync>d__);
3145
+ return ((AsyncTaskMethodBuilder)(ref <PropertyChangedAsync>d__.<>t__builder)).Task;
3146
+ }
3147
+ public static void InRange<T>(T actual, T low, T high) where T : IComparable
3148
+ {
3149
+ InRange(actual, low, high, GetRangeComparer<T>());
3150
+ }
3151
+ public static void InRange<T>(T actual, T low, T high, IComparer<T> comparer)
3152
+ {
3153
+ GuardArgumentNotNull("actual", actual);
3154
+ GuardArgumentNotNull("low", low);
3155
+ GuardArgumentNotNull("high", high);
3156
+ GuardArgumentNotNull<IComparer<T>>("comparer", comparer);
3157
+ if (comparer.Compare(low, actual) > 0 || comparer.Compare(actual, high) > 0)
3158
+ {
3159
+ throw InRangeException.ForValueNotInRange(actual, low, high);
3160
+ }
3161
+ }
3162
+ public static void NotInRange<T>(T actual, T low, T high) where T : IComparable
3163
+ {
3164
+ NotInRange(actual, low, high, GetRangeComparer<T>());
3165
+ }
3166
+ public static void NotInRange<T>(T actual, T low, T high, IComparer<T> comparer)
3167
+ {
3168
+ GuardArgumentNotNull("actual", actual);
3169
+ GuardArgumentNotNull("low", low);
3170
+ GuardArgumentNotNull("high", high);
3171
+ GuardArgumentNotNull<IComparer<T>>("comparer", comparer);
3172
+ if (comparer.Compare(low, actual) <= 0 && comparer.Compare(actual, high) <= 0)
3173
+ {
3174
+ throw NotInRangeException.ForValueInRange(actual, low, high);
3175
+ }
3176
+ }
3177
+ protected static System.Exception? RecordException(Action testCode)
3178
+ {
3179
+ GuardArgumentNotNull<Action>("testCode", testCode);
3180
+ try
3181
+ {
3182
+ testCode.Invoke();
3183
+ return null;
3184
+ }
3185
+ catch (System.Exception result)
3186
+ {
3187
+ return result;
3188
+ }
3189
+ }
3190
+ protected static System.Exception? RecordException(Func<object?> testCode, string asyncMethodName)
3191
+ {
3192
+ GuardArgumentNotNull<Func<object>>("testCode", testCode);
3193
+ object obj = null;
3194
+ try
3195
+ {
3196
+ obj = testCode.Invoke();
3197
+ }
3198
+ catch (System.Exception result)
3199
+ {
3200
+ return result;
3201
+ }
3202
+ if (obj is System.Threading.Tasks.Task)
3203
+ {
3204
+ throw new InvalidOperationException(string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, "You must call Assert.{0} when testing async code", (object)asyncMethodName));
3205
+ }
3206
+ return null;
3207
+ }
3208
+ [EditorBrowsable(/*Could not decode attribute arguments.*/)]
3209
+ [Obsolete("You must call Assert.RecordExceptionAsync (and await the result) when testing async code.", true)]
3210
+ protected static System.Exception RecordException(Func<System.Threading.Tasks.Task> testCode)
3211
+ {
3212
+ throw new NotImplementedException("You must call Assert.RecordExceptionAsync (and await the result) when testing async code.");
3213
+ }
3214
+ [AsyncStateMachine(typeof(<RecordExceptionAsync>d__187))]
3215
+ protected static async System.Threading.Tasks.Task<System.Exception?> RecordExceptionAsync(Func<System.Threading.Tasks.Task> testCode)
3216
+ {
3217
+ GuardArgumentNotNull<Func<System.Threading.Tasks.Task>>("testCode", testCode);
3218
+ try
3219
+ {
3220
+ await testCode.Invoke();
3221
+ return null;
3222
+ }
3223
+ catch (System.Exception result)
3224
+ {
3225
+ return result;
3226
+ }
3227
+ }
3228
+ public static void Contains<T>(T expected, ISet<T> set)
3229
+ {
3230
+ GuardArgumentNotNull<ISet<T>>("set", set);
3231
+ if (!((System.Collections.Generic.ICollection<T>)set).Contains(expected))
3232
+ {
3233
+ throw ContainsException.ForSetItemNotFound(ArgumentFormatter.Format(expected), CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)set));
3234
+ }
3235
+ }
3236
+ public static void Contains<T>(T expected, IReadOnlySet<T> set)
3237
+ {
3238
+ GuardArgumentNotNull<IReadOnlySet<T>>("set", set);
3239
+ if (!set.Contains(expected))
3240
+ {
3241
+ throw ContainsException.ForSetItemNotFound(ArgumentFormatter.Format(expected), CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)set));
3242
+ }
3243
+ }
3244
+ public static void Contains<T>(T expected, HashSet<T> set)
3245
+ {
3246
+ Contains(expected, (ISet<T>)(object)set);
3247
+ }
3248
+ public static void Contains<T>(T expected, SortedSet<T> set)
3249
+ {
3250
+ Contains(expected, (ISet<T>)(object)set);
3251
+ }
3252
+ public static void Contains<T>(T expected, ImmutableHashSet<T> set)
3253
+ {
3254
+ Contains(expected, (ISet<T>)(object)set);
3255
+ }
3256
+ public static void Contains<T>(T expected, ImmutableSortedSet<T> set)
3257
+ {
3258
+ Contains(expected, (ISet<T>)(object)set);
3259
+ }
3260
+ public static void DoesNotContain<T>(T expected, ISet<T> set)
3261
+ {
3262
+ GuardArgumentNotNull<ISet<T>>("set", set);
3263
+ if (((System.Collections.Generic.ICollection<T>)set).Contains(expected))
3264
+ {
3265
+ throw DoesNotContainException.ForSetItemFound(ArgumentFormatter.Format(expected), CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)set));
3266
+ }
3267
+ }
3268
+ public static void DoesNotContain<T>(T expected, IReadOnlySet<T> set)
3269
+ {
3270
+ GuardArgumentNotNull<IReadOnlySet<T>>("set", set);
3271
+ if (set.Contains(expected))
3272
+ {
3273
+ throw DoesNotContainException.ForSetItemFound(ArgumentFormatter.Format(expected), CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)set));
3274
+ }
3275
+ }
3276
+ public static void DoesNotContain<T>(T expected, HashSet<T> set)
3277
+ {
3278
+ DoesNotContain(expected, (ISet<T>)(object)set);
3279
+ }
3280
+ public static void DoesNotContain<T>(T expected, SortedSet<T> set)
3281
+ {
3282
+ DoesNotContain(expected, (ISet<T>)(object)set);
3283
+ }
3284
+ public static void DoesNotContain<T>(T expected, ImmutableHashSet<T> set)
3285
+ {
3286
+ DoesNotContain(expected, (ISet<T>)(object)set);
3287
+ }
3288
+ public static void DoesNotContain<T>(T expected, ImmutableSortedSet<T> set)
3289
+ {
3290
+ DoesNotContain(expected, (ISet<T>)(object)set);
3291
+ }
3292
+ public static void ProperSubset<T>(ISet<T> expectedSubset, ISet<T>? actual)
3293
+ {
3294
+ GuardArgumentNotNull<ISet<T>>("expectedSubset", expectedSubset);
3295
+ if (actual == null || !actual.IsProperSubsetOf((System.Collections.Generic.IEnumerable<T>)expectedSubset))
3296
+ {
3297
+ throw ProperSubsetException.ForFailure(CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)expectedSubset), (actual == null) ? "null" : CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)actual));
3298
+ }
3299
+ }
3300
+ public static void ProperSuperset<T>(ISet<T> expectedSuperset, ISet<T>? actual)
3301
+ {
3302
+ GuardArgumentNotNull<ISet<T>>("expectedSuperset", expectedSuperset);
3303
+ if (actual == null || !actual.IsProperSupersetOf((System.Collections.Generic.IEnumerable<T>)expectedSuperset))
3304
+ {
3305
+ throw ProperSupersetException.ForFailure(CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)expectedSuperset), (actual == null) ? "null" : CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)actual));
3306
+ }
3307
+ }
3308
+ public static void Subset<T>(ISet<T> expectedSubset, ISet<T>? actual)
3309
+ {
3310
+ GuardArgumentNotNull<ISet<T>>("expectedSubset", expectedSubset);
3311
+ if (actual == null || !actual.IsSubsetOf((System.Collections.Generic.IEnumerable<T>)expectedSubset))
3312
+ {
3313
+ throw SubsetException.ForFailure(CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)expectedSubset), (actual == null) ? "null" : CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)actual));
3314
+ }
3315
+ }
3316
+ public static void Superset<T>(ISet<T> expectedSuperset, ISet<T>? actual)
3317
+ {
3318
+ GuardArgumentNotNull<ISet<T>>("expectedSuperset", expectedSuperset);
3319
+ if (actual == null || !actual.IsSupersetOf((System.Collections.Generic.IEnumerable<T>)expectedSuperset))
3320
+ {
3321
+ throw SupersetException.ForFailure(CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)expectedSuperset), (actual == null) ? "null" : CollectionTracker<T>.FormatStart((System.Collections.Generic.IEnumerable<T>)actual));
3322
+ }
3323
+ }
3324
+ public static void Contains<T>(System.Span<T> expectedSubSpan, System.Span<T> actualSpan) where T : IEquatable<T>
3325
+ {
3326
+ Assert.Contains<T>(System.Span<T>.op_Implicit(expectedSubSpan), System.Span<T>.op_Implicit(actualSpan));
3327
+ }
3328
+ public static void Contains<T>(System.Span<T> expectedSubSpan, System.ReadOnlySpan<T> actualSpan) where T : IEquatable<T>
3329
+ {
3330
+ Assert.Contains<T>(System.Span<T>.op_Implicit(expectedSubSpan), actualSpan);
3331
+ }
3332
+ public static void Contains<T>(System.ReadOnlySpan<T> expectedSubSpan, System.Span<T> actualSpan) where T : IEquatable<T>
3333
+ {
3334
+ Assert.Contains<T>(expectedSubSpan, System.Span<T>.op_Implicit(actualSpan));
3335
+ }
3336
+ public static void Contains<T>(System.ReadOnlySpan<T> expectedSubSpan, System.ReadOnlySpan<T> actualSpan) where T : IEquatable<T>
3337
+ {
3338
+ if (MemoryExtensions.IndexOf<T>(actualSpan, expectedSubSpan) < 0)
3339
+ {
3340
+ throw ContainsException.ForSubSpanNotFound(CollectionTracker<T>.FormatStart(expectedSubSpan), CollectionTracker<T>.FormatStart(actualSpan));
3341
+ }
3342
+ }
3343
+ public static void DoesNotContain<T>(System.Span<T> expectedSubSpan, System.Span<T> actualSpan) where T : IEquatable<T>
3344
+ {
3345
+ Assert.DoesNotContain<T>(System.Span<T>.op_Implicit(expectedSubSpan), System.Span<T>.op_Implicit(actualSpan));
3346
+ }
3347
+ public static void DoesNotContain<T>(System.Span<T> expectedSubSpan, System.ReadOnlySpan<T> actualSpan) where T : IEquatable<T>
3348
+ {
3349
+ Assert.DoesNotContain<T>(System.Span<T>.op_Implicit(expectedSubSpan), actualSpan);
3350
+ }
3351
+ public static void DoesNotContain<T>(System.ReadOnlySpan<T> expectedSubSpan, System.Span<T> actualSpan) where T : IEquatable<T>
3352
+ {
3353
+ Assert.DoesNotContain<T>(expectedSubSpan, System.Span<T>.op_Implicit(actualSpan));
3354
+ }
3355
+ public static void DoesNotContain<T>(System.ReadOnlySpan<T> expectedSubSpan, System.ReadOnlySpan<T> actualSpan) where T : IEquatable<T>
3356
+ {
3357
+ int num = MemoryExtensions.IndexOf<T>(actualSpan, expectedSubSpan);
3358
+ int? pointerIndent;
3359
+ if (num > -1)
3360
+ {
3361
+ throw DoesNotContainException.ForSubSpanFound(CollectionTracker<T>.FormatStart(expectedSubSpan), span: CollectionTracker<T>.FormatIndexedMismatch(actualSpan, num, out pointerIndent), indexFailurePoint: num, failurePointerIndent: pointerIndent);
3362
+ }
3363
+ }
3364
+ public static void Equal<T>(System.ReadOnlySpan<T> expectedSpan, T[] actualArray) where T : IEquatable<T>
3365
+ {
3366
+ Assert.Equal<T>(expectedSpan, MemoryExtensions.AsSpan<T>(actualArray));
3367
+ }
3368
+ public static void Equal<T>(System.Span<T> expectedSpan, System.Span<T> actualSpan) where T : IEquatable<T>
3369
+ {
3370
+ Assert.Equal<T>(System.Span<T>.op_Implicit(expectedSpan), System.Span<T>.op_Implicit(actualSpan));
3371
+ }
3372
+ public static void Equal<T>(System.Span<T> expectedSpan, System.ReadOnlySpan<T> actualSpan) where T : IEquatable<T>
3373
+ {
3374
+ Assert.Equal<T>(System.Span<T>.op_Implicit(expectedSpan), actualSpan);
3375
+ }
3376
+ public static void Equal<T>(System.ReadOnlySpan<T> expectedSpan, System.Span<T> actualSpan) where T : IEquatable<T>
3377
+ {
3378
+ Assert.Equal<T>(expectedSpan, System.Span<T>.op_Implicit(actualSpan));
3379
+ }
3380
+ public static void Equal<T>(System.ReadOnlySpan<T> expectedSpan, System.ReadOnlySpan<T> actualSpan) where T : IEquatable<T>
3381
+ {
3382
+ if (!MemoryExtensions.SequenceEqual<T>(expectedSpan, actualSpan))
3383
+ {
3384
+ Equal((object)expectedSpan.ToArray(), (object)actualSpan.ToArray());
3385
+ }
3386
+ }
3387
+ public static void Contains(string expectedSubstring, string? actualString)
3388
+ {
3389
+ Contains(expectedSubstring, actualString, (StringComparison)0);
3390
+ }
3391
+ public static void Contains(string expectedSubstring, string? actualString, StringComparison comparisonType)
3392
+ {
3393
+ GuardArgumentNotNull("expectedSubstring", expectedSubstring);
3394
+ if (actualString == null || actualString.IndexOf(expectedSubstring, comparisonType) < 0)
3395
+ {
3396
+ throw ContainsException.ForSubStringNotFound(expectedSubstring, actualString);
3397
+ }
3398
+ }
3399
+ public static void Contains(System.Memory<char> expectedSubstring, System.Memory<char> actualString)
3400
+ {
3401
+ Contains(System.Memory<char>.op_Implicit(expectedSubstring), System.Memory<char>.op_Implicit(actualString), (StringComparison)0);
3402
+ }
3403
+ public static void Contains(System.Memory<char> expectedSubstring, ReadOnlyMemory<char> actualString)
3404
+ {
3405
+ Contains(System.Memory<char>.op_Implicit(expectedSubstring), actualString, (StringComparison)0);
3406
+ }
3407
+ public static void Contains(ReadOnlyMemory<char> expectedSubstring, System.Memory<char> actualString)
3408
+ {
3409
+ Contains(expectedSubstring, System.Memory<char>.op_Implicit(actualString), (StringComparison)0);
3410
+ }
3411
+ public static void Contains(ReadOnlyMemory<char> expectedSubstring, ReadOnlyMemory<char> actualString)
3412
+ {
3413
+ Contains(expectedSubstring, actualString, (StringComparison)0);
3414
+ }
3415
+ public static void Contains(System.Memory<char> expectedSubstring, System.Memory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3416
+ {
3417
+ Contains(System.Memory<char>.op_Implicit(expectedSubstring), System.Memory<char>.op_Implicit(actualString), comparisonType);
3418
+ }
3419
+ public static void Contains(System.Memory<char> expectedSubstring, ReadOnlyMemory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3420
+ {
3421
+ Contains(System.Memory<char>.op_Implicit(expectedSubstring), actualString, comparisonType);
3422
+ }
3423
+ public static void Contains(ReadOnlyMemory<char> expectedSubstring, System.Memory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3424
+ {
3425
+ Contains(expectedSubstring, System.Memory<char>.op_Implicit(actualString), comparisonType);
3426
+ }
3427
+ public static void Contains(ReadOnlyMemory<char> expectedSubstring, ReadOnlyMemory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3428
+ {
3429
+ GuardArgumentNotNull<ReadOnlyMemory<char>>("expectedSubstring", expectedSubstring);
3430
+ Contains(expectedSubstring.Span, actualString.Span, comparisonType);
3431
+ }
3432
+ public static void Contains(System.Span<char> expectedSubstring, System.Span<char> actualString, StringComparison comparisonType = (StringComparison)0)
3433
+ {
3434
+ Contains(System.Span<char>.op_Implicit(expectedSubstring), System.Span<char>.op_Implicit(actualString), comparisonType);
3435
+ }
3436
+ public static void Contains(System.Span<char> expectedSubstring, System.ReadOnlySpan<char> actualString, StringComparison comparisonType = (StringComparison)0)
3437
+ {
3438
+ Contains(System.Span<char>.op_Implicit(expectedSubstring), actualString, comparisonType);
3439
+ }
3440
+ public static void Contains(System.ReadOnlySpan<char> expectedSubstring, System.Span<char> actualString, StringComparison comparisonType = (StringComparison)0)
3441
+ {
3442
+ Contains(expectedSubstring, System.Span<char>.op_Implicit(actualString), comparisonType);
3443
+ }
3444
+ public static void Contains(System.ReadOnlySpan<char> expectedSubstring, System.ReadOnlySpan<char> actualString, StringComparison comparisonType = (StringComparison)0)
3445
+ {
3446
+ if (MemoryExtensions.IndexOf(actualString, expectedSubstring, comparisonType) < 0)
3447
+ {
3448
+ throw ContainsException.ForSubStringNotFound(((object)expectedSubstring/*cast due to .constrained prefix*/).ToString(), ((object)actualString/*cast due to .constrained prefix*/).ToString());
3449
+ }
3450
+ }
3451
+ public static void Contains(System.Span<char> expectedSubstring, System.Span<char> actualString)
3452
+ {
3453
+ Contains(System.Span<char>.op_Implicit(expectedSubstring), System.Span<char>.op_Implicit(actualString), (StringComparison)0);
3454
+ }
3455
+ public static void Contains(System.Span<char> expectedSubstring, System.ReadOnlySpan<char> actualString)
3456
+ {
3457
+ Contains(System.Span<char>.op_Implicit(expectedSubstring), actualString, (StringComparison)0);
3458
+ }
3459
+ public static void Contains(System.ReadOnlySpan<char> expectedSubstring, System.Span<char> actualString)
3460
+ {
3461
+ Contains(expectedSubstring, System.Span<char>.op_Implicit(actualString), (StringComparison)0);
3462
+ }
3463
+ public static void Contains(System.ReadOnlySpan<char> expectedSubstring, System.ReadOnlySpan<char> actualString)
3464
+ {
3465
+ Contains(expectedSubstring, actualString, (StringComparison)0);
3466
+ }
3467
+ public static void DoesNotContain(string expectedSubstring, string? actualString)
3468
+ {
3469
+ DoesNotContain(expectedSubstring, actualString, (StringComparison)0);
3470
+ }
3471
+ public static void DoesNotContain(string expectedSubstring, string? actualString, StringComparison comparisonType)
3472
+ {
3473
+ GuardArgumentNotNull("expectedSubstring", expectedSubstring);
3474
+ if (actualString != null)
3475
+ {
3476
+ int num = actualString.IndexOf(expectedSubstring, comparisonType);
3477
+ if (num >= 0)
3478
+ {
3479
+ throw DoesNotContainException.ForSubStringFound(expectedSubstring, num, actualString);
3480
+ }
3481
+ }
3482
+ }
3483
+ public static void DoesNotContain(System.Memory<char> expectedSubstring, System.Memory<char> actualString)
3484
+ {
3485
+ DoesNotContain(System.Memory<char>.op_Implicit(expectedSubstring), System.Memory<char>.op_Implicit(actualString), (StringComparison)0);
3486
+ }
3487
+ public static void DoesNotContain(System.Memory<char> expectedSubstring, ReadOnlyMemory<char> actualString)
3488
+ {
3489
+ DoesNotContain(System.Memory<char>.op_Implicit(expectedSubstring), actualString, (StringComparison)0);
3490
+ }
3491
+ public static void DoesNotContain(ReadOnlyMemory<char> expectedSubstring, System.Memory<char> actualString)
3492
+ {
3493
+ DoesNotContain(expectedSubstring, System.Memory<char>.op_Implicit(actualString), (StringComparison)0);
3494
+ }
3495
+ public static void DoesNotContain(ReadOnlyMemory<char> expectedSubstring, ReadOnlyMemory<char> actualString)
3496
+ {
3497
+ DoesNotContain(expectedSubstring, actualString, (StringComparison)0);
3498
+ }
3499
+ public static void DoesNotContain(System.Memory<char> expectedSubstring, System.Memory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3500
+ {
3501
+ DoesNotContain(System.Memory<char>.op_Implicit(expectedSubstring), System.Memory<char>.op_Implicit(actualString), comparisonType);
3502
+ }
3503
+ public static void DoesNotContain(System.Memory<char> expectedSubstring, ReadOnlyMemory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3504
+ {
3505
+ DoesNotContain(System.Memory<char>.op_Implicit(expectedSubstring), actualString, comparisonType);
3506
+ }
3507
+ public static void DoesNotContain(ReadOnlyMemory<char> expectedSubstring, System.Memory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3508
+ {
3509
+ DoesNotContain(expectedSubstring, System.Memory<char>.op_Implicit(actualString), comparisonType);
3510
+ }
3511
+ public static void DoesNotContain(ReadOnlyMemory<char> expectedSubstring, ReadOnlyMemory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3512
+ {
3513
+ GuardArgumentNotNull<ReadOnlyMemory<char>>("expectedSubstring", expectedSubstring);
3514
+ DoesNotContain(expectedSubstring.Span, actualString.Span, comparisonType);
3515
+ }
3516
+ public static void DoesNotContain(System.Span<char> expectedSubstring, System.Span<char> actualString, StringComparison comparisonType = (StringComparison)0)
3517
+ {
3518
+ DoesNotContain(System.Span<char>.op_Implicit(expectedSubstring), System.Span<char>.op_Implicit(actualString), comparisonType);
3519
+ }
3520
+ public static void DoesNotContain(System.Span<char> expectedSubstring, System.ReadOnlySpan<char> actualString, StringComparison comparisonType = (StringComparison)0)
3521
+ {
3522
+ DoesNotContain(System.Span<char>.op_Implicit(expectedSubstring), actualString, comparisonType);
3523
+ }
3524
+ public static void DoesNotContain(System.ReadOnlySpan<char> expectedSubstring, System.Span<char> actualString, StringComparison comparisonType = (StringComparison)0)
3525
+ {
3526
+ DoesNotContain(expectedSubstring, System.Span<char>.op_Implicit(actualString), comparisonType);
3527
+ }
3528
+ public static void DoesNotContain(System.ReadOnlySpan<char> expectedSubstring, System.ReadOnlySpan<char> actualString, StringComparison comparisonType = (StringComparison)0)
3529
+ {
3530
+ int num = MemoryExtensions.IndexOf(actualString, expectedSubstring, comparisonType);
3531
+ if (num > -1)
3532
+ {
3533
+ throw DoesNotContainException.ForSubStringFound(((object)expectedSubstring/*cast due to .constrained prefix*/).ToString(), num, ((object)actualString/*cast due to .constrained prefix*/).ToString());
3534
+ }
3535
+ }
3536
+ public static void DoesNotContain(System.Span<char> expectedSubstring, System.Span<char> actualString)
3537
+ {
3538
+ DoesNotContain(System.Span<char>.op_Implicit(expectedSubstring), System.Span<char>.op_Implicit(actualString), (StringComparison)0);
3539
+ }
3540
+ public static void DoesNotContain(System.Span<char> expectedSubstring, System.ReadOnlySpan<char> actualString)
3541
+ {
3542
+ DoesNotContain(System.Span<char>.op_Implicit(expectedSubstring), actualString, (StringComparison)0);
3543
+ }
3544
+ public static void DoesNotContain(System.ReadOnlySpan<char> expectedSubstring, System.Span<char> actualString)
3545
+ {
3546
+ DoesNotContain(expectedSubstring, System.Span<char>.op_Implicit(actualString), (StringComparison)0);
3547
+ }
3548
+ public static void DoesNotContain(System.ReadOnlySpan<char> expectedSubstring, System.ReadOnlySpan<char> actualString)
3549
+ {
3550
+ DoesNotContain(expectedSubstring, actualString, (StringComparison)0);
3551
+ }
3552
+ public static void DoesNotMatch([StringSyntax("Regex")] string expectedRegexPattern, string? actualString)
3553
+ {
3554
+ GuardArgumentNotNull("expectedRegexPattern", expectedRegexPattern);
3555
+ if (actualString != null)
3556
+ {
3557
+ Match val = Regex.Match(actualString, expectedRegexPattern);
3558
+ int pointerIndent;
3559
+ if (((Group)val).Success)
3560
+ {
3561
+ throw DoesNotMatchException.ForMatch(AssertHelper.ShortenAndEncodeString(expectedRegexPattern), @string: AssertHelper.ShortenAndEncodeString(actualString, ((Capture)val).Index, out pointerIndent), indexFailurePoint: ((Capture)val).Index, failurePointerIndent: pointerIndent);
3562
+ }
3563
+ }
3564
+ }
3565
+ public static void DoesNotMatch(Regex expectedRegex, string? actualString)
3566
+ {
3567
+ GuardArgumentNotNull<Regex>("expectedRegex", expectedRegex);
3568
+ if (actualString != null)
3569
+ {
3570
+ Match val = expectedRegex.Match(actualString);
3571
+ int pointerIndent;
3572
+ if (((Group)val).Success)
3573
+ {
3574
+ throw DoesNotMatchException.ForMatch(AssertHelper.ShortenAndEncodeString(((object)expectedRegex).ToString()), @string: AssertHelper.ShortenAndEncodeString(actualString, ((Capture)val).Index, out pointerIndent), indexFailurePoint: ((Capture)val).Index, failurePointerIndent: pointerIndent);
3575
+ }
3576
+ }
3577
+ }
3578
+ public static void Empty(string value)
3579
+ {
3580
+ GuardArgumentNotNull("value", value);
3581
+ if (value.Length != 0)
3582
+ {
3583
+ throw EmptyException.ForNonEmptyString(value);
3584
+ }
3585
+ }
3586
+ public static void EndsWith(string? expectedEndString, string? actualString)
3587
+ {
3588
+ EndsWith(expectedEndString, actualString, (StringComparison)0);
3589
+ }
3590
+ public static void EndsWith(string? expectedEndString, string? actualString, StringComparison comparisonType)
3591
+ {
3592
+ if (expectedEndString == null || actualString == null || !actualString.EndsWith(expectedEndString, comparisonType))
3593
+ {
3594
+ throw EndsWithException.ForStringNotFound(expectedEndString, actualString);
3595
+ }
3596
+ }
3597
+ public static void EndsWith(System.Memory<char> expectedEndString, System.Memory<char> actualString)
3598
+ {
3599
+ EndsWith(System.Memory<char>.op_Implicit(expectedEndString), System.Memory<char>.op_Implicit(actualString), (StringComparison)0);
3600
+ }
3601
+ public static void EndsWith(System.Memory<char> expectedEndString, ReadOnlyMemory<char> actualString)
3602
+ {
3603
+ EndsWith(System.Memory<char>.op_Implicit(expectedEndString), actualString, (StringComparison)0);
3604
+ }
3605
+ public static void EndsWith(ReadOnlyMemory<char> expectedEndString, System.Memory<char> actualString)
3606
+ {
3607
+ EndsWith(expectedEndString, System.Memory<char>.op_Implicit(actualString), (StringComparison)0);
3608
+ }
3609
+ public static void EndsWith(ReadOnlyMemory<char> expectedEndString, ReadOnlyMemory<char> actualString)
3610
+ {
3611
+ EndsWith(expectedEndString, actualString, (StringComparison)0);
3612
+ }
3613
+ public static void EndsWith(System.Memory<char> expectedEndString, System.Memory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3614
+ {
3615
+ EndsWith(System.Memory<char>.op_Implicit(expectedEndString), System.Memory<char>.op_Implicit(actualString), comparisonType);
3616
+ }
3617
+ public static void EndsWith(System.Memory<char> expectedEndString, ReadOnlyMemory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3618
+ {
3619
+ EndsWith(System.Memory<char>.op_Implicit(expectedEndString), actualString, comparisonType);
3620
+ }
3621
+ public static void EndsWith(ReadOnlyMemory<char> expectedEndString, System.Memory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3622
+ {
3623
+ EndsWith(expectedEndString, System.Memory<char>.op_Implicit(actualString), comparisonType);
3624
+ }
3625
+ public static void EndsWith(ReadOnlyMemory<char> expectedEndString, ReadOnlyMemory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3626
+ {
3627
+ GuardArgumentNotNull<ReadOnlyMemory<char>>("expectedEndString", expectedEndString);
3628
+ EndsWith(expectedEndString.Span, actualString.Span, comparisonType);
3629
+ }
3630
+ public static void EndsWith(System.Span<char> expectedEndString, System.Span<char> actualString)
3631
+ {
3632
+ EndsWith(System.Span<char>.op_Implicit(expectedEndString), System.Span<char>.op_Implicit(actualString), (StringComparison)0);
3633
+ }
3634
+ public static void EndsWith(System.Span<char> expectedEndString, System.ReadOnlySpan<char> actualString)
3635
+ {
3636
+ EndsWith(System.Span<char>.op_Implicit(expectedEndString), actualString, (StringComparison)0);
3637
+ }
3638
+ public static void EndsWith(System.ReadOnlySpan<char> expectedEndString, System.Span<char> actualString)
3639
+ {
3640
+ EndsWith(expectedEndString, System.Span<char>.op_Implicit(actualString), (StringComparison)0);
3641
+ }
3642
+ public static void EndsWith(System.ReadOnlySpan<char> expectedEndString, System.ReadOnlySpan<char> actualString)
3643
+ {
3644
+ EndsWith(expectedEndString, actualString, (StringComparison)0);
3645
+ }
3646
+ public static void EndsWith(System.Span<char> expectedEndString, System.Span<char> actualString, StringComparison comparisonType = (StringComparison)0)
3647
+ {
3648
+ EndsWith(System.Span<char>.op_Implicit(expectedEndString), System.Span<char>.op_Implicit(actualString), comparisonType);
3649
+ }
3650
+ public static void EndsWith(System.Span<char> expectedEndString, System.ReadOnlySpan<char> actualString, StringComparison comparisonType = (StringComparison)0)
3651
+ {
3652
+ EndsWith(System.Span<char>.op_Implicit(expectedEndString), actualString, comparisonType);
3653
+ }
3654
+ public static void EndsWith(System.ReadOnlySpan<char> expectedEndString, System.Span<char> actualString, StringComparison comparisonType = (StringComparison)0)
3655
+ {
3656
+ EndsWith(expectedEndString, System.Span<char>.op_Implicit(actualString), comparisonType);
3657
+ }
3658
+ public static void EndsWith(System.ReadOnlySpan<char> expectedEndString, System.ReadOnlySpan<char> actualString, StringComparison comparisonType = (StringComparison)0)
3659
+ {
3660
+ if (!MemoryExtensions.EndsWith(actualString, expectedEndString, comparisonType))
3661
+ {
3662
+ throw EndsWithException.ForStringNotFound(((object)expectedEndString/*cast due to .constrained prefix*/).ToString(), ((object)actualString/*cast due to .constrained prefix*/).ToString());
3663
+ }
3664
+ }
3665
+ public static void Equal(string? expected, string? actual)
3666
+ {
3667
+ Equal(expected, actual, ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3668
+ }
3669
+ public unsafe static void Equal(System.ReadOnlySpan<char> expected, System.ReadOnlySpan<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3670
+ {
3671
+ int num = 0;
3672
+ int num2 = 0;
3673
+ int length = expected.Length;
3674
+ int length2 = actual.Length;
3675
+ if (ignoreAllWhiteSpace && ((length == 0 && SkipWhitespace(actual, 0) == length2) || (length2 == 0 && SkipWhitespace(expected, 0) == length)))
3676
+ {
3677
+ return;
3678
+ }
3679
+ while (num < length && num2 < length2)
3680
+ {
3681
+ char c = *(char*)expected[num];
3682
+ char c2 = *(char*)actual[num2];
3683
+ if (ignoreLineEndingDifferences && charsLineEndings.Contains(c) && charsLineEndings.Contains(c2))
3684
+ {
3685
+ num = SkipLineEnding(expected, num);
3686
+ num2 = SkipLineEnding(actual, num2);
3687
+ continue;
3688
+ }
3689
+ if (ignoreAllWhiteSpace && (charsWhitespace.Contains(c) || charsWhitespace.Contains(c2)))
3690
+ {
3691
+ num = SkipWhitespace(expected, num);
3692
+ num2 = SkipWhitespace(actual, num2);
3693
+ continue;
3694
+ }
3695
+ if (ignoreWhiteSpaceDifferences && charsWhitespace.Contains(c) && charsWhitespace.Contains(c2))
3696
+ {
3697
+ num = SkipWhitespace(expected, num);
3698
+ num2 = SkipWhitespace(actual, num2);
3699
+ continue;
3700
+ }
3701
+ if (ignoreCase)
3702
+ {
3703
+ c = char.ToUpperInvariant(c);
3704
+ c2 = char.ToUpperInvariant(c2);
3705
+ }
3706
+ if (c != c2)
3707
+ {
3708
+ break;
3709
+ }
3710
+ num++;
3711
+ num2++;
3712
+ }
3713
+ if (num < length || num2 < length2)
3714
+ {
3715
+ throw EqualException.ForMismatchedStrings(((object)expected/*cast due to .constrained prefix*/).ToString(), ((object)actual/*cast due to .constrained prefix*/).ToString(), num, num2);
3716
+ }
3717
+ }
3718
+ public static void Equal(System.Memory<char> expected, System.Memory<char> actual)
3719
+ {
3720
+ Equal(System.Memory<char>.op_Implicit(expected), System.Memory<char>.op_Implicit(actual), ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3721
+ }
3722
+ public static void Equal(System.Memory<char> expected, ReadOnlyMemory<char> actual)
3723
+ {
3724
+ Equal(System.Memory<char>.op_Implicit(expected), actual, ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3725
+ }
3726
+ public static void Equal(ReadOnlyMemory<char> expected, System.Memory<char> actual)
3727
+ {
3728
+ Equal(expected, System.Memory<char>.op_Implicit(actual), ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3729
+ }
3730
+ public static void Equal(ReadOnlyMemory<char> expected, ReadOnlyMemory<char> actual)
3731
+ {
3732
+ Equal(expected, actual, ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3733
+ }
3734
+ public static void Equal(System.Memory<char> expected, System.Memory<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3735
+ {
3736
+ Equal(System.Memory<char>.op_Implicit(expected), System.Memory<char>.op_Implicit(actual), ignoreCase, ignoreLineEndingDifferences, ignoreWhiteSpaceDifferences, ignoreAllWhiteSpace);
3737
+ }
3738
+ public static void Equal(System.Memory<char> expected, ReadOnlyMemory<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3739
+ {
3740
+ Equal(System.Memory<char>.op_Implicit(expected), actual, ignoreCase, ignoreLineEndingDifferences, ignoreWhiteSpaceDifferences, ignoreAllWhiteSpace);
3741
+ }
3742
+ public static void Equal(ReadOnlyMemory<char> expected, System.Memory<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3743
+ {
3744
+ Equal(expected, System.Memory<char>.op_Implicit(actual), ignoreCase, ignoreLineEndingDifferences, ignoreWhiteSpaceDifferences, ignoreAllWhiteSpace);
3745
+ }
3746
+ public static void Equal(ReadOnlyMemory<char> expected, ReadOnlyMemory<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3747
+ {
3748
+ GuardArgumentNotNull<ReadOnlyMemory<char>>("expected", expected);
3749
+ Equal(expected.Span, actual.Span, ignoreCase, ignoreLineEndingDifferences, ignoreWhiteSpaceDifferences, ignoreAllWhiteSpace);
3750
+ }
3751
+ public static void Equal(System.Span<char> expected, System.Span<char> actual)
3752
+ {
3753
+ Equal(System.Span<char>.op_Implicit(expected), System.Span<char>.op_Implicit(actual), ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3754
+ }
3755
+ public static void Equal(System.Span<char> expected, System.ReadOnlySpan<char> actual)
3756
+ {
3757
+ Equal(System.Span<char>.op_Implicit(expected), actual, ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3758
+ }
3759
+ public static void Equal(System.ReadOnlySpan<char> expected, System.Span<char> actual)
3760
+ {
3761
+ Equal(expected, System.Span<char>.op_Implicit(actual), ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3762
+ }
3763
+ public static void Equal(System.ReadOnlySpan<char> expected, System.ReadOnlySpan<char> actual)
3764
+ {
3765
+ Equal(expected, actual, ignoreCase: false, ignoreLineEndingDifferences: false, ignoreWhiteSpaceDifferences: false, ignoreAllWhiteSpace: false);
3766
+ }
3767
+ public static void Equal(System.Span<char> expected, System.Span<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3768
+ {
3769
+ Equal(System.Span<char>.op_Implicit(expected), System.Span<char>.op_Implicit(actual), ignoreCase, ignoreLineEndingDifferences, ignoreWhiteSpaceDifferences, ignoreAllWhiteSpace);
3770
+ }
3771
+ public static void Equal(System.Span<char> expected, System.ReadOnlySpan<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3772
+ {
3773
+ Equal(System.Span<char>.op_Implicit(expected), actual, ignoreCase, ignoreLineEndingDifferences, ignoreWhiteSpaceDifferences, ignoreAllWhiteSpace);
3774
+ }
3775
+ public static void Equal(System.ReadOnlySpan<char> expected, System.Span<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3776
+ {
3777
+ Equal(expected, System.Span<char>.op_Implicit(actual), ignoreCase, ignoreLineEndingDifferences, ignoreWhiteSpaceDifferences, ignoreAllWhiteSpace);
3778
+ }
3779
+ public static void Equal(string? expected, string? actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, bool ignoreWhiteSpaceDifferences = false, bool ignoreAllWhiteSpace = false)
3780
+ {
3781
+ if (expected != null || actual != null)
3782
+ {
3783
+ if (expected == null || actual == null)
3784
+ {
3785
+ throw EqualException.ForMismatchedStrings(expected, actual, -1, -1);
3786
+ }
3787
+ Equal(MemoryExtensions.AsSpan(expected), MemoryExtensions.AsSpan(actual), ignoreCase, ignoreLineEndingDifferences, ignoreWhiteSpaceDifferences, ignoreAllWhiteSpace);
3788
+ }
3789
+ }
3790
+ public static void Matches([StringSyntax("Regex")] string expectedRegexPattern, string? actualString)
3791
+ {
3792
+ GuardArgumentNotNull("expectedRegexPattern", expectedRegexPattern);
3793
+ if (actualString == null || !Regex.IsMatch(actualString, expectedRegexPattern))
3794
+ {
3795
+ throw MatchesException.ForMatchNotFound(expectedRegexPattern, actualString);
3796
+ }
3797
+ }
3798
+ public static void Matches(Regex expectedRegex, string? actualString)
3799
+ {
3800
+ GuardArgumentNotNull<Regex>("expectedRegex", expectedRegex);
3801
+ if (actualString == null || !expectedRegex.IsMatch(actualString))
3802
+ {
3803
+ throw MatchesException.ForMatchNotFound(((object)expectedRegex).ToString(), actualString);
3804
+ }
3805
+ }
3806
+ public static void StartsWith(string? expectedStartString, string? actualString)
3807
+ {
3808
+ StartsWith(expectedStartString, actualString, (StringComparison)0);
3809
+ }
3810
+ public static void StartsWith(string? expectedStartString, string? actualString, StringComparison comparisonType)
3811
+ {
3812
+ if (expectedStartString == null || actualString == null || !actualString.StartsWith(expectedStartString, comparisonType))
3813
+ {
3814
+ throw StartsWithException.ForStringNotFound(expectedStartString, actualString);
3815
+ }
3816
+ }
3817
+ public static void StartsWith(System.Memory<char> expectedStartString, System.Memory<char> actualString)
3818
+ {
3819
+ StartsWith(System.Memory<char>.op_Implicit(expectedStartString), System.Memory<char>.op_Implicit(actualString), (StringComparison)0);
3820
+ }
3821
+ public static void StartsWith(System.Memory<char> expectedStartString, ReadOnlyMemory<char> actualString)
3822
+ {
3823
+ StartsWith(System.Memory<char>.op_Implicit(expectedStartString), actualString, (StringComparison)0);
3824
+ }
3825
+ public static void StartsWith(ReadOnlyMemory<char> expectedStartString, System.Memory<char> actualString)
3826
+ {
3827
+ StartsWith(expectedStartString, System.Memory<char>.op_Implicit(actualString), (StringComparison)0);
3828
+ }
3829
+ public static void StartsWith(ReadOnlyMemory<char> expectedStartString, ReadOnlyMemory<char> actualString)
3830
+ {
3831
+ StartsWith(expectedStartString, actualString, (StringComparison)0);
3832
+ }
3833
+ public static void StartsWith(System.Memory<char> expectedStartString, System.Memory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3834
+ {
3835
+ StartsWith(System.Memory<char>.op_Implicit(expectedStartString), System.Memory<char>.op_Implicit(actualString), comparisonType);
3836
+ }
3837
+ public static void StartsWith(System.Memory<char> expectedStartString, ReadOnlyMemory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3838
+ {
3839
+ StartsWith(System.Memory<char>.op_Implicit(expectedStartString), actualString, comparisonType);
3840
+ }
3841
+ public static void StartsWith(ReadOnlyMemory<char> expectedStartString, System.Memory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3842
+ {
3843
+ StartsWith(expectedStartString, System.Memory<char>.op_Implicit(actualString), comparisonType);
3844
+ }
3845
+ public static void StartsWith(ReadOnlyMemory<char> expectedStartString, ReadOnlyMemory<char> actualString, StringComparison comparisonType = (StringComparison)0)
3846
+ {
3847
+ GuardArgumentNotNull<ReadOnlyMemory<char>>("expectedStartString", expectedStartString);
3848
+ StartsWith(expectedStartString.Span, actualString.Span, comparisonType);
3849
+ }
3850
+ public static void StartsWith(System.Span<char> expectedStartString, System.Span<char> actualString)
3851
+ {
3852
+ StartsWith(System.Span<char>.op_Implicit(expectedStartString), System.Span<char>.op_Implicit(actualString), (StringComparison)0);
3853
+ }
3854
+ public static void StartsWith(System.Span<char> expectedStartString, System.ReadOnlySpan<char> actualString)
3855
+ {
3856
+ StartsWith(System.Span<char>.op_Implicit(expectedStartString), actualString, (StringComparison)0);
3857
+ }
3858
+ public static void StartsWith(System.ReadOnlySpan<char> expectedStartString, System.Span<char> actualString)
3859
+ {
3860
+ StartsWith(expectedStartString, System.Span<char>.op_Implicit(actualString), (StringComparison)0);
3861
+ }
3862
+ public static void StartsWith(System.ReadOnlySpan<char> expectedStartString, System.ReadOnlySpan<char> actualString)
3863
+ {
3864
+ StartsWith(expectedStartString, actualString, (StringComparison)0);
3865
+ }
3866
+ public static void StartsWith(System.Span<char> expectedStartString, System.Span<char> actualString, StringComparison comparisonType = (StringComparison)0)
3867
+ {
3868
+ StartsWith(System.Span<char>.op_Implicit(expectedStartString), System.Span<char>.op_Implicit(actualString), comparisonType);
3869
+ }
3870
+ public static void StartsWith(System.Span<char> expectedStartString, System.ReadOnlySpan<char> actualString, StringComparison comparisonType = (StringComparison)0)
3871
+ {
3872
+ StartsWith(System.Span<char>.op_Implicit(expectedStartString), actualString, comparisonType);
3873
+ }
3874
+ public static void StartsWith(System.ReadOnlySpan<char> expectedStartString, System.Span<char> actualString, StringComparison comparisonType = (StringComparison)0)
3875
+ {
3876
+ StartsWith(expectedStartString, System.Span<char>.op_Implicit(actualString), comparisonType);
3877
+ }
3878
+ public static void StartsWith(System.ReadOnlySpan<char> expectedStartString, System.ReadOnlySpan<char> actualString, StringComparison comparisonType = (StringComparison)0)
3879
+ {
3880
+ if (!MemoryExtensions.StartsWith(actualString, expectedStartString, comparisonType))
3881
+ {
3882
+ throw StartsWithException.ForStringNotFound(((object)expectedStartString/*cast due to .constrained prefix*/).ToString(), ((object)actualString/*cast due to .constrained prefix*/).ToString());
3883
+ }
3884
+ }
3885
+ private unsafe static int SkipLineEnding(System.ReadOnlySpan<char> value, int index)
3886
+ {
3887
+ if (*(ushort*)value[index] == 13)
3888
+ {
3889
+ index++;
3890
+ }
3891
+ if (index < value.Length && *(ushort*)value[index] == 10)
3892
+ {
3893
+ index++;
3894
+ }
3895
+ return index;
3896
+ }
3897
+ private unsafe static int SkipWhitespace(System.ReadOnlySpan<char> value, int index)
3898
+ {
3899
+ while (index < value.Length)
3900
+ {
3901
+ if (charsWhitespace.Contains(*(char*)value[index]))
3902
+ {
3903
+ index++;
3904
+ continue;
3905
+ }
3906
+ return index;
3907
+ }
3908
+ return index;
3909
+ }
3910
+ public static T IsAssignableFrom<T>(object? @object)
3911
+ {
3912
+ IsAssignableFrom(typeof(T), @object);
3913
+ return (T)@object;
3914
+ }
3915
+ public static void IsAssignableFrom(System.Type expectedType, [NotNull] object? @object)
3916
+ {
3917
+ GuardArgumentNotNull("expectedType", expectedType);
3918
+ if (@object == null || !IntrospectionExtensions.GetTypeInfo(expectedType).IsAssignableFrom(IntrospectionExtensions.GetTypeInfo(@object.GetType())))
3919
+ {
3920
+ throw IsAssignableFromException.ForIncompatibleType(expectedType, @object);
3921
+ }
3922
+ }
3923
+ public static void IsNotAssignableFrom<T>(object? @object)
3924
+ {
3925
+ IsNotAssignableFrom(typeof(T), @object);
3926
+ }
3927
+ public static void IsNotAssignableFrom(System.Type expectedType, object? @object)
3928
+ {
3929
+ GuardArgumentNotNull("expectedType", expectedType);
3930
+ if (@object != null && IntrospectionExtensions.GetTypeInfo(expectedType).IsAssignableFrom(IntrospectionExtensions.GetTypeInfo(@object.GetType())))
3931
+ {
3932
+ throw IsNotAssignableFromException.ForCompatibleType(expectedType, @object);
3933
+ }
3934
+ }
3935
+ public static void IsNotType<T>(object? @object)
3936
+ {
3937
+ IsNotType(typeof(T), @object);
3938
+ }
3939
+ public static void IsNotType<T>(object? @object, bool exactMatch)
3940
+ {
3941
+ IsNotType(typeof(T), @object, exactMatch);
3942
+ }
3943
+ public static void IsNotType(System.Type expectedType, object? @object)
3944
+ {
3945
+ IsNotType(expectedType, @object, exactMatch: true);
3946
+ }
3947
+ public static void IsNotType(System.Type expectedType, object? @object, bool exactMatch)
3948
+ {
3949
+ GuardArgumentNotNull("expectedType", expectedType);
3950
+ if (exactMatch)
3951
+ {
3952
+ if (@object != null && expectedType.Equals(@object.GetType()))
3953
+ {
3954
+ throw IsNotTypeException.ForExactType(expectedType);
3955
+ }
3956
+ return;
3957
+ }
3958
+ System.Type type = @object?.GetType();
3959
+ if (type != (System.Type)null && IntrospectionExtensions.GetTypeInfo(expectedType).IsAssignableFrom(IntrospectionExtensions.GetTypeInfo(type)))
3960
+ {
3961
+ throw IsNotTypeException.ForCompatibleType(expectedType, type);
3962
+ }
3963
+ }
3964
+ public static T IsType<T>([NotNull] object? @object)
3965
+ {
3966
+ IsType(typeof(T), @object, exactMatch: true);
3967
+ return (T)@object;
3968
+ }
3969
+ public static T IsType<T>([NotNull] object? @object, bool exactMatch)
3970
+ {
3971
+ IsType(typeof(T), @object, exactMatch);
3972
+ return (T)@object;
3973
+ }
3974
+ public static void IsType(System.Type expectedType, [NotNull] object? @object)
3975
+ {
3976
+ IsType(expectedType, @object, exactMatch: true);
3977
+ }
3978
+ public static void IsType(System.Type expectedType, [NotNull] object? @object, bool exactMatch)
3979
+ {
3980
+ GuardArgumentNotNull("expectedType", expectedType);
3981
+ if (@object == null)
3982
+ {
3983
+ if (exactMatch)
3984
+ {
3985
+ throw IsTypeException.ForMismatchedType(ArgumentFormatter.Format(expectedType), null);
3986
+ }
3987
+ throw IsTypeException.ForIncompatibleType(ArgumentFormatter.Format(expectedType), null);
3988
+ }
3989
+ System.Type type = @object.GetType();
3990
+ if (!(exactMatch ? (expectedType == type) : IntrospectionExtensions.GetTypeInfo(expectedType).IsAssignableFrom(IntrospectionExtensions.GetTypeInfo(type))))
3991
+ {
3992
+ string text = ArgumentFormatter.Format(expectedType);
3993
+ string text2 = ArgumentFormatter.Format(type);
3994
+ if (text == text2)
3995
+ {
3996
+ text += string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, " (from {0})", (object)((System.Type)(object)IntrospectionExtensions.GetTypeInfo(expectedType)).Assembly.GetName().FullName);
3997
+ text2 += string.Format((IFormatProvider)(object)CultureInfo.CurrentCulture, " (from {0})", (object)((System.Type)(object)IntrospectionExtensions.GetTypeInfo(type)).Assembly.GetName().FullName);
3998
+ }
3999
+ if (exactMatch)
4000
+ {
4001
+ throw IsTypeException.ForMismatchedType(text, text2);
4002
+ }
4003
+ throw IsTypeException.ForIncompatibleType(text, text2);
4004
+ }
4005
+ }
4006
+ static Assert()
4007
+ {
4008
+ HashSet<char> obj = new HashSet<char>();
4009
+ obj.Add('\r');
4010
+ obj.Add('\n');
4011
+ charsLineEndings = obj;
4012
+ HashSet<char> obj2 = new HashSet<char>();
4013
+ obj2.Add('\t');
4014
+ obj2.Add(' ');
4015
+ obj2.Add('\u00a0');
4016
+ obj2.Add('\u1680');
4017
+ obj2.Add('\u180e');
4018
+ obj2.Add('\u2000');
4019
+ obj2.Add('\u2001');
4020
+ obj2.Add('\u2002');
4021
+ obj2.Add('\u2003');
4022
+ obj2.Add('\u2004');
4023
+ obj2.Add('\u2005');
4024
+ obj2.Add('\u2006');
4025
+ obj2.Add('\u2007');
4026
+ obj2.Add('\u2008');
4027
+ obj2.Add('\u2009');
4028
+ obj2.Add('\u200a');
4029
+ obj2.Add('\u200b');
4030
+ obj2.Add('\u202f');
4031
+ obj2.Add('\u205f');
4032
+ obj2.Add('\u3000');
4033
+ obj2.Add('\ufeff');
4034
+ charsWhitespace = obj2;
4035
+ }
4036
+ }
4037
+ ```