com.wallstop-studios.unity-helpers 2.0.0-rc81.7 → 2.0.0-rc81.9

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 (1449) hide show
  1. package/.config/dotnet-tools.json +10 -10
  2. package/.csharpierignore +1 -0
  3. package/.csharpierrc.json +3 -0
  4. package/.editorconfig +184 -184
  5. package/.gitattributes +87 -63
  6. package/.githooks/pre-commit +49 -0
  7. package/.github/dependabot.yml +9 -9
  8. package/.github/workflows/csharpier.yml +135 -0
  9. package/.github/workflows/lint-doc-links.yml +27 -0
  10. package/.github/workflows/markdown-json.yml +41 -0
  11. package/.github/workflows/npm-publish.yml +75 -75
  12. package/.lychee.toml +26 -0
  13. package/.markdownlint.json +21 -0
  14. package/.markdownlintignore +8 -0
  15. package/.pre-commit-config.yaml +39 -22
  16. package/.prettierignore +22 -0
  17. package/.prettierrc.json +20 -0
  18. package/AGENTS.md +52 -0
  19. package/{Third Party Notices.md.meta → AGENTS.md.meta} +7 -7
  20. package/CHANGELOG.md.meta +7 -7
  21. package/DATA_STRUCTURES.md +324 -0
  22. package/DATA_STRUCTURES.md.meta +7 -0
  23. package/Docs/Images/attribute_resolution.svg +40 -0
  24. package/Docs/Images/attribute_resolution.svg.meta +7 -0
  25. package/Docs/Images/bitset.svg +47 -0
  26. package/Docs/Images/bitset.svg.meta +7 -0
  27. package/Docs/Images/concave_hull.svg +30 -0
  28. package/Docs/Images/concave_hull.svg.meta +7 -0
  29. package/Docs/Images/convex_hull.svg +29 -0
  30. package/Docs/Images/convex_hull.svg.meta +7 -0
  31. package/Docs/Images/cyclic_buffer.svg +37 -0
  32. package/Docs/Images/cyclic_buffer.svg.meta +7 -0
  33. package/Docs/Images/data_distribution_decision.svg +88 -0
  34. package/Docs/Images/data_distribution_decision.svg.meta +7 -0
  35. package/Docs/Images/deque.svg +64 -0
  36. package/Docs/Images/deque.svg.meta +7 -0
  37. package/Docs/Images/deque_queue.svg +107 -0
  38. package/Docs/Images/deque_queue.svg.meta +7 -0
  39. package/Docs/Images/disjoint_set.svg +47 -0
  40. package/Docs/Images/disjoint_set.svg.meta +7 -0
  41. package/Docs/Images/effects_pipeline.svg +59 -0
  42. package/Docs/Images/effects_pipeline.svg.meta +7 -0
  43. package/Docs/Images/geometry_edge_cases.svg +61 -0
  44. package/Docs/Images/geometry_edge_cases.svg.meta +7 -0
  45. package/Docs/Images/heap.svg +56 -0
  46. package/Docs/Images/heap.svg.meta +7 -0
  47. package/Docs/Images/kdtree_2d.svg +38 -0
  48. package/Docs/Images/kdtree_2d.svg.meta +7 -0
  49. package/Docs/Images/kdtree_3d.svg +83 -0
  50. package/Docs/Images/kdtree_3d.svg.meta +7 -0
  51. package/Docs/Images/octree_3d.svg +79 -0
  52. package/Docs/Images/octree_3d.svg.meta +7 -0
  53. package/Docs/Images/polyline_simplify.svg +18 -0
  54. package/Docs/Images/polyline_simplify.svg.meta +7 -0
  55. package/Docs/Images/quadtree_2d.svg +37 -0
  56. package/Docs/Images/quadtree_2d.svg.meta +7 -0
  57. package/Docs/Images/query_boundaries.svg +38 -0
  58. package/Docs/Images/query_boundaries.svg.meta +7 -0
  59. package/Docs/Images/random_generators.svg +105 -0
  60. package/Docs/Images/random_generators.svg.meta +7 -0
  61. package/Docs/Images/reflection_scan.svg +33 -0
  62. package/Docs/Images/reflection_scan.svg.meta +7 -0
  63. package/Docs/Images/relational_wiring.svg +75 -0
  64. package/Docs/Images/relational_wiring.svg.meta +7 -0
  65. package/Docs/Images/rtree_2d.svg +27 -0
  66. package/Docs/Images/rtree_2d.svg.meta +7 -0
  67. package/Docs/Images/rtree_3d.svg +79 -0
  68. package/Docs/Images/rtree_3d.svg.meta +7 -0
  69. package/Docs/Images/serialization_flow.svg +50 -0
  70. package/Docs/Images/serialization_flow.svg.meta +7 -0
  71. package/Docs/Images/singletons_lifecycle.svg +54 -0
  72. package/Docs/Images/singletons_lifecycle.svg.meta +7 -0
  73. package/Docs/Images/sparse_set.svg +54 -0
  74. package/Docs/Images/sparse_set.svg.meta +7 -0
  75. package/Docs/Images/trie.svg +55 -0
  76. package/Docs/Images/trie.svg.meta +7 -0
  77. package/Docs/Images.meta +8 -0
  78. package/Docs.meta +8 -0
  79. package/EDITOR_TOOLS_GUIDE.md +1976 -0
  80. package/EDITOR_TOOLS_GUIDE.md.meta +7 -0
  81. package/EFFECTS_SYSTEM.md +242 -0
  82. package/EFFECTS_SYSTEM.md.meta +7 -0
  83. package/EFFECTS_SYSTEM_TUTORIAL.md +467 -0
  84. package/EFFECTS_SYSTEM_TUTORIAL.md.meta +7 -0
  85. package/Editor/AnimationEventEditor.cs +1393 -874
  86. package/Editor/AnimationEventEditor.cs.meta +11 -11
  87. package/Editor/AssemblyInfo.cs +4 -0
  88. package/Editor/AssemblyInfo.cs.meta +3 -0
  89. package/Editor/AssetProcessors/SpriteLabelProcessor.cs +138 -111
  90. package/Editor/AssetProcessors/SpriteLabelProcessor.cs.meta +2 -2
  91. package/Editor/AssetProcessors.meta +2 -2
  92. package/Editor/Core/Helper/AnimationEventHelpers.cs +204 -0
  93. package/{Runtime/Core/DataStructure/ISpatialTree.cs.meta → Editor/Core/Helper/AnimationEventHelpers.cs.meta} +11 -11
  94. package/Editor/Core/Helper.meta +8 -0
  95. package/Editor/Core.meta +8 -0
  96. package/Editor/CustomDrawers/IntDropdownDrawer.cs +46 -46
  97. package/Editor/CustomDrawers/IntDropdownDrawer.cs.meta +2 -2
  98. package/Editor/CustomDrawers/StringInListeDrawer.cs +135 -135
  99. package/Editor/CustomDrawers/StringInListeDrawer.cs.meta +2 -2
  100. package/Editor/CustomDrawers/WShowIfPropertyDrawer.cs +105 -105
  101. package/Editor/CustomDrawers/WShowIfPropertyDrawer.cs.meta +2 -2
  102. package/Editor/CustomDrawers.meta +2 -2
  103. package/Editor/CustomEditors/MatchColliderToSpriteEditor.cs +32 -32
  104. package/Editor/CustomEditors/MatchColliderToSpriteEditor.cs.meta +2 -2
  105. package/Editor/CustomEditors/PersistentDirectoryGUI.cs +799 -799
  106. package/Editor/CustomEditors/PersistentDirectoryGUI.cs.meta +2 -2
  107. package/Editor/CustomEditors/PolygonCollider2DOptimizerEditor.cs +38 -40
  108. package/Editor/CustomEditors/PolygonCollider2DOptimizerEditor.cs.meta +2 -2
  109. package/Editor/CustomEditors/SourceFolderEntryDrawer.cs +685 -413
  110. package/Editor/CustomEditors/SourceFolderEntryDrawer.cs.meta +2 -2
  111. package/Editor/CustomEditors/TexturePlatformOverrideEntryDrawer.cs +146 -0
  112. package/{Runtime/Core/DataStructure/KDTree.cs.meta → Editor/CustomEditors/TexturePlatformOverrideEntryDrawer.cs.meta} +11 -11
  113. package/Editor/CustomEditors.meta +2 -2
  114. package/Editor/Extensions/SerializedPropertyExtensions.cs +217 -190
  115. package/Editor/Extensions/SerializedPropertyExtensions.cs.meta +2 -2
  116. package/Editor/Extensions/UnityExtensions.cs +50 -26
  117. package/Editor/Extensions/UnityExtensions.cs.meta +2 -2
  118. package/Editor/Extensions.meta +2 -2
  119. package/Editor/FitTextureSizeWindow.cs +785 -332
  120. package/Editor/FitTextureSizeWindow.cs.meta +2 -2
  121. package/Editor/Persistence/MultiFileSelectorPersistenceManager.cs +62 -0
  122. package/{Runtime/Core/DataStructure/QuadTree.cs.meta → Editor/Persistence/MultiFileSelectorPersistenceManager.cs.meta} +11 -11
  123. package/Editor/Persistence/MultiFileSelectorPersistenceWindow.cs +65 -0
  124. package/Editor/Persistence/MultiFileSelectorPersistenceWindow.cs.meta +11 -0
  125. package/Editor/Persistence.meta +8 -0
  126. package/Editor/PersistentDirectorySettings.cs +529 -248
  127. package/Editor/PersistentDirectorySettings.cs.meta +2 -2
  128. package/Editor/PrefabChecker.cs +1329 -741
  129. package/Editor/PrefabChecker.cs.meta +11 -11
  130. package/Editor/Sprites/AnimationCopier.cs +1518 -789
  131. package/Editor/Sprites/AnimationCopier.cs.meta +2 -2
  132. package/Editor/Sprites/AnimationCreator.cs +1532 -881
  133. package/Editor/Sprites/AnimationCreator.cs.meta +11 -11
  134. package/Editor/Sprites/AnimationViewerWindow.cs +1634 -1522
  135. package/Editor/Sprites/AnimationViewerWindow.cs.meta +2 -2
  136. package/Editor/Sprites/ScriptableSpriteAtlas.cs +251 -178
  137. package/Editor/Sprites/ScriptableSpriteAtlas.cs.meta +2 -2
  138. package/Editor/Sprites/ScriptableSpriteAtlasEditor.cs +1470 -1026
  139. package/Editor/Sprites/ScriptableSpriteAtlasEditor.cs.meta +2 -2
  140. package/Editor/Sprites/SpriteCropper.cs +1013 -523
  141. package/Editor/Sprites/SpriteCropper.cs.meta +2 -2
  142. package/Editor/Sprites/SpritePivotAdjustor.cs +605 -265
  143. package/Editor/Sprites/SpritePivotAdjustor.cs.meta +2 -2
  144. package/Editor/Sprites/SpriteSettingsApplier.cs +942 -918
  145. package/Editor/Sprites/SpriteSettingsApplier.cs.meta +2 -2
  146. package/Editor/Sprites/SpriteSettingsApplierAPI.cs +441 -0
  147. package/Editor/Sprites/SpriteSettingsApplierAPI.cs.meta +11 -0
  148. package/Editor/Sprites/SpriteSettingsProfileCollection.cs +12 -0
  149. package/Editor/Sprites/SpriteSettingsProfileCollection.cs.meta +11 -0
  150. package/Editor/Sprites/SpriteSheetAnimationCreator.cs +1586 -1537
  151. package/Editor/Sprites/SpriteSheetAnimationCreator.cs.meta +2 -2
  152. package/Editor/Sprites/TexturePlatformNameHelper.cs +78 -0
  153. package/Editor/Sprites/TexturePlatformNameHelper.cs.meta +11 -0
  154. package/Editor/Sprites/TextureResizerWizard.cs +434 -175
  155. package/Editor/Sprites/TextureResizerWizard.cs.meta +2 -2
  156. package/Editor/Sprites/TextureSettingsApplierAPI.cs +359 -0
  157. package/Editor/Sprites/TextureSettingsApplierAPI.cs.meta +11 -0
  158. package/Editor/Sprites/TextureSettingsApplierWindow.cs +605 -0
  159. package/Editor/Sprites/TextureSettingsApplierWindow.cs.meta +11 -0
  160. package/Editor/Sprites.meta +2 -2
  161. package/Editor/Styles/AnimationViewer.uss +115 -115
  162. package/Editor/Styles/AnimationViewer.uss.meta +2 -2
  163. package/Editor/Styles/AnimationViewer.uxml +56 -56
  164. package/Editor/Styles/AnimationViewer.uxml.meta +2 -2
  165. package/Editor/Styles/SpriteSheetAnimationCreator.uss +10 -0
  166. package/Editor/Styles/SpriteSheetAnimationCreator.uss.meta +11 -0
  167. package/Editor/Styles.meta +2 -2
  168. package/Editor/Tags/AttributeMetadataCacheEditor.cs +46 -0
  169. package/Editor/Tags/AttributeMetadataCacheEditor.cs.meta +11 -0
  170. package/Editor/Tags/AttributeMetadataCacheGenerator.cs +258 -0
  171. package/Editor/Tags/AttributeMetadataCacheGenerator.cs.meta +11 -0
  172. package/Editor/Tags.meta +8 -0
  173. package/Editor/Tools/ImageBlurTool.cs +451 -409
  174. package/Editor/Tools/ImageBlurTool.cs.meta +2 -2
  175. package/Editor/Tools.meta +2 -2
  176. package/Editor/Utils/DxReadOnlyPropertyDrawer.cs +26 -26
  177. package/Editor/Utils/DxReadOnlyPropertyDrawer.cs.meta +11 -11
  178. package/Editor/Utils/EditorUi.cs +228 -0
  179. package/Editor/Utils/EditorUi.cs.meta +11 -0
  180. package/Editor/Utils/EditorUtilities.cs +22 -22
  181. package/Editor/Utils/EditorUtilities.cs.meta +11 -11
  182. package/Editor/Utils/ScriptableObjectSingletonCreator.cs +633 -52
  183. package/Editor/Utils/ScriptableObjectSingletonCreator.cs.meta +2 -2
  184. package/Editor/Utils.meta +8 -8
  185. package/Editor/Visuals/EnhancedImageEditor.cs +160 -160
  186. package/Editor/Visuals/EnhancedImageEditor.cs.meta +11 -11
  187. package/Editor/Visuals.meta +2 -2
  188. package/Editor/WallstopStudios.UnityHelpers.Editor.asmdef +14 -18
  189. package/Editor/WallstopStudios.UnityHelpers.Editor.asmdef.meta +7 -7
  190. package/Editor.meta +8 -8
  191. package/GETTING_STARTED.md +425 -0
  192. package/GETTING_STARTED.md.meta +7 -0
  193. package/GLOSSARY.md +313 -0
  194. package/GLOSSARY.md.meta +7 -0
  195. package/HULLS.md +45 -0
  196. package/HULLS.md.meta +7 -0
  197. package/INDEX.md +429 -0
  198. package/INDEX.md.meta +7 -0
  199. package/LICENSE +21 -21
  200. package/LICENSE.md +7 -7
  201. package/LICENSE.md.meta +7 -7
  202. package/LICENSE.meta +7 -7
  203. package/MATH_AND_EXTENSIONS.md +316 -0
  204. package/MATH_AND_EXTENSIONS.md.meta +7 -0
  205. package/RANDOM_PERFORMANCE.md +140 -0
  206. package/RANDOM_PERFORMANCE.md.meta +7 -0
  207. package/README.md +3195 -188
  208. package/README.md.meta +7 -7
  209. package/REFLECTION_HELPERS.md +272 -0
  210. package/REFLECTION_HELPERS.md.meta +7 -0
  211. package/RELATIONAL_COMPONENTS.md +543 -0
  212. package/RELATIONAL_COMPONENTS.md.meta +7 -0
  213. package/Runtime/AssemblyInfo.cs +7 -0
  214. package/Runtime/AssemblyInfo.cs.meta +11 -0
  215. package/Runtime/Binaries/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  216. package/Runtime/Binaries/Microsoft.Bcl.AsyncInterfaces.dll.meta +33 -33
  217. package/Runtime/Binaries/Microsoft.Bcl.AsyncInterfaces.xml +499 -278
  218. package/Runtime/Binaries/Microsoft.Bcl.AsyncInterfaces.xml.meta +7 -7
  219. package/Runtime/Binaries/System.IO.Pipelines.dll +0 -0
  220. package/Runtime/Binaries/System.IO.Pipelines.dll.meta +33 -0
  221. package/Runtime/Binaries/System.IO.Pipelines.xml +702 -0
  222. package/Runtime/Binaries/System.IO.Pipelines.xml.meta +7 -0
  223. package/Runtime/Binaries/System.Text.Encodings.Web.dll +0 -0
  224. package/Runtime/Binaries/System.Text.Encodings.Web.dll.meta +33 -33
  225. package/Runtime/Binaries/System.Text.Encodings.Web.xml +1084 -1079
  226. package/Runtime/Binaries/System.Text.Encodings.Web.xml.meta +7 -7
  227. package/Runtime/Binaries/System.Text.Json.dll +0 -0
  228. package/Runtime/Binaries/System.Text.Json.dll.meta +33 -33
  229. package/Runtime/Binaries/System.Text.Json.xml +10217 -8116
  230. package/Runtime/Binaries/System.Text.Json.xml.meta +7 -7
  231. package/Runtime/Binaries.meta +8 -8
  232. package/Runtime/Core/Attributes/AnimationEventAttribute.cs +10 -138
  233. package/Runtime/Core/Attributes/AnimationEventAttribute.cs.meta +11 -11
  234. package/Runtime/Core/Attributes/BaseRelationalComponentAttribute.cs +841 -0
  235. package/Runtime/Core/Attributes/BaseRelationalComponentAttribute.cs.meta +11 -0
  236. package/Runtime/Core/Attributes/ChildComponentAttribute.cs +284 -226
  237. package/Runtime/Core/Attributes/ChildComponentAttribute.cs.meta +11 -11
  238. package/Runtime/Core/Attributes/DxReadOnlyAttribute.cs +6 -6
  239. package/Runtime/Core/Attributes/DxReadOnlyAttribute.cs.meta +11 -11
  240. package/Runtime/Core/Attributes/EnumDisplayNameAttribute.cs +15 -15
  241. package/Runtime/Core/Attributes/EnumDisplayNameAttribute.cs.meta +2 -2
  242. package/Runtime/Core/Attributes/IRelationalComponentAssigner.cs +36 -0
  243. package/Runtime/Core/Attributes/IRelationalComponentAssigner.cs.meta +11 -0
  244. package/Runtime/Core/Attributes/IntDropdownAttribute.cs +14 -14
  245. package/Runtime/Core/Attributes/IntDropdownAttribute.cs.meta +2 -2
  246. package/Runtime/Core/Attributes/KSerializableAttribute.cs +19 -19
  247. package/Runtime/Core/Attributes/KSerializableAttribute.cs.meta +11 -11
  248. package/Runtime/Core/Attributes/NotNullAttribute.cs +32 -32
  249. package/Runtime/Core/Attributes/NotNullAttribute.cs.meta +11 -11
  250. package/Runtime/Core/Attributes/ParentComponentAttribute.cs +376 -0
  251. package/Runtime/Core/Attributes/{ParentComponent.cs.meta → ParentComponentAttribute.cs.meta} +11 -11
  252. package/Runtime/Core/Attributes/RelationalComponentAssigner.cs +107 -0
  253. package/Runtime/Core/Attributes/RelationalComponentAssigner.cs.meta +11 -0
  254. package/Runtime/Core/Attributes/RelationalComponentExtensions.cs +61 -14
  255. package/Runtime/Core/Attributes/RelationalComponentExtensions.cs.meta +11 -11
  256. package/Runtime/Core/Attributes/RelationalComponentInitializer.cs +331 -0
  257. package/Runtime/Core/Attributes/RelationalComponentInitializer.cs.meta +11 -0
  258. package/Runtime/Core/Attributes/ScriptableSingletonPathAttribute.cs +15 -15
  259. package/Runtime/Core/Attributes/ScriptableSingletonPathAttribute.cs.meta +2 -2
  260. package/Runtime/Core/Attributes/SiblingComponentAttribute.cs +264 -137
  261. package/Runtime/Core/Attributes/SiblingComponentAttribute.cs.meta +11 -11
  262. package/Runtime/Core/Attributes/ValidateAssignmentAttribute.cs +115 -106
  263. package/Runtime/Core/Attributes/ValidateAssignmentAttribute.cs.meta +11 -11
  264. package/Runtime/Core/Attributes/ValueHelpers.cs +10 -0
  265. package/Runtime/Core/Attributes/ValueHelpers.cs.meta +3 -0
  266. package/Runtime/Core/Attributes/WShowIfAttribute.cs +24 -24
  267. package/Runtime/Core/Attributes/WShowIfAttribute.cs.meta +2 -2
  268. package/Runtime/Core/Attributes.meta +8 -8
  269. package/Runtime/Core/DataStructure/Adapters/FastVector2Int.cs +192 -92
  270. package/Runtime/Core/DataStructure/Adapters/FastVector2Int.cs.meta +11 -11
  271. package/Runtime/Core/DataStructure/Adapters/FastVector3Int.cs +268 -185
  272. package/Runtime/Core/DataStructure/Adapters/FastVector3Int.cs.meta +11 -11
  273. package/Runtime/Core/DataStructure/Adapters/KGuid.cs +360 -305
  274. package/Runtime/Core/DataStructure/Adapters/KGuid.cs.meta +11 -11
  275. package/Runtime/Core/DataStructure/Adapters/KVector2.cs +146 -80
  276. package/Runtime/Core/DataStructure/Adapters/KVector2.cs.meta +11 -11
  277. package/Runtime/Core/DataStructure/Adapters.meta +8 -8
  278. package/Runtime/Core/DataStructure/BitSet.cs +626 -0
  279. package/Runtime/Core/DataStructure/BitSet.cs.meta +11 -0
  280. package/Runtime/Core/DataStructure/BoundingBox3D.cs +405 -0
  281. package/Runtime/Core/DataStructure/BoundingBox3D.cs.meta +11 -0
  282. package/Runtime/Core/DataStructure/Circle.cs +203 -50
  283. package/Runtime/Core/DataStructure/Circle.cs.meta +11 -11
  284. package/Runtime/Core/DataStructure/CyclicBuffer.cs +489 -266
  285. package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +11 -11
  286. package/Runtime/Core/DataStructure/Deque.cs +561 -0
  287. package/Runtime/Core/DataStructure/Deque.cs.meta +11 -0
  288. package/Runtime/Core/DataStructure/DisjointSet.cs +483 -0
  289. package/Runtime/Core/DataStructure/DisjointSet.cs.meta +11 -0
  290. package/Runtime/Core/DataStructure/Heap.cs +514 -0
  291. package/Runtime/Core/DataStructure/Heap.cs.meta +11 -0
  292. package/Runtime/Core/DataStructure/{ISpatialTree.cs → ISpatialTree2D.cs} +25 -21
  293. package/Runtime/Core/DataStructure/ISpatialTree2D.cs.meta +11 -0
  294. package/Runtime/Core/DataStructure/ISpatialTree3D.cs +33 -0
  295. package/Runtime/Core/DataStructure/ISpatialTree3D.cs.meta +11 -0
  296. package/Runtime/Core/DataStructure/ImmutableBitSet.cs +398 -0
  297. package/Runtime/Core/DataStructure/ImmutableBitSet.cs.meta +3 -0
  298. package/Runtime/Core/DataStructure/KDTree2D.cs +852 -0
  299. package/Runtime/Core/DataStructure/KDTree2D.cs.meta +11 -0
  300. package/Runtime/Core/DataStructure/KDTree3D.cs +911 -0
  301. package/Runtime/Core/DataStructure/KDTree3D.cs.meta +11 -0
  302. package/Runtime/Core/DataStructure/OctTree3D.cs +983 -0
  303. package/Runtime/Core/DataStructure/OctTree3D.cs.meta +11 -0
  304. package/Runtime/Core/DataStructure/PriorityQueue.cs +194 -0
  305. package/Runtime/Core/DataStructure/PriorityQueue.cs.meta +11 -0
  306. package/Runtime/Core/DataStructure/QuadTree2D.cs +722 -0
  307. package/Runtime/Core/DataStructure/QuadTree2D.cs.meta +11 -0
  308. package/Runtime/Core/DataStructure/RTree2D.cs +704 -0
  309. package/Runtime/Core/DataStructure/{RTree.cs.meta → RTree2D.cs.meta} +11 -11
  310. package/Runtime/Core/DataStructure/RTree3D.cs +775 -0
  311. package/Runtime/Core/DataStructure/RTree3D.cs.meta +11 -0
  312. package/Runtime/Core/DataStructure/SparseSet.cs +597 -0
  313. package/Runtime/Core/DataStructure/SparseSet.cs.meta +11 -0
  314. package/Runtime/Core/DataStructure/SpatialHash2D.cs +312 -0
  315. package/Runtime/Core/DataStructure/SpatialHash2D.cs.meta +3 -0
  316. package/Runtime/Core/DataStructure/SpatialHash3D.cs +341 -0
  317. package/Runtime/Core/DataStructure/SpatialHash3D.cs.meta +11 -0
  318. package/Runtime/Core/DataStructure/Sphere.cs +264 -0
  319. package/Runtime/Core/DataStructure/Sphere.cs.meta +11 -0
  320. package/Runtime/Core/DataStructure/StringWrapper.cs +115 -91
  321. package/Runtime/Core/DataStructure/StringWrapper.cs.meta +11 -11
  322. package/Runtime/Core/DataStructure/TimedCache.cs +88 -66
  323. package/Runtime/Core/DataStructure/TimedCache.cs.meta +11 -11
  324. package/Runtime/Core/DataStructure/Trie.cs +660 -359
  325. package/Runtime/Core/DataStructure/Trie.cs.meta +2 -2
  326. package/Runtime/Core/DataStructure.meta +8 -8
  327. package/Runtime/Core/Extension/AnimatorExtensions.cs +40 -25
  328. package/Runtime/Core/Extension/AnimatorExtensions.cs.meta +11 -11
  329. package/Runtime/Core/Extension/AsyncOperationExtensions.cs +404 -110
  330. package/Runtime/Core/Extension/AsyncOperationExtensions.cs.meta +2 -2
  331. package/Runtime/Core/Extension/CircleExtensions.cs +125 -25
  332. package/Runtime/Core/Extension/CircleExtensions.cs.meta +11 -11
  333. package/Runtime/Core/Extension/ColorExtensions.cs +983 -644
  334. package/Runtime/Core/Extension/ColorExtensions.cs.meta +11 -11
  335. package/Runtime/Core/Extension/DictionaryExtensions.cs +606 -299
  336. package/Runtime/Core/Extension/DictionaryExtensions.cs.meta +11 -11
  337. package/Runtime/Core/Extension/DirectionExtensions.cs +377 -213
  338. package/Runtime/Core/Extension/DirectionExtensions.cs.meta +11 -11
  339. package/Runtime/Core/Extension/EnumExtensions.cs +535 -137
  340. package/Runtime/Core/Extension/EnumExtensions.cs.meta +2 -2
  341. package/Runtime/Core/Extension/IEnumerableExtensions.cs +341 -124
  342. package/Runtime/Core/Extension/IEnumerableExtensions.cs.meta +11 -11
  343. package/Runtime/Core/Extension/IListExtensions.cs +767 -248
  344. package/Runtime/Core/Extension/IListExtensions.cs.meta +11 -11
  345. package/Runtime/Core/Extension/IReadonlyListExtensions.cs +687 -37
  346. package/Runtime/Core/Extension/IReadonlyListExtensions.cs.meta +2 -2
  347. package/Runtime/Core/Extension/ProtoEqualityExtensions.cs +292 -0
  348. package/Runtime/Core/Extension/ProtoEqualityExtensions.cs.meta +3 -0
  349. package/Runtime/Core/Extension/RandomExtensions.cs +938 -109
  350. package/Runtime/Core/Extension/RandomExtensions.cs.meta +11 -11
  351. package/Runtime/Core/Extension/StringExtensions.cs +1635 -239
  352. package/Runtime/Core/Extension/StringExtensions.cs.meta +11 -11
  353. package/Runtime/Core/Extension/UnityExtensions.cs +4555 -1689
  354. package/Runtime/Core/Extension/UnityExtensions.cs.meta +11 -11
  355. package/Runtime/Core/Extension/WallstopStudiosLogger.cs +271 -245
  356. package/Runtime/Core/Extension/WallstopStudiosLogger.cs.meta +11 -11
  357. package/Runtime/Core/Extension.meta +8 -8
  358. package/Runtime/Core/Helper/ArrayConverter.cs +73 -39
  359. package/Runtime/Core/Helper/ArrayConverter.cs.meta +2 -2
  360. package/Runtime/Core/Helper/AssignUtilities.cs +33 -14
  361. package/Runtime/Core/Helper/AssignUtilities.cs.meta +11 -11
  362. package/Runtime/Core/Helper/DirectoryHelper.cs +210 -196
  363. package/Runtime/Core/Helper/DirectoryHelper.cs.meta +2 -2
  364. package/Runtime/Core/Helper/Enumerables.cs +51 -17
  365. package/Runtime/Core/Helper/Enumerables.cs.meta +11 -11
  366. package/Runtime/Core/Helper/FileHelper.cs +97 -77
  367. package/Runtime/Core/Helper/FileHelper.cs.meta +2 -2
  368. package/Runtime/Core/Helper/FormattingHelpers.cs +49 -38
  369. package/Runtime/Core/Helper/FormattingHelpers.cs.meta +2 -2
  370. package/Runtime/Core/Helper/FuncBasedComparer.cs +29 -0
  371. package/Runtime/Core/Helper/FuncBasedComparer.cs.meta +3 -0
  372. package/Runtime/Core/Helper/Geometry.cs +65 -43
  373. package/Runtime/Core/Helper/Geometry.cs.meta +11 -11
  374. package/Runtime/Core/Helper/Helpers.cs +1271 -831
  375. package/Runtime/Core/Helper/Helpers.cs.meta +11 -11
  376. package/Runtime/Core/Helper/IterationHelpers.cs +83 -32
  377. package/Runtime/Core/Helper/IterationHelpers.cs.meta +11 -11
  378. package/Runtime/Core/Helper/LifetimeHelpers.cs +20 -13
  379. package/Runtime/Core/Helper/LifetimeHelpers.cs.meta +11 -11
  380. package/Runtime/Core/Helper/LineHelper.cs +259 -194
  381. package/Runtime/Core/Helper/LineHelper.cs.meta +2 -2
  382. package/Runtime/Core/Helper/Logging/UnityLogTagFormatter.cs +549 -539
  383. package/Runtime/Core/Helper/Logging/UnityLogTagFormatter.cs.meta +2 -2
  384. package/Runtime/Core/Helper/Logging.meta +2 -2
  385. package/Runtime/Core/Helper/Objects.cs +477 -769
  386. package/Runtime/Core/Helper/Objects.cs.meta +11 -11
  387. package/Runtime/Core/Helper/Partials/LogHelpers.cs +13 -13
  388. package/Runtime/Core/Helper/Partials/LogHelpers.cs.meta +2 -2
  389. package/Runtime/Core/Helper/Partials/MathHelpers.cs +45 -30
  390. package/Runtime/Core/Helper/Partials/MathHelpers.cs.meta +2 -2
  391. package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +506 -400
  392. package/Runtime/Core/Helper/Partials/ObjectHelpers.cs.meta +2 -2
  393. package/Runtime/Core/Helper/Partials/TransformHelpers.cs +393 -377
  394. package/Runtime/Core/Helper/Partials/TransformHelpers.cs.meta +2 -2
  395. package/Runtime/Core/Helper/Partials.meta +2 -2
  396. package/Runtime/Core/Helper/PathHelper.cs +42 -15
  397. package/Runtime/Core/Helper/PathHelper.cs.meta +2 -2
  398. package/Runtime/Core/Helper/ReflectionHelpers.cs +5287 -1963
  399. package/Runtime/Core/Helper/ReflectionHelpers.cs.meta +2 -2
  400. package/Runtime/Core/Helper/ReverseComparer.cs +33 -0
  401. package/Runtime/Core/Helper/ReverseComparer.cs.meta +3 -0
  402. package/Runtime/Core/Helper/SceneHelper.cs +251 -224
  403. package/Runtime/Core/Helper/SceneHelper.cs.meta +2 -2
  404. package/Runtime/Core/Helper/SpriteHelpers.cs +50 -41
  405. package/Runtime/Core/Helper/SpriteHelpers.cs.meta +11 -11
  406. package/Runtime/Core/Helper/StringInList.cs +61 -35
  407. package/Runtime/Core/Helper/StringInList.cs.meta +11 -11
  408. package/Runtime/Core/Helper/TestAssemblyHelper.cs +134 -0
  409. package/Runtime/Core/Helper/TestAssemblyHelper.cs.meta +11 -0
  410. package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +100 -82
  411. package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs.meta +2 -2
  412. package/Runtime/Core/Helper/WallMath.cs +672 -166
  413. package/Runtime/Core/Helper/WallMath.cs.meta +11 -11
  414. package/Runtime/Core/Helper.meta +8 -8
  415. package/Runtime/Core/Math/Line2D.cs +263 -0
  416. package/Runtime/Core/Math/Line2D.cs.meta +11 -0
  417. package/Runtime/Core/Math/Line3D.cs +452 -0
  418. package/Runtime/Core/Math/Line3D.cs.meta +11 -0
  419. package/Runtime/Core/Math/Parabola.cs +241 -47
  420. package/Runtime/Core/Math/Parabola.cs.meta +11 -11
  421. package/Runtime/Core/Math/PointPolygonCheck.cs +175 -36
  422. package/Runtime/Core/Math/PointPolygonCheck.cs.meta +11 -11
  423. package/Runtime/Core/Math/Range.cs +157 -92
  424. package/Runtime/Core/Math/Range.cs.meta +11 -11
  425. package/Runtime/Core/Math.meta +8 -8
  426. package/Runtime/Core/Model/Direction.cs +25 -43
  427. package/Runtime/Core/Model/Direction.cs.meta +11 -11
  428. package/Runtime/Core/Model.meta +8 -8
  429. package/Runtime/Core/OneOf/FastOneOf.cs +252 -152
  430. package/Runtime/Core/OneOf/FastOneOf.cs.meta +11 -11
  431. package/Runtime/Core/OneOf/FastOneOf2.cs +198 -0
  432. package/Runtime/Core/OneOf/FastOneOf2.cs.meta +11 -0
  433. package/Runtime/Core/OneOf/FastOneOf4.cs +324 -0
  434. package/Runtime/Core/OneOf/FastOneOf4.cs.meta +11 -0
  435. package/Runtime/Core/OneOf/None.cs +30 -4
  436. package/Runtime/Core/OneOf/None.cs.meta +11 -11
  437. package/Runtime/Core/OneOf.meta +8 -8
  438. package/Runtime/Core/Random/AbstractRandom.cs +1318 -655
  439. package/Runtime/Core/Random/AbstractRandom.cs.meta +11 -11
  440. package/Runtime/Core/Random/DotNetRandom.cs +118 -54
  441. package/Runtime/Core/Random/DotNetRandom.cs.meta +2 -2
  442. package/Runtime/Core/Random/IRandom.cs +203 -161
  443. package/Runtime/Core/Random/IRandom.cs.meta +11 -11
  444. package/Runtime/Core/Random/IllusionFlow.cs +171 -107
  445. package/Runtime/Core/Random/IllusionFlow.cs.meta +2 -2
  446. package/Runtime/Core/Random/LinearCongruentialGenerator.cs +90 -49
  447. package/Runtime/Core/Random/LinearCongruentialGenerator.cs.meta +2 -2
  448. package/Runtime/Core/Random/NativePcgRandom.cs +139 -97
  449. package/Runtime/Core/Random/NativePcgRandom.cs.meta +11 -11
  450. package/Runtime/Core/Random/PRNG.cs +21 -7
  451. package/Runtime/Core/Random/PRNG.cs.meta +2 -2
  452. package/Runtime/Core/Random/PcgRandom.cs +243 -149
  453. package/Runtime/Core/Random/PcgRandom.cs.meta +11 -11
  454. package/Runtime/Core/Random/PerlinNoise.cs +369 -369
  455. package/Runtime/Core/Random/PerlinNoise.cs.meta +2 -2
  456. package/Runtime/Core/Random/RandomComparer.cs +34 -0
  457. package/Runtime/Core/Random/RandomComparer.cs.meta +3 -0
  458. package/Runtime/Core/Random/RandomState.cs +206 -131
  459. package/Runtime/Core/Random/RandomState.cs.meta +11 -11
  460. package/Runtime/Core/Random/RandomUtilities.cs +55 -26
  461. package/Runtime/Core/Random/RandomUtilities.cs.meta +11 -11
  462. package/Runtime/Core/Random/RomuDuo.cs +171 -116
  463. package/Runtime/Core/Random/RomuDuo.cs.meta +2 -2
  464. package/Runtime/Core/Random/SplitMix64.cs +134 -94
  465. package/Runtime/Core/Random/SplitMix64.cs.meta +2 -2
  466. package/Runtime/Core/Random/SquirrelRandom.cs +127 -84
  467. package/Runtime/Core/Random/SquirrelRandom.cs.meta +11 -11
  468. package/Runtime/Core/Random/SystemRandom.cs +203 -162
  469. package/Runtime/Core/Random/SystemRandom.cs.meta +11 -11
  470. package/Runtime/Core/Random/ThreadLocalRandom.cs +25 -12
  471. package/Runtime/Core/Random/ThreadLocalRandom.cs.meta +11 -11
  472. package/Runtime/Core/Random/UnityRandom.cs +109 -57
  473. package/Runtime/Core/Random/UnityRandom.cs.meta +11 -11
  474. package/Runtime/Core/Random/WyRandom.cs +158 -121
  475. package/Runtime/Core/Random/WyRandom.cs.meta +2 -2
  476. package/Runtime/Core/Random/XorShiftRandom.cs +106 -52
  477. package/Runtime/Core/Random/XorShiftRandom.cs.meta +11 -11
  478. package/Runtime/Core/Random/XoroShiroRandom.cs +184 -119
  479. package/Runtime/Core/Random/XoroShiroRandom.cs.meta +2 -2
  480. package/Runtime/Core/Random.meta +8 -8
  481. package/Runtime/Core/Serialization/JsonConverters/AnimationCurveConverter.cs +248 -0
  482. package/Runtime/Core/Serialization/JsonConverters/AnimationCurveConverter.cs.meta +11 -0
  483. package/Runtime/Core/Serialization/JsonConverters/BitSetConverter.cs +119 -0
  484. package/Runtime/Core/Serialization/JsonConverters/BitSetConverter.cs.meta +11 -0
  485. package/Runtime/Core/Serialization/JsonConverters/BoundingSphereConverter.cs +74 -0
  486. package/Runtime/Core/Serialization/JsonConverters/BoundingSphereConverter.cs.meta +11 -0
  487. package/Runtime/Core/Serialization/JsonConverters/BoundsConverter.cs +132 -0
  488. package/Runtime/Core/Serialization/JsonConverters/BoundsConverter.cs.meta +11 -0
  489. package/Runtime/Core/Serialization/JsonConverters/BoundsIntConverter.cs +135 -0
  490. package/Runtime/Core/Serialization/JsonConverters/BoundsIntConverter.cs.meta +11 -0
  491. package/Runtime/Core/Serialization/JsonConverters/Color32Converter.cs +98 -0
  492. package/Runtime/Core/Serialization/JsonConverters/Color32Converter.cs.meta +11 -0
  493. package/Runtime/Core/Serialization/JsonConverters/ColorBlockConverter.cs +123 -0
  494. package/Runtime/Core/Serialization/JsonConverters/ColorBlockConverter.cs.meta +11 -0
  495. package/Runtime/Core/Serialization/JsonConverters/ColorConverter.cs +88 -88
  496. package/Runtime/Core/Serialization/JsonConverters/ColorConverter.cs.meta +2 -2
  497. package/Runtime/Core/Serialization/JsonConverters/CyclicBufferConverterFactory.cs +112 -0
  498. package/Runtime/Core/Serialization/JsonConverters/CyclicBufferConverterFactory.cs.meta +11 -0
  499. package/Runtime/Core/Serialization/JsonConverters/DequeConverterFactory.cs +62 -0
  500. package/Runtime/Core/Serialization/JsonConverters/DequeConverterFactory.cs.meta +11 -0
  501. package/Runtime/Core/Serialization/JsonConverters/FastVector2IntConverter.cs +72 -0
  502. package/Runtime/Core/Serialization/JsonConverters/FastVector2IntConverter.cs.meta +11 -0
  503. package/Runtime/Core/Serialization/JsonConverters/FastVector3IntConverter.cs +80 -0
  504. package/Runtime/Core/Serialization/JsonConverters/FastVector3IntConverter.cs.meta +11 -0
  505. package/Runtime/Core/Serialization/JsonConverters/GameObjectConverter.cs +36 -36
  506. package/Runtime/Core/Serialization/JsonConverters/GameObjectConverter.cs.meta +2 -2
  507. package/Runtime/Core/Serialization/JsonConverters/GradientConverter.cs +245 -0
  508. package/Runtime/Core/Serialization/JsonConverters/GradientConverter.cs.meta +11 -0
  509. package/Runtime/Core/Serialization/JsonConverters/Hash128Converter.cs +92 -0
  510. package/Runtime/Core/Serialization/JsonConverters/Hash128Converter.cs.meta +11 -0
  511. package/Runtime/Core/Serialization/JsonConverters/ImmutableBitSetConverter.cs +119 -0
  512. package/Runtime/Core/Serialization/JsonConverters/ImmutableBitSetConverter.cs.meta +11 -0
  513. package/Runtime/Core/Serialization/JsonConverters/KVector2Converter.cs +72 -0
  514. package/Runtime/Core/Serialization/JsonConverters/KVector2Converter.cs.meta +11 -0
  515. package/Runtime/Core/Serialization/JsonConverters/LayerMaskConverter.cs +95 -0
  516. package/Runtime/Core/Serialization/JsonConverters/LayerMaskConverter.cs.meta +11 -0
  517. package/Runtime/Core/Serialization/JsonConverters/Matrix4x4Converter.cs +237 -218
  518. package/Runtime/Core/Serialization/JsonConverters/Matrix4x4Converter.cs.meta +2 -2
  519. package/Runtime/Core/Serialization/JsonConverters/MinMaxCurveConverter.cs +142 -0
  520. package/Runtime/Core/Serialization/JsonConverters/MinMaxCurveConverter.cs.meta +11 -0
  521. package/Runtime/Core/Serialization/JsonConverters/MinMaxGradientConverter.cs +135 -0
  522. package/Runtime/Core/Serialization/JsonConverters/MinMaxGradientConverter.cs.meta +11 -0
  523. package/Runtime/Core/Serialization/JsonConverters/PlaneConverter.cs +79 -0
  524. package/Runtime/Core/Serialization/JsonConverters/PlaneConverter.cs.meta +11 -0
  525. package/Runtime/Core/Serialization/JsonConverters/PoseConverter.cs +76 -0
  526. package/Runtime/Core/Serialization/JsonConverters/PoseConverter.cs.meta +11 -0
  527. package/Runtime/Core/Serialization/JsonConverters/QuaternionConverter.cs +88 -0
  528. package/Runtime/Core/Serialization/JsonConverters/QuaternionConverter.cs.meta +11 -0
  529. package/Runtime/Core/Serialization/JsonConverters/RangeConverterFactory.cs +106 -0
  530. package/Runtime/Core/Serialization/JsonConverters/RangeConverterFactory.cs.meta +11 -0
  531. package/Runtime/Core/Serialization/JsonConverters/RangeIntConverter.cs +71 -0
  532. package/Runtime/Core/Serialization/JsonConverters/RangeIntConverter.cs.meta +11 -0
  533. package/Runtime/Core/Serialization/JsonConverters/Ray2DConverter.cs +80 -0
  534. package/Runtime/Core/Serialization/JsonConverters/Ray2DConverter.cs.meta +11 -0
  535. package/Runtime/Core/Serialization/JsonConverters/RayConverter.cs +76 -0
  536. package/Runtime/Core/Serialization/JsonConverters/RayConverter.cs.meta +11 -0
  537. package/Runtime/Core/Serialization/JsonConverters/RaycastHitConverter.cs +115 -0
  538. package/Runtime/Core/Serialization/JsonConverters/RaycastHitConverter.cs.meta +11 -0
  539. package/Runtime/Core/Serialization/JsonConverters/RectConverter.cs +84 -0
  540. package/Runtime/Core/Serialization/JsonConverters/RectConverter.cs.meta +11 -0
  541. package/Runtime/Core/Serialization/JsonConverters/RectIntConverter.cs +88 -0
  542. package/Runtime/Core/Serialization/JsonConverters/RectIntConverter.cs.meta +11 -0
  543. package/Runtime/Core/Serialization/JsonConverters/RectOffsetConverter.cs +87 -0
  544. package/Runtime/Core/Serialization/JsonConverters/RectOffsetConverter.cs.meta +11 -0
  545. package/Runtime/Core/Serialization/JsonConverters/RenderTextureDescriptorConverter.cs +264 -0
  546. package/Runtime/Core/Serialization/JsonConverters/RenderTextureDescriptorConverter.cs.meta +11 -0
  547. package/Runtime/Core/Serialization/JsonConverters/ResolutionConverter.cs +158 -0
  548. package/Runtime/Core/Serialization/JsonConverters/ResolutionConverter.cs.meta +11 -0
  549. package/Runtime/Core/Serialization/JsonConverters/SceneConverter.cs +103 -0
  550. package/Runtime/Core/Serialization/JsonConverters/SceneConverter.cs.meta +11 -0
  551. package/Runtime/Core/Serialization/JsonConverters/SphericalHarmonicsL2Converter.cs +121 -0
  552. package/Runtime/Core/Serialization/JsonConverters/SphericalHarmonicsL2Converter.cs.meta +11 -0
  553. package/Runtime/Core/Serialization/JsonConverters/TouchConverter.cs +54 -0
  554. package/Runtime/Core/Serialization/JsonConverters/TouchConverter.cs.meta +11 -0
  555. package/Runtime/Core/Serialization/JsonConverters/TypeConverter.cs +30 -28
  556. package/Runtime/Core/Serialization/JsonConverters/TypeConverter.cs.meta +2 -2
  557. package/Runtime/Core/Serialization/JsonConverters/Vector2Converter.cs +72 -74
  558. package/Runtime/Core/Serialization/JsonConverters/Vector2Converter.cs.meta +11 -11
  559. package/Runtime/Core/Serialization/JsonConverters/Vector2IntConverter.cs +72 -0
  560. package/Runtime/Core/Serialization/JsonConverters/Vector2IntConverter.cs.meta +11 -0
  561. package/Runtime/Core/Serialization/JsonConverters/Vector3Converter.cs +80 -81
  562. package/Runtime/Core/Serialization/JsonConverters/Vector3Converter.cs.meta +11 -11
  563. package/Runtime/Core/Serialization/JsonConverters/Vector3IntConverter.cs +80 -0
  564. package/Runtime/Core/Serialization/JsonConverters/Vector3IntConverter.cs.meta +11 -0
  565. package/Runtime/Core/Serialization/JsonConverters/Vector4Converter.cs +88 -88
  566. package/Runtime/Core/Serialization/JsonConverters/Vector4Converter.cs.meta +2 -2
  567. package/Runtime/Core/Serialization/JsonConverters.meta +8 -8
  568. package/Runtime/Core/Serialization/ProtobufUnitySurrogates.cs +383 -0
  569. package/Runtime/Core/Serialization/ProtobufUnitySurrogates.cs.meta +11 -0
  570. package/Runtime/Core/Serialization/Serializer.cs +2020 -195
  571. package/Runtime/Core/Serialization/Serializer.cs.meta +11 -11
  572. package/Runtime/Core/Serialization.meta +8 -8
  573. package/Runtime/Core/Threading/SingleThreadedThreadPool.cs +228 -228
  574. package/Runtime/Core/Threading/SingleThreadedThreadPool.cs.meta +11 -11
  575. package/Runtime/Core/Threading.meta +8 -8
  576. package/Runtime/Core.meta +8 -8
  577. package/Runtime/Integrations/VContainer/ObjectResolverRelationalExtensions.cs +185 -0
  578. package/Runtime/Integrations/VContainer/ObjectResolverRelationalExtensions.cs.meta +11 -0
  579. package/Runtime/Integrations/VContainer/RelationalComponentEntryPoint.cs +109 -0
  580. package/Runtime/Integrations/VContainer/RelationalComponentEntryPoint.cs.meta +11 -0
  581. package/Runtime/Integrations/VContainer/RelationalComponentsBuilderExtensions.cs +78 -0
  582. package/Runtime/Integrations/VContainer/RelationalComponentsBuilderExtensions.cs.meta +11 -0
  583. package/Runtime/Integrations/VContainer/RelationalSceneAssignmentOptions.cs +83 -0
  584. package/Runtime/Integrations/VContainer/RelationalSceneAssignmentOptions.cs.meta +11 -0
  585. package/Runtime/Integrations/VContainer/WallstopStudios.UnityHelpers.Integration.VContainer.asmdef +30 -0
  586. package/Runtime/Integrations/VContainer/WallstopStudios.UnityHelpers.Integration.VContainer.asmdef.meta +7 -0
  587. package/Runtime/Integrations/VContainer.meta +8 -0
  588. package/Runtime/Integrations/Zenject/DiContainerRelationalExtensions.cs +180 -0
  589. package/Runtime/Integrations/Zenject/DiContainerRelationalExtensions.cs.meta +11 -0
  590. package/Runtime/Integrations/Zenject/RelationalComponentSceneInitializer.cs +105 -0
  591. package/Runtime/Integrations/Zenject/RelationalComponentSceneInitializer.cs.meta +11 -0
  592. package/Runtime/Integrations/Zenject/RelationalComponentsInstaller.cs +72 -0
  593. package/Runtime/Integrations/Zenject/RelationalComponentsInstaller.cs.meta +11 -0
  594. package/Runtime/Integrations/Zenject/RelationalSceneAssignmentOptions.cs +87 -0
  595. package/Runtime/Integrations/Zenject/RelationalSceneAssignmentOptions.cs.meta +11 -0
  596. package/Runtime/Integrations/Zenject/WallstopStudios.UnityHelpers.Integration.Zenject.asmdef +30 -0
  597. package/Runtime/Integrations/Zenject/WallstopStudios.UnityHelpers.Integration.Zenject.asmdef.meta +7 -0
  598. package/Runtime/Integrations/Zenject.meta +8 -0
  599. package/Runtime/Integrations.meta +8 -0
  600. package/Runtime/Protobuf-Net/System.Collections.Immutable.dll.meta +33 -33
  601. package/Runtime/Protobuf-Net/System.Runtime.CompilerServices.Unsafe.dll.meta +33 -33
  602. package/Runtime/Protobuf-Net/protobuf-net.Core.dll.meta +33 -33
  603. package/Runtime/Protobuf-Net/protobuf-net.dll.meta +33 -33
  604. package/Runtime/Protobuf-Net.meta +8 -8
  605. package/Runtime/Tags/AlwaysIncludeInAttributeMetadataCacheAttribute.cs +11 -0
  606. package/Runtime/Tags/AlwaysIncludeInAttributeMetadataCacheAttribute.cs.meta +11 -0
  607. package/Runtime/Tags/Attribute.cs +399 -205
  608. package/Runtime/Tags/Attribute.cs.meta +2 -2
  609. package/Runtime/Tags/AttributeEffect.cs +372 -281
  610. package/Runtime/Tags/AttributeEffect.cs.meta +2 -2
  611. package/Runtime/Tags/AttributeMetadataCache.cs +503 -0
  612. package/Runtime/Tags/AttributeMetadataCache.cs.meta +11 -0
  613. package/Runtime/Tags/AttributeMetadataFilters.cs +108 -0
  614. package/Runtime/Tags/AttributeMetadataFilters.cs.meta +11 -0
  615. package/Runtime/Tags/AttributeModification.cs +132 -48
  616. package/Runtime/Tags/AttributeModification.cs.meta +2 -2
  617. package/Runtime/Tags/AttributeUtilities.cs +376 -209
  618. package/Runtime/Tags/AttributeUtilities.cs.meta +2 -2
  619. package/Runtime/Tags/AttributesComponent.cs +237 -163
  620. package/Runtime/Tags/AttributesComponent.cs.meta +2 -2
  621. package/Runtime/Tags/CollisionSenses.cs +117 -91
  622. package/Runtime/Tags/CollisionSenses.cs.meta +2 -2
  623. package/Runtime/Tags/CosmeticEffectComponent.cs +112 -50
  624. package/Runtime/Tags/CosmeticEffectComponent.cs.meta +2 -2
  625. package/Runtime/Tags/CosmeticEffectData.cs +109 -63
  626. package/Runtime/Tags/CosmeticEffectData.cs.meta +2 -2
  627. package/Runtime/Tags/EffectHandle.cs +150 -65
  628. package/Runtime/Tags/EffectHandle.cs.meta +2 -2
  629. package/Runtime/Tags/EffectHandler.cs +470 -393
  630. package/Runtime/Tags/EffectHandler.cs.meta +2 -2
  631. package/Runtime/Tags/ModificationAction.cs +60 -9
  632. package/Runtime/Tags/ModificationAction.cs.meta +2 -2
  633. package/Runtime/Tags/ModifierDurationType.cs +71 -13
  634. package/Runtime/Tags/ModifierDurationType.cs.meta +2 -2
  635. package/Runtime/Tags/TagHandler.cs +373 -158
  636. package/Runtime/Tags/TagHandler.cs.meta +2 -2
  637. package/Runtime/Tags.meta +2 -2
  638. package/Runtime/Utils/AnimationEventEqualityComparer.cs +198 -161
  639. package/Runtime/Utils/AnimationEventEqualityComparer.cs.meta +11 -11
  640. package/Runtime/Utils/AnimatorEnumStateMachine.cs +110 -88
  641. package/Runtime/Utils/AnimatorEnumStateMachine.cs.meta +11 -11
  642. package/Runtime/Utils/Ascii85.cs +132 -115
  643. package/Runtime/Utils/Ascii85.cs.meta +2 -2
  644. package/Runtime/Utils/Buffers.cs +1151 -550
  645. package/Runtime/Utils/Buffers.cs.meta +11 -11
  646. package/Runtime/Utils/CenterPointOffset.cs +35 -30
  647. package/Runtime/Utils/CenterPointOffset.cs.meta +2 -2
  648. package/Runtime/Utils/ChildSpawner.cs +250 -157
  649. package/Runtime/Utils/ChildSpawner.cs.meta +2 -2
  650. package/Runtime/Utils/CircleLineRenderer.cs +142 -142
  651. package/Runtime/Utils/CircleLineRenderer.cs.meta +11 -11
  652. package/Runtime/Utils/CollisionProxy.cs +48 -48
  653. package/Runtime/Utils/CollisionProxy.cs.meta +2 -2
  654. package/Runtime/Utils/CoroutineHandler.cs +4 -4
  655. package/Runtime/Utils/CoroutineHandler.cs.meta +2 -2
  656. package/Runtime/Utils/DeferredDisposalResult.cs +20 -23
  657. package/Runtime/Utils/DeferredDisposalResult.cs.meta +2 -2
  658. package/Runtime/Utils/LZMA.cs +276 -53
  659. package/Runtime/Utils/LZMA.cs.meta +2 -2
  660. package/Runtime/Utils/MatchColliderToSprite.cs +104 -104
  661. package/Runtime/Utils/MatchColliderToSprite.cs.meta +2 -2
  662. package/Runtime/Utils/MatchTransform.cs +99 -82
  663. package/Runtime/Utils/MatchTransform.cs.meta +2 -2
  664. package/Runtime/Utils/Oscillator.cs +27 -27
  665. package/Runtime/Utils/Oscillator.cs.meta +11 -11
  666. package/Runtime/Utils/PolygonCollider2DOptimizer.cs +104 -83
  667. package/Runtime/Utils/PolygonCollider2DOptimizer.cs.meta +2 -2
  668. package/Runtime/Utils/RuntimeSingleton.cs +139 -89
  669. package/Runtime/Utils/RuntimeSingleton.cs.meta +11 -11
  670. package/Runtime/Utils/ScriptableObjectSingleton.cs +226 -85
  671. package/Runtime/Utils/ScriptableObjectSingleton.cs.meta +2 -2
  672. package/Runtime/Utils/SerializedStringComparer.cs +107 -107
  673. package/Runtime/Utils/SerializedStringComparer.cs.meta +2 -2
  674. package/Runtime/Utils/SetTextureImportData.cs +69 -69
  675. package/Runtime/Utils/SetTextureImportData.cs.meta +11 -11
  676. package/Runtime/Utils/SevenZip/Common/CRC.cs +70 -70
  677. package/Runtime/Utils/SevenZip/Common/CRC.cs.meta +11 -11
  678. package/Runtime/Utils/SevenZip/Common/InBuffer.cs +84 -84
  679. package/Runtime/Utils/SevenZip/Common/InBuffer.cs.meta +11 -11
  680. package/Runtime/Utils/SevenZip/Common/OutBuffer.cs +70 -70
  681. package/Runtime/Utils/SevenZip/Common/OutBuffer.cs.meta +11 -11
  682. package/Runtime/Utils/SevenZip/Common.meta +2 -2
  683. package/Runtime/Utils/SevenZip/Compress/LZ/IMatchFinder.cs +28 -28
  684. package/Runtime/Utils/SevenZip/Compress/LZ/IMatchFinder.cs.meta +11 -11
  685. package/Runtime/Utils/SevenZip/Compress/LZ/LzBinTree.cs +454 -454
  686. package/Runtime/Utils/SevenZip/Compress/LZ/LzBinTree.cs.meta +11 -11
  687. package/Runtime/Utils/SevenZip/Compress/LZ/LzInWindow.cs +179 -179
  688. package/Runtime/Utils/SevenZip/Compress/LZ/LzInWindow.cs.meta +11 -11
  689. package/Runtime/Utils/SevenZip/Compress/LZ/LzOutWindow.cs +137 -137
  690. package/Runtime/Utils/SevenZip/Compress/LZ/LzOutWindow.cs.meta +11 -11
  691. package/Runtime/Utils/SevenZip/Compress/LZ.meta +8 -8
  692. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaBase.cs +110 -110
  693. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaBase.cs.meta +11 -11
  694. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaDecoder.cs +525 -527
  695. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaDecoder.cs.meta +11 -11
  696. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaEncoder.cs +1891 -1904
  697. package/Runtime/Utils/SevenZip/Compress/LZMA/LzmaEncoder.cs.meta +11 -11
  698. package/Runtime/Utils/SevenZip/Compress/LZMA.meta +8 -8
  699. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoder.cs +242 -242
  700. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoder.cs.meta +11 -11
  701. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBit.cs +146 -149
  702. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBit.cs.meta +11 -11
  703. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBitTree.cs +177 -177
  704. package/Runtime/Utils/SevenZip/Compress/RangeCoder/RangeCoderBitTree.cs.meta +11 -11
  705. package/Runtime/Utils/SevenZip/Compress/RangeCoder.meta +8 -8
  706. package/Runtime/Utils/SevenZip/Compress.meta +8 -8
  707. package/Runtime/Utils/SevenZip/ICoder.cs +177 -177
  708. package/Runtime/Utils/SevenZip/ICoder.cs.meta +11 -11
  709. package/Runtime/Utils/SevenZip.meta +2 -2
  710. package/Runtime/Utils/SpriteRendererMetadata.cs +346 -370
  711. package/Runtime/Utils/SpriteRendererMetadata.cs.meta +2 -2
  712. package/Runtime/Utils/SpriteRendererSyncer.cs +100 -100
  713. package/Runtime/Utils/SpriteRendererSyncer.cs.meta +2 -2
  714. package/Runtime/Utils/StartTracker.cs +15 -15
  715. package/Runtime/Utils/StartTracker.cs.meta +2 -2
  716. package/Runtime/Utils/TextureScale.cs +356 -179
  717. package/Runtime/Utils/TextureScale.cs.meta +2 -2
  718. package/Runtime/Utils/TypeNameSorter.cs +17 -17
  719. package/Runtime/Utils/TypeNameSorter.cs.meta +2 -2
  720. package/Runtime/Utils/UnityObjectNameComparer.cs +89 -89
  721. package/Runtime/Utils/UnityObjectNameComparer.cs.meta +2 -2
  722. package/Runtime/Utils.meta +8 -8
  723. package/Runtime/Visuals/AnimatedSpriteLayer.cs +217 -130
  724. package/Runtime/Visuals/AnimatedSpriteLayer.cs.meta +2 -2
  725. package/Runtime/Visuals/UGUI/EnhancedImage.cs +218 -85
  726. package/Runtime/Visuals/UGUI/EnhancedImage.cs.meta +2 -2
  727. package/Runtime/Visuals/UGUI.meta +2 -2
  728. package/Runtime/Visuals/UIToolkit/LayeredImage.cs +781 -484
  729. package/Runtime/Visuals/UIToolkit/LayeredImage.cs.meta +2 -2
  730. package/Runtime/Visuals/UIToolkit/MultiFileSelectorElement.cs +945 -322
  731. package/Runtime/Visuals/UIToolkit/MultiFileSelectorElement.cs.meta +2 -2
  732. package/Runtime/Visuals/UIToolkit.meta +2 -2
  733. package/Runtime/Visuals.meta +2 -2
  734. package/Runtime/WallstopStudios.UnityHelpers.asmdef +22 -14
  735. package/Runtime/WallstopStudios.UnityHelpers.asmdef.meta +7 -7
  736. package/Runtime.meta +8 -8
  737. package/SERIALIZATION.md +648 -0
  738. package/SERIALIZATION.md.meta +7 -0
  739. package/SINGLETONS.md +427 -0
  740. package/SINGLETONS.md.meta +7 -0
  741. package/SPATIAL_TREES_2D_GUIDE.md +261 -0
  742. package/SPATIAL_TREES_2D_GUIDE.md.meta +7 -0
  743. package/SPATIAL_TREES_3D_GUIDE.md +214 -0
  744. package/SPATIAL_TREES_3D_GUIDE.md.meta +7 -0
  745. package/SPATIAL_TREE_2D_PERFORMANCE.md +238 -0
  746. package/SPATIAL_TREE_2D_PERFORMANCE.md.meta +7 -0
  747. package/SPATIAL_TREE_3D_PERFORMANCE.md +240 -0
  748. package/SPATIAL_TREE_3D_PERFORMANCE.md.meta +7 -0
  749. package/SPATIAL_TREE_SEMANTICS.md +106 -0
  750. package/SPATIAL_TREE_SEMANTICS.md.meta +7 -0
  751. package/Samples~/DI - VContainer/Prefabs/RelationalConsumer.prefab +77 -0
  752. package/Samples~/DI - VContainer/Prefabs/RelationalConsumer.prefab.meta +8 -0
  753. package/Samples~/DI - VContainer/Prefabs/Spawner.prefab +47 -0
  754. package/Samples~/DI - VContainer/Prefabs/Spawner.prefab.meta +8 -0
  755. package/Samples~/DI - VContainer/Prefabs.meta +9 -0
  756. package/Samples~/DI - VContainer/README.md +334 -0
  757. package/Samples~/DI - VContainer/README.md.meta +8 -0
  758. package/Samples~/DI - VContainer/Scenes/VContainer_Sample.unity +120 -0
  759. package/Samples~/DI - VContainer/Scenes/VContainer_Sample.unity.meta +8 -0
  760. package/Samples~/DI - VContainer/Scenes.meta +9 -0
  761. package/Samples~/DI - VContainer/Scripts/GameLifetimeScope.cs +24 -0
  762. package/Samples~/DI - VContainer/Scripts/GameLifetimeScope.cs.meta +12 -0
  763. package/Samples~/DI - VContainer/Scripts/RelationalConsumer.cs +21 -0
  764. package/Samples~/DI - VContainer/Scripts/RelationalConsumer.cs.meta +12 -0
  765. package/Samples~/DI - VContainer/Scripts/Samples.UnityHelpers.DI.VContainer.asmdef +37 -0
  766. package/Samples~/DI - VContainer/Scripts/Samples.UnityHelpers.DI.VContainer.asmdef.meta +8 -0
  767. package/Samples~/DI - VContainer/Scripts/Spawner.cs +21 -0
  768. package/Samples~/DI - VContainer/Scripts/Spawner.cs.meta +12 -0
  769. package/Samples~/DI - VContainer/Scripts.meta +9 -0
  770. package/Samples~/DI - VContainer.meta +9 -0
  771. package/Samples~/DI - Zenject/Prefabs/RelationalConsumer.prefab +77 -0
  772. package/Samples~/DI - Zenject/Prefabs/RelationalConsumer.prefab.meta +8 -0
  773. package/Samples~/DI - Zenject/Prefabs/SpawnerZenject.prefab +47 -0
  774. package/Samples~/DI - Zenject/Prefabs/SpawnerZenject.prefab.meta +8 -0
  775. package/Samples~/DI - Zenject/Prefabs.meta +9 -0
  776. package/Samples~/DI - Zenject/README.md +389 -0
  777. package/Samples~/DI - Zenject/README.md.meta +7 -0
  778. package/Samples~/DI - Zenject/Scenes/Zenject_Sample.unity +164 -0
  779. package/Samples~/DI - Zenject/Scenes/Zenject_Sample.unity.meta +8 -0
  780. package/Samples~/DI - Zenject/Scenes.meta +9 -0
  781. package/Samples~/DI - Zenject/Scripts/RelationalConsumer.cs +19 -0
  782. package/Samples~/DI - Zenject/Scripts/RelationalConsumer.cs.meta +12 -0
  783. package/Samples~/DI - Zenject/Scripts/Samples.UnityHelpers.DI.Zenject.asmdef +36 -0
  784. package/Samples~/DI - Zenject/Scripts/Samples.UnityHelpers.DI.Zenject.asmdef.meta +8 -0
  785. package/Samples~/DI - Zenject/Scripts/SceneContextPlaceholder.cs +47 -0
  786. package/Samples~/DI - Zenject/Scripts/SceneContextPlaceholder.cs.meta +12 -0
  787. package/Samples~/DI - Zenject/Scripts/SpawnerZenject.cs +20 -0
  788. package/Samples~/DI - Zenject/Scripts/SpawnerZenject.cs.meta +12 -0
  789. package/Samples~/DI - Zenject/Scripts.meta +9 -0
  790. package/Samples~/DI - Zenject.meta +9 -0
  791. package/Samples~/Random - PRNG/README.md +12 -0
  792. package/Samples~/Random - PRNG/README.md.meta +8 -0
  793. package/Samples~/Random - PRNG/Scripts/RandomPrngDemo.cs +28 -0
  794. package/Samples~/Random - PRNG/Scripts/RandomPrngDemo.cs.meta +12 -0
  795. package/Samples~/Random - PRNG/Scripts/Samples.UnityHelpers.Random.Prng.asmdef +17 -0
  796. package/Samples~/Random - PRNG/Scripts/Samples.UnityHelpers.Random.Prng.asmdef.meta +8 -0
  797. package/Samples~/Random - PRNG/Scripts.meta +9 -0
  798. package/Samples~/Random - PRNG.meta +9 -0
  799. package/Samples~/Relational Components - Basic/README.md +19 -0
  800. package/Samples~/Relational Components - Basic/README.md.meta +8 -0
  801. package/Samples~/Relational Components - Basic/Scripts/RelationalBasicConsumer.cs +37 -0
  802. package/Samples~/Relational Components - Basic/Scripts/RelationalBasicConsumer.cs.meta +12 -0
  803. package/Samples~/Relational Components - Basic/Scripts/Samples.UnityHelpers.Relational.Basic.asmdef +17 -0
  804. package/Samples~/Relational Components - Basic/Scripts/Samples.UnityHelpers.Relational.Basic.asmdef.meta +8 -0
  805. package/Samples~/Relational Components - Basic/Scripts.meta +9 -0
  806. package/Samples~/Relational Components - Basic.meta +9 -0
  807. package/Samples~/Serialization - JSON/README.md +13 -0
  808. package/Samples~/Serialization - JSON/README.md.meta +8 -0
  809. package/Samples~/Serialization - JSON/Scripts/JsonSerializationDemo.cs +50 -0
  810. package/Samples~/Serialization - JSON/Scripts/JsonSerializationDemo.cs.meta +12 -0
  811. package/Samples~/Serialization - JSON/Scripts/Samples.UnityHelpers.Serialization.Json.asmdef +17 -0
  812. package/Samples~/Serialization - JSON/Scripts/Samples.UnityHelpers.Serialization.Json.asmdef.meta +8 -0
  813. package/Samples~/Serialization - JSON/Scripts.meta +9 -0
  814. package/Samples~/Serialization - JSON.meta +9 -0
  815. package/Samples~/Spatial Structures - 2D and 3D/README.md +13 -0
  816. package/Samples~/Spatial Structures - 2D and 3D/README.md.meta +8 -0
  817. package/Samples~/Spatial Structures - 2D and 3D/Scripts/Samples.UnityHelpers.SpatialStructures.asmdef +17 -0
  818. package/Samples~/Spatial Structures - 2D and 3D/Scripts/Samples.UnityHelpers.SpatialStructures.asmdef.meta +8 -0
  819. package/Samples~/Spatial Structures - 2D and 3D/Scripts/SpatialStructuresDemo.cs +62 -0
  820. package/Samples~/Spatial Structures - 2D and 3D/Scripts/SpatialStructuresDemo.cs.meta +12 -0
  821. package/Samples~/Spatial Structures - 2D and 3D/Scripts.meta +9 -0
  822. package/Samples~/Spatial Structures - 2D and 3D.meta +9 -0
  823. package/Samples~/UGUI - EnhancedImage/README.md +12 -0
  824. package/Samples~/UGUI - EnhancedImage/README.md.meta +8 -0
  825. package/Samples~/UGUI - EnhancedImage/Scripts/EnhancedImageDemo.cs +36 -0
  826. package/Samples~/UGUI - EnhancedImage/Scripts/EnhancedImageDemo.cs.meta +12 -0
  827. package/Samples~/UGUI - EnhancedImage/Scripts/Samples.UnityHelpers.UGUI.EnhancedImage.asmdef +17 -0
  828. package/Samples~/UGUI - EnhancedImage/Scripts/Samples.UnityHelpers.UGUI.EnhancedImage.asmdef.meta +8 -0
  829. package/Samples~/UGUI - EnhancedImage/Scripts.meta +9 -0
  830. package/Samples~/UGUI - EnhancedImage.meta +9 -0
  831. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/README.md +12 -0
  832. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/README.md.meta +8 -0
  833. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor/MultiFileSelectorSampleWindow.cs +45 -0
  834. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor/MultiFileSelectorSampleWindow.cs.meta +12 -0
  835. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor/Samples.UnityHelpers.UIToolkit.Editor.asmdef +19 -0
  836. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor/Samples.UnityHelpers.UIToolkit.Editor.asmdef.meta +8 -0
  837. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts/Editor.meta +9 -0
  838. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/Scripts.meta +9 -0
  839. package/Samples~/UI Toolkit - MultiFile Selector (Editor).meta +9 -0
  840. package/Shaders/Materials/BackgroundMask-Material.mat +59 -59
  841. package/Shaders/Materials/BackgroundMask-Material.mat.meta +8 -8
  842. package/Shaders/Materials.meta +8 -8
  843. package/Shaders/ShaderGraph/BackgroundMask.shadergraph +1653 -1653
  844. package/Shaders/ShaderGraph/BackgroundMask.shadergraph.meta +10 -10
  845. package/Shaders/ShaderGraph/DebugDisplayValue.shadersubgraph +835 -835
  846. package/Shaders/ShaderGraph/DebugDisplayValue.shadersubgraph.meta +10 -10
  847. package/Shaders/ShaderGraph.meta +8 -8
  848. package/Shaders/Support/EnhancedImageSupport.shader +64 -0
  849. package/Shaders/Support/EnhancedImageSupport.shader.meta +9 -0
  850. package/Shaders/Support.meta +8 -0
  851. package/Shaders.meta +8 -8
  852. package/Styles/Elements/Progress/ArcedProgressBar.cs +345 -345
  853. package/Styles/Elements/Progress/ArcedProgressBar.cs.meta +2 -2
  854. package/Styles/Elements/Progress/CircularProgressBar.cs +307 -307
  855. package/Styles/Elements/Progress/CircularProgressBar.cs.meta +2 -2
  856. package/Styles/Elements/Progress/GlitchProgressBar.cs +416 -416
  857. package/Styles/Elements/Progress/GlitchProgressBar.cs.meta +2 -2
  858. package/Styles/Elements/Progress/LiquidProgressBar.cs +632 -632
  859. package/Styles/Elements/Progress/LiquidProgressBar.cs.meta +2 -2
  860. package/Styles/Elements/Progress/MarchingAntsProgressBar.cs +722 -722
  861. package/Styles/Elements/Progress/MarchingAntsProgressBar.cs.meta +2 -2
  862. package/Styles/Elements/Progress/RegularProgressBar.cs +405 -405
  863. package/Styles/Elements/Progress/RegularProgressBar.cs.meta +2 -2
  864. package/Styles/Elements/Progress/WigglyProgressBar.cs +837 -837
  865. package/Styles/Elements/Progress/WigglyProgressBar.cs.meta +2 -2
  866. package/Styles/Elements/Progress.meta +2 -2
  867. package/Styles/Elements.meta +2 -2
  868. package/Styles/USS/ArcedProgressBar.uss +18 -18
  869. package/Styles/USS/ArcedProgressBar.uss.meta +2 -2
  870. package/Styles/USS/CirclularProgressBar.uss +17 -17
  871. package/Styles/USS/CirclularProgressBar.uss.meta +2 -2
  872. package/Styles/USS/RegularProgressBar.uss +32 -32
  873. package/Styles/USS/RegularProgressBar.uss.meta +2 -2
  874. package/Styles/USS/WigglyProgressBar.uss +16 -16
  875. package/Styles/USS/WigglyProgressBar.uss.meta +2 -2
  876. package/Styles/USS.meta +2 -2
  877. package/Styles/WallstopStudios.UnityHelpers.Styles.asmdef +14 -17
  878. package/Styles/WallstopStudios.UnityHelpers.Styles.asmdef.meta +7 -7
  879. package/Styles.meta +2 -2
  880. package/THIRD_PARTY_NOTICES.md +74 -0
  881. package/THIRD_PARTY_NOTICES.md.meta +7 -0
  882. package/Tests/Editor/Attributes/AnimationEventHelpersTests.cs +155 -0
  883. package/Tests/Editor/Attributes/AnimationEventHelpersTests.cs.meta +11 -0
  884. package/Tests/Editor/Attributes.meta +8 -0
  885. package/Tests/Editor/Core/Attributes/RelationalComponentAssignerTests.cs +118 -0
  886. package/Tests/Editor/Core/Attributes/RelationalComponentAssignerTests.cs.meta +11 -0
  887. package/Tests/Editor/Core/Attributes.meta +8 -0
  888. package/Tests/Editor/Core.meta +8 -0
  889. package/Tests/Editor/Extensions/SerializedPropertyExtensionsTests.cs +194 -0
  890. package/Tests/Editor/Extensions/SerializedPropertyExtensionsTests.cs.meta +3 -0
  891. package/Tests/Editor/Extensions.meta +3 -0
  892. package/Tests/Editor/Helper/DummyScriptableObject.cs +6 -0
  893. package/Tests/Editor/Helper/DummyScriptableObject.cs.meta +3 -0
  894. package/Tests/Editor/Helper/HelpersTests.cs +101 -0
  895. package/Tests/Editor/Helper/HelpersTests.cs.meta +3 -0
  896. package/Tests/Editor/Helper/ObjectHelpersEditorTests.cs +63 -0
  897. package/Tests/Editor/Helper/ObjectHelpersEditorTests.cs.meta +11 -0
  898. package/Tests/Editor/Helper/PromptScope.cs +28 -0
  899. package/Tests/Editor/Helper/PromptScope.cs.meta +11 -0
  900. package/Tests/Editor/Helper/ReflectionHelpersEditorTests.cs +105 -0
  901. package/Tests/Editor/Helper/ReflectionHelpersEditorTests.cs.meta +11 -0
  902. package/Tests/Editor/Helper/SpriteHelpersTests.cs +334 -0
  903. package/Tests/Editor/Helper/SpriteHelpersTests.cs.meta +3 -0
  904. package/Tests/Editor/Helper/SpriteSettingsApplierAdditionalTests.cs +183 -0
  905. package/Tests/Editor/Helper/SpriteSettingsApplierAdditionalTests.cs.meta +11 -0
  906. package/Tests/Editor/Helper/SpriteSettingsApplierTests.cs +161 -0
  907. package/Tests/Editor/Helper/SpriteSettingsApplierTests.cs.meta +11 -0
  908. package/Tests/Editor/Helper.meta +3 -0
  909. package/Tests/Editor/Integrations/VContainer/VContainerIntegrationCompilationTests.cs +40 -0
  910. package/Tests/Editor/Integrations/VContainer/VContainerIntegrationCompilationTests.cs.meta +11 -0
  911. package/Tests/Editor/Integrations/VContainer/VContainerRelationalEntryPointTests.cs +77 -0
  912. package/Tests/Editor/Integrations/VContainer/VContainerRelationalEntryPointTests.cs.meta +11 -0
  913. package/Tests/Editor/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Editor.VContainer.asmdef +36 -0
  914. package/Tests/Editor/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Editor.VContainer.asmdef.meta +7 -0
  915. package/Tests/Editor/Integrations/VContainer.meta +8 -0
  916. package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef +36 -0
  917. package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef.meta +7 -0
  918. package/Tests/Editor/Integrations/Zenject/ZenjectIntegrationCompilationTests.cs +40 -0
  919. package/Tests/Editor/Integrations/Zenject/ZenjectIntegrationCompilationTests.cs.meta +11 -0
  920. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalInitializerTests.cs +76 -0
  921. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalInitializerTests.cs.meta +11 -0
  922. package/Tests/Editor/Integrations/Zenject.meta +8 -0
  923. package/Tests/Editor/Integrations.meta +8 -0
  924. package/Tests/Editor/MultiFileSelectorElementTests.cs +265 -0
  925. package/Tests/Editor/MultiFileSelectorElementTests.cs.meta +11 -0
  926. package/Tests/Editor/MultiFileSelectorPersistenceManagerTests.cs +100 -0
  927. package/Tests/Editor/MultiFileSelectorPersistenceManagerTests.cs.meta +11 -0
  928. package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs +199 -0
  929. package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs.meta +11 -0
  930. package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs +108 -0
  931. package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs.meta +11 -0
  932. package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs +323 -0
  933. package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs.meta +11 -0
  934. package/Tests/Editor/Sprites/SpriteCropperTests.cs +162 -0
  935. package/Tests/Editor/Sprites/SpriteCropperTests.cs.meta +11 -0
  936. package/Tests/Editor/Sprites/SpritePivotAdjusterAdditionalTests.cs +227 -0
  937. package/Tests/Editor/Sprites/SpritePivotAdjusterAdditionalTests.cs.meta +11 -0
  938. package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs +113 -0
  939. package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs.meta +11 -0
  940. package/Tests/Editor/Sprites/TexturePlatformNameHelperTests.cs +28 -0
  941. package/Tests/Editor/Sprites/TexturePlatformNameHelperTests.cs.meta +11 -0
  942. package/Tests/Editor/Sprites/TextureResizerWizardTests.cs +248 -0
  943. package/Tests/Editor/Sprites/TextureResizerWizardTests.cs.meta +11 -0
  944. package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs +180 -0
  945. package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs.meta +11 -0
  946. package/Tests/Editor/Sprites/TextureSettingsApplierWizardAdditionalTests.cs +295 -0
  947. package/Tests/Editor/Sprites/TextureSettingsApplierWizardAdditionalTests.cs.meta +11 -0
  948. package/Tests/Editor/Sprites/TextureSettingsApplierWizardTests.cs +134 -0
  949. package/Tests/Editor/Sprites/TextureSettingsApplierWizardTests.cs.meta +11 -0
  950. package/Tests/Editor/Sprites.meta +8 -0
  951. package/Tests/Editor/TestComponents/PrewarmTesterComponent.cs +10 -0
  952. package/Tests/Editor/TestComponents/PrewarmTesterComponent.cs.meta +11 -0
  953. package/Tests/Editor/TestComponents.meta +8 -0
  954. package/Tests/Editor/Tools/ImageBlurToolTests.cs +135 -0
  955. package/Tests/Editor/Tools/ImageBlurToolTests.cs.meta +11 -0
  956. package/Tests/Editor/Tools.meta +8 -0
  957. package/Tests/Editor/Utils/CommonTestBase.cs +208 -0
  958. package/Tests/Editor/Utils/CommonTestBase.cs.meta +11 -0
  959. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorEditorTests.cs +306 -0
  960. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorEditorTests.cs.meta +9 -0
  961. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorTests.cs +183 -0
  962. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorTests.cs.meta +11 -0
  963. package/Tests/Editor/Utils/ScriptableObjectSingletonTests.cs +466 -0
  964. package/Tests/Editor/Utils/ScriptableObjectSingletonTests.cs.meta +11 -0
  965. package/Tests/Editor/Utils.meta +3 -0
  966. package/Tests/Editor/WallstopStudios.UnityHelpers.Tests.Editor.asmdef +19 -0
  967. package/Tests/Editor/WallstopStudios.UnityHelpers.Tests.Editor.asmdef.meta +7 -0
  968. package/Tests/Editor/Windows/FitTextureSizeWindowTests.cs +781 -0
  969. package/Tests/Editor/Windows/FitTextureSizeWindowTests.cs.meta +11 -0
  970. package/Tests/Editor/Windows/PrefabCheckerFolderAdditionTests.cs +96 -0
  971. package/Tests/Editor/Windows/PrefabCheckerFolderAdditionTests.cs.meta +11 -0
  972. package/Tests/Editor/Windows/PrefabCheckerTests.cs +81 -0
  973. package/Tests/Editor/Windows/PrefabCheckerTests.cs.meta +11 -0
  974. package/Tests/Editor/Windows.meta +8 -0
  975. package/Tests/Editor.meta +8 -0
  976. package/Tests/Runtime/AssemblyInfo.cs +4 -0
  977. package/Tests/Runtime/AssemblyInfo.cs.meta +3 -0
  978. package/Tests/Runtime/Attributes/ChildComponentTests.cs +766 -81
  979. package/Tests/Runtime/Attributes/ChildComponentTests.cs.meta +2 -2
  980. package/Tests/Runtime/Attributes/Components/ExpectChildSpriteRenderers.cs +28 -28
  981. package/Tests/Runtime/Attributes/Components/ExpectChildSpriteRenderers.cs.meta +2 -2
  982. package/Tests/Runtime/Attributes/Components/ExpectParentSpriteRenderers.cs +28 -28
  983. package/Tests/Runtime/Attributes/Components/ExpectParentSpriteRenderers.cs.meta +2 -2
  984. package/Tests/Runtime/{Components → Attributes/Components}/RelationalComponentTesterComplex.cs +34 -34
  985. package/Tests/Runtime/{Components → Attributes/Components}/RelationalComponentTesterComplex.cs.meta +2 -2
  986. package/Tests/Runtime/Attributes/Components/RelationalComponentsTesterSimple.cs +37 -0
  987. package/Tests/Runtime/{Components → Attributes/Components}/RelationalComponentsTesterSimple.cs.meta +2 -2
  988. package/Tests/Runtime/Attributes/Components.meta +2 -2
  989. package/Tests/Runtime/Attributes/MiscRuntimeAttributeTests.cs +75 -0
  990. package/Tests/Runtime/Attributes/MiscRuntimeAttributeTests.cs.meta +11 -0
  991. package/Tests/Runtime/Attributes/NotNullAttributeTests.cs +26 -0
  992. package/Tests/Runtime/Attributes/NotNullAttributeTests.cs.meta +3 -0
  993. package/Tests/Runtime/Attributes/ParentComponentTests.cs +565 -68
  994. package/Tests/Runtime/Attributes/ParentComponentTests.cs.meta +2 -2
  995. package/Tests/Runtime/Attributes/RelationalComponentAdvancedTests.cs +614 -0
  996. package/Tests/Runtime/Attributes/RelationalComponentAdvancedTests.cs.meta +11 -0
  997. package/Tests/Runtime/Attributes/RelationalComponentBackwardCompatibilityTests.cs +478 -0
  998. package/Tests/Runtime/Attributes/RelationalComponentBackwardCompatibilityTests.cs.meta +11 -0
  999. package/Tests/Runtime/Attributes/RelationalComponentExtensionsTests.cs +56 -0
  1000. package/Tests/Runtime/Attributes/RelationalComponentExtensionsTests.cs.meta +11 -0
  1001. package/Tests/Runtime/Attributes/RelationalComponentHashSetTests.cs +226 -0
  1002. package/Tests/Runtime/Attributes/RelationalComponentHashSetTests.cs.meta +11 -0
  1003. package/Tests/Runtime/Attributes/RelationalComponentInitializerTests.cs +109 -0
  1004. package/Tests/Runtime/Attributes/RelationalComponentInitializerTests.cs.meta +11 -0
  1005. package/Tests/Runtime/Attributes/RelationalComponentTagAndNameFilterEdgeTests.cs +234 -0
  1006. package/Tests/Runtime/Attributes/RelationalComponentTagAndNameFilterEdgeTests.cs.meta +11 -0
  1007. package/Tests/Runtime/Attributes/SiblingComponentTests.cs +721 -0
  1008. package/Tests/Runtime/Attributes/SiblingComponentTests.cs.meta +11 -0
  1009. package/Tests/Runtime/Attributes/ValidateAssignmentAttributeTests.cs +96 -0
  1010. package/Tests/Runtime/Attributes/ValidateAssignmentAttributeTests.cs.meta +11 -0
  1011. package/Tests/Runtime/Attributes.meta +2 -2
  1012. package/Tests/Runtime/Core/Random/RandomComparerTests.cs +166 -0
  1013. package/Tests/Runtime/Core/Random/RandomComparerTests.cs.meta +11 -0
  1014. package/Tests/Runtime/Core/Random.meta +8 -0
  1015. package/Tests/Runtime/Core/Threading/SingleThreadedThreadPoolTests.cs +56 -56
  1016. package/Tests/Runtime/Core/Threading/SingleThreadedThreadPoolTests.cs.meta +2 -2
  1017. package/Tests/Runtime/Core/Threading.meta +2 -2
  1018. package/Tests/Runtime/Core.meta +2 -2
  1019. package/Tests/Runtime/DataStructures/BalancedKDTree2DTests.cs +562 -0
  1020. package/Tests/Runtime/DataStructures/{BalancedKDTreeTests.cs.meta → BalancedKDTree2DTests.cs.meta} +11 -11
  1021. package/Tests/Runtime/DataStructures/BalancedKDTree3DTests.cs +10 -0
  1022. package/Tests/Runtime/DataStructures/BalancedKDTree3DTests.cs.meta +11 -0
  1023. package/Tests/Runtime/DataStructures/BitSetTests.cs +1400 -0
  1024. package/Tests/Runtime/DataStructures/BitSetTests.cs.meta +3 -0
  1025. package/Tests/Runtime/DataStructures/BoundingBox3DTests.cs +1215 -0
  1026. package/Tests/Runtime/DataStructures/BoundingBox3DTests.cs.meta +11 -0
  1027. package/Tests/Runtime/DataStructures/CircleTests.cs +965 -0
  1028. package/Tests/Runtime/DataStructures/CircleTests.cs.meta +11 -0
  1029. package/Tests/Runtime/DataStructures/CyclicBufferTests.cs +2083 -324
  1030. package/Tests/Runtime/DataStructures/CyclicBufferTests.cs.meta +2 -2
  1031. package/Tests/Runtime/DataStructures/DequeTests.cs +790 -0
  1032. package/Tests/Runtime/DataStructures/DequeTests.cs.meta +3 -0
  1033. package/Tests/Runtime/DataStructures/DisjointSetTests.cs +1114 -0
  1034. package/Tests/Runtime/DataStructures/DisjointSetTests.cs.meta +3 -0
  1035. package/Tests/Runtime/DataStructures/FastOneOfTests.cs +966 -0
  1036. package/Tests/Runtime/DataStructures/FastOneOfTests.cs.meta +11 -0
  1037. package/Tests/Runtime/DataStructures/FastVector2IntTests.cs +286 -0
  1038. package/Tests/Runtime/DataStructures/FastVector2IntTests.cs.meta +11 -0
  1039. package/Tests/Runtime/DataStructures/FastVector3IntTests.cs +414 -0
  1040. package/Tests/Runtime/DataStructures/FastVector3IntTests.cs.meta +11 -0
  1041. package/Tests/Runtime/DataStructures/HeapTests.cs +1953 -0
  1042. package/Tests/Runtime/DataStructures/HeapTests.cs.meta +11 -0
  1043. package/Tests/Runtime/DataStructures/ImmutableBitSetTests.cs +833 -0
  1044. package/Tests/Runtime/DataStructures/ImmutableBitSetTests.cs.meta +3 -0
  1045. package/Tests/Runtime/DataStructures/KDTree3DTestsBase.cs +297 -0
  1046. package/Tests/Runtime/DataStructures/KDTree3DTestsBase.cs.meta +11 -0
  1047. package/Tests/Runtime/DataStructures/OctTree3DTests.cs +351 -0
  1048. package/Tests/Runtime/DataStructures/OctTree3DTests.cs.meta +11 -0
  1049. package/Tests/Runtime/DataStructures/PriorityQueueTests.cs +71 -0
  1050. package/Tests/Runtime/DataStructures/PriorityQueueTests.cs.meta +3 -0
  1051. package/Tests/Runtime/DataStructures/ProtobufSerializationTests.cs +475 -0
  1052. package/Tests/Runtime/DataStructures/ProtobufSerializationTests.cs.meta +11 -0
  1053. package/Tests/Runtime/DataStructures/QuadTree2DTests.cs +660 -0
  1054. package/Tests/Runtime/DataStructures/QuadTree2DTests.cs.meta +11 -0
  1055. package/Tests/Runtime/DataStructures/RTree2DTests.cs +823 -0
  1056. package/Tests/Runtime/DataStructures/RTree2DTests.cs.meta +3 -0
  1057. package/Tests/Runtime/DataStructures/RTree3DTests.cs +270 -0
  1058. package/Tests/Runtime/DataStructures/RTree3DTests.cs.meta +11 -0
  1059. package/Tests/Runtime/DataStructures/SparseSetTests.cs +1146 -0
  1060. package/Tests/Runtime/DataStructures/SparseSetTests.cs.meta +3 -0
  1061. package/Tests/Runtime/DataStructures/SpatialHashTests.cs +992 -0
  1062. package/Tests/Runtime/DataStructures/SpatialHashTests.cs.meta +11 -0
  1063. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsConsistencyTests.cs +351 -0
  1064. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsConsistencyTests.cs.meta +11 -0
  1065. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsEdgeTests.cs +127 -0
  1066. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsEdgeTests.cs.meta +11 -0
  1067. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsFuzzTests.cs +218 -0
  1068. package/Tests/Runtime/DataStructures/SpatialTree2DBoundsFuzzTests.cs.meta +11 -0
  1069. package/Tests/Runtime/DataStructures/SpatialTree2DTests.cs +396 -0
  1070. package/Tests/Runtime/DataStructures/SpatialTree2DTests.cs.meta +11 -0
  1071. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsConsistencyTests.cs +281 -0
  1072. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsConsistencyTests.cs.meta +11 -0
  1073. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsEdgeTests.cs +127 -0
  1074. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsEdgeTests.cs.meta +11 -0
  1075. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsFuzzTests.cs +170 -0
  1076. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsFuzzTests.cs.meta +11 -0
  1077. package/Tests/Runtime/DataStructures/SpatialTree3DTests.cs +474 -0
  1078. package/Tests/Runtime/DataStructures/SpatialTree3DTests.cs.meta +11 -0
  1079. package/Tests/Runtime/DataStructures/SphereTests.cs +806 -0
  1080. package/Tests/Runtime/DataStructures/SphereTests.cs.meta +3 -0
  1081. package/Tests/Runtime/DataStructures/StringWrapperTests.cs +333 -0
  1082. package/Tests/Runtime/DataStructures/StringWrapperTests.cs.meta +11 -0
  1083. package/Tests/Runtime/DataStructures/TimedCacheTests.cs +669 -0
  1084. package/Tests/Runtime/DataStructures/TimedCacheTests.cs.meta +11 -0
  1085. package/Tests/Runtime/DataStructures/TrieTests.cs +3385 -0
  1086. package/Tests/Runtime/DataStructures/TrieTests.cs.meta +11 -0
  1087. package/Tests/Runtime/DataStructures/UnbalancedKDTree2DTests.cs +565 -0
  1088. package/Tests/Runtime/DataStructures/{UnbalancedKDTreeTests.cs.meta → UnbalancedKDTree2DTests.cs.meta} +11 -11
  1089. package/Tests/Runtime/DataStructures/UnbalancedKDTree3DTests.cs +10 -0
  1090. package/Tests/Runtime/DataStructures/UnbalancedKDTree3DTests.cs.meta +11 -0
  1091. package/Tests/Runtime/DataStructures.meta +8 -8
  1092. package/Tests/Runtime/Extensions/AnimatorExtensionsTests.cs +28 -0
  1093. package/Tests/Runtime/Extensions/AnimatorExtensionsTests.cs.meta +11 -0
  1094. package/Tests/Runtime/Extensions/AsyncOperationExtensionsTests.cs +667 -0
  1095. package/Tests/Runtime/Extensions/AsyncOperationExtensionsTests.cs.meta +11 -0
  1096. package/Tests/Runtime/Extensions/CircleExtensionsTests.cs +230 -0
  1097. package/Tests/Runtime/Extensions/CircleExtensionsTests.cs.meta +11 -0
  1098. package/Tests/Runtime/Extensions/ColorExtensionsTests.cs +55 -0
  1099. package/Tests/Runtime/Extensions/ColorExtensionsTests.cs.meta +11 -0
  1100. package/Tests/Runtime/Extensions/DictionaryExtensionTests.cs +724 -438
  1101. package/Tests/Runtime/Extensions/DictionaryExtensionTests.cs.meta +2 -2
  1102. package/Tests/Runtime/Extensions/DirectionExtensionsComprehensiveTests.cs +403 -0
  1103. package/Tests/Runtime/Extensions/DirectionExtensionsComprehensiveTests.cs.meta +11 -0
  1104. package/Tests/Runtime/Extensions/DirectionExtensionsTests.cs +69 -0
  1105. package/Tests/Runtime/Extensions/DirectionExtensionsTests.cs.meta +11 -0
  1106. package/Tests/Runtime/Extensions/EnumExtensionTests.cs +809 -153
  1107. package/Tests/Runtime/Extensions/EnumExtensionTests.cs.meta +2 -2
  1108. package/Tests/Runtime/Extensions/IEnumerableExtensionsTests.cs +191 -0
  1109. package/Tests/Runtime/Extensions/IEnumerableExtensionsTests.cs.meta +11 -0
  1110. package/Tests/Runtime/Extensions/IListExtensionTests.cs +955 -169
  1111. package/Tests/Runtime/Extensions/IListExtensionTests.cs.meta +2 -2
  1112. package/Tests/Runtime/Extensions/IReadonlyListExtensionTests.cs +266 -58
  1113. package/Tests/Runtime/Extensions/IReadonlyListExtensionTests.cs.meta +2 -2
  1114. package/Tests/Runtime/Extensions/LoggingExtensionTests.cs +721 -718
  1115. package/Tests/Runtime/Extensions/LoggingExtensionTests.cs.meta +2 -2
  1116. package/Tests/Runtime/Extensions/ProtoEqualityExtensionsTests.cs +565 -0
  1117. package/Tests/Runtime/Extensions/ProtoEqualityExtensionsTests.cs.meta +3 -0
  1118. package/Tests/Runtime/Extensions/ProtoEqualityPolymorphismTests.cs +100 -0
  1119. package/Tests/Runtime/Extensions/ProtoEqualityPolymorphismTests.cs.meta +11 -0
  1120. package/Tests/Runtime/Extensions/RandomExtensionTests.cs +719 -27
  1121. package/Tests/Runtime/Extensions/RandomExtensionTests.cs.meta +2 -2
  1122. package/Tests/Runtime/Extensions/StringExtensionTests.cs +2592 -31
  1123. package/Tests/Runtime/Extensions/StringExtensionTests.cs.meta +2 -2
  1124. package/Tests/Runtime/Extensions/UnityExtensionsBasicTests.cs +166 -0
  1125. package/Tests/Runtime/Extensions/UnityExtensionsBasicTests.cs.meta +11 -0
  1126. package/Tests/Runtime/Extensions/UnityExtensionsComprehensiveTests.cs +1446 -0
  1127. package/Tests/Runtime/Extensions/UnityExtensionsComprehensiveTests.cs.meta +11 -0
  1128. package/Tests/Runtime/Extensions/UnityExtensionsMathTests.cs +1779 -0
  1129. package/Tests/Runtime/Extensions/UnityExtensionsMathTests.cs.meta +11 -0
  1130. package/Tests/Runtime/Extensions/UnityExtensionsVector2HullTests.cs +292 -0
  1131. package/Tests/Runtime/Extensions/UnityExtensionsVector2HullTests.cs.meta +11 -0
  1132. package/Tests/Runtime/Extensions/UnityLogTagFormatterEdgeTests.cs +260 -0
  1133. package/Tests/Runtime/Extensions/UnityLogTagFormatterEdgeTests.cs.meta +11 -0
  1134. package/Tests/Runtime/Extensions.meta +2 -2
  1135. package/Tests/Runtime/Helper/ArrayConverterTests.cs +19 -19
  1136. package/Tests/Runtime/Helper/ArrayConverterTests.cs.meta +2 -2
  1137. package/Tests/Runtime/Helper/AssignUtilitiesTests.cs +38 -0
  1138. package/Tests/Runtime/Helper/AssignUtilitiesTests.cs.meta +11 -0
  1139. package/Tests/Runtime/Helper/DirectoryHelperTests.cs +347 -0
  1140. package/Tests/Runtime/Helper/DirectoryHelperTests.cs.meta +11 -0
  1141. package/Tests/Runtime/Helper/EnumerablesTests.cs +45 -0
  1142. package/Tests/Runtime/Helper/EnumerablesTests.cs.meta +11 -0
  1143. package/Tests/Runtime/Helper/FileHelperTests.cs +481 -0
  1144. package/Tests/Runtime/Helper/FileHelperTests.cs.meta +11 -0
  1145. package/Tests/Runtime/Helper/FormattingHelpersTests.cs +353 -0
  1146. package/Tests/Runtime/Helper/FormattingHelpersTests.cs.meta +11 -0
  1147. package/Tests/Runtime/Helper/FuncBasedComparerTests.cs +27 -0
  1148. package/Tests/Runtime/Helper/FuncBasedComparerTests.cs.meta +11 -0
  1149. package/Tests/Runtime/Helper/GeometryTests.cs +517 -0
  1150. package/Tests/Runtime/Helper/GeometryTests.cs.meta +3 -0
  1151. package/Tests/Runtime/Helper/HelpersTests.cs +749 -0
  1152. package/Tests/Runtime/Helper/HelpersTests.cs.meta +11 -0
  1153. package/Tests/Runtime/Helper/IterationHelpersTests.cs +173 -0
  1154. package/Tests/Runtime/Helper/IterationHelpersTests.cs.meta +11 -0
  1155. package/Tests/Runtime/Helper/LineHelperTests.cs +662 -0
  1156. package/Tests/Runtime/Helper/LineHelperTests.cs.meta +11 -0
  1157. package/Tests/Runtime/Helper/ObjectHelperTests.cs +444 -432
  1158. package/Tests/Runtime/Helper/ObjectHelperTests.cs.meta +2 -2
  1159. package/Tests/Runtime/Helper/ObjectsTests.cs +363 -0
  1160. package/Tests/Runtime/Helper/ObjectsTests.cs.meta +3 -0
  1161. package/Tests/Runtime/Helper/PathHelperTests.cs +183 -0
  1162. package/Tests/Runtime/Helper/PathHelperTests.cs.meta +11 -0
  1163. package/Tests/Runtime/Helper/ReflectionHelperTests.cs +2199 -1493
  1164. package/Tests/Runtime/Helper/ReflectionHelperTests.cs.meta +2 -2
  1165. package/Tests/Runtime/Helper/ReflectionHelpersMemberLookupTests.cs +192 -0
  1166. package/Tests/Runtime/Helper/ReflectionHelpersMemberLookupTests.cs.meta +11 -0
  1167. package/Tests/Runtime/Helper/ReflectionHelpersTypeScanningTests.cs +58 -0
  1168. package/Tests/Runtime/Helper/ReflectionHelpersTypeScanningTests.cs.meta +11 -0
  1169. package/Tests/Runtime/Helper/SceneHelperTests.cs +77 -94
  1170. package/Tests/Runtime/Helper/SceneHelperTests.cs.meta +2 -2
  1171. package/Tests/Runtime/Helper/UnityMainThreadDispatcherTests.cs +45 -0
  1172. package/Tests/Runtime/Helper/UnityMainThreadDispatcherTests.cs.meta +11 -0
  1173. package/Tests/Runtime/Helper/WallMathTests.cs +1884 -233
  1174. package/Tests/Runtime/Helper/WallMathTests.cs.meta +2 -2
  1175. package/Tests/Runtime/Helper.meta +2 -2
  1176. package/Tests/Runtime/Integrations/VContainer/RelationalComponentsVContainerTests.cs +560 -0
  1177. package/Tests/Runtime/Integrations/VContainer/RelationalComponentsVContainerTests.cs.meta +11 -0
  1178. package/Tests/Runtime/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Runtime.VContainer.asmdef +38 -0
  1179. package/Tests/Runtime/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Runtime.VContainer.asmdef.meta +7 -0
  1180. package/Tests/Runtime/Integrations/VContainer.meta +8 -0
  1181. package/Tests/Runtime/Integrations/Zenject/RelationalComponentsZenjectTests.cs +591 -0
  1182. package/Tests/Runtime/Integrations/Zenject/RelationalComponentsZenjectTests.cs.meta +11 -0
  1183. package/Tests/Runtime/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Runtime.Zenject.asmdef +38 -0
  1184. package/Tests/Runtime/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Runtime.Zenject.asmdef.meta +7 -0
  1185. package/Tests/Runtime/Integrations/Zenject.meta +8 -0
  1186. package/Tests/Runtime/Integrations.meta +8 -0
  1187. package/Tests/Runtime/Math/Line2DTests.cs +594 -0
  1188. package/Tests/Runtime/Math/Line2DTests.cs.meta +11 -0
  1189. package/Tests/Runtime/Math/Line3DTests.cs +655 -0
  1190. package/Tests/Runtime/Math/Line3DTests.cs.meta +11 -0
  1191. package/Tests/Runtime/Math/LineTests.cs +480 -0
  1192. package/Tests/Runtime/Math/LineTests.cs.meta +11 -0
  1193. package/Tests/Runtime/Math/ParabolaTests.cs +477 -0
  1194. package/Tests/Runtime/Math/ParabolaTests.cs.meta +11 -0
  1195. package/Tests/Runtime/Math/PointPolygonCheckTests.cs +939 -0
  1196. package/Tests/Runtime/Math/PointPolygonCheckTests.cs.meta +11 -0
  1197. package/Tests/Runtime/Math/RangeTests.cs +197 -0
  1198. package/Tests/Runtime/Math/RangeTests.cs.meta +11 -0
  1199. package/Tests/Runtime/Math.meta +8 -0
  1200. package/Tests/Runtime/Performance/BenchmarkReadmeUpdater.cs +81 -0
  1201. package/Tests/Runtime/Performance/BenchmarkReadmeUpdater.cs.meta +11 -0
  1202. package/Tests/Runtime/Performance/JsonSerializationPerformanceTests.cs +421 -0
  1203. package/Tests/Runtime/Performance/JsonSerializationPerformanceTests.cs.meta +3 -0
  1204. package/Tests/Runtime/Performance/ListExtensionPerformanceTests.cs +76 -76
  1205. package/Tests/Runtime/Performance/ListExtensionPerformanceTests.cs.meta +2 -2
  1206. package/Tests/Runtime/Performance/ProtoEqualsPerformanceTests.cs +161 -0
  1207. package/Tests/Runtime/Performance/ProtoEqualsPerformanceTests.cs.meta +11 -0
  1208. package/Tests/Runtime/Performance/ProtoSerializationPerformanceTests.cs +207 -0
  1209. package/Tests/Runtime/Performance/ProtoSerializationPerformanceTests.cs.meta +3 -0
  1210. package/Tests/Runtime/Performance/RandomPerformanceTests.cs +195 -181
  1211. package/Tests/Runtime/Performance/RandomPerformanceTests.cs.meta +11 -11
  1212. package/Tests/Runtime/Performance/RelationComponentPerformanceTests.cs +60 -61
  1213. package/Tests/Runtime/Performance/RelationComponentPerformanceTests.cs.meta +2 -2
  1214. package/Tests/Runtime/Performance/SpatialTree2DPerformanceTests.cs +692 -0
  1215. package/Tests/Runtime/Performance/SpatialTree2DPerformanceTests.cs.meta +11 -0
  1216. package/Tests/Runtime/Performance/SpatialTree3DPerformanceTests.cs +650 -0
  1217. package/Tests/Runtime/Performance/SpatialTree3DPerformanceTests.cs.meta +11 -0
  1218. package/Tests/Runtime/Performance.meta +8 -8
  1219. package/Tests/Runtime/Random/DotNetRandomTests.cs +9 -9
  1220. package/Tests/Runtime/Random/DotNetRandomTests.cs.meta +2 -2
  1221. package/Tests/Runtime/Random/IllusionFlowTests.cs +12 -12
  1222. package/Tests/Runtime/Random/IllusionFlowTests.cs.meta +2 -2
  1223. package/Tests/Runtime/Random/LinearCongruentialGeneratorTests.cs +12 -12
  1224. package/Tests/Runtime/Random/LinearCongruentialGeneratorTests.cs.meta +2 -2
  1225. package/Tests/Runtime/Random/PcgRandomTests.cs +9 -9
  1226. package/Tests/Runtime/Random/PcgRandomTests.cs.meta +11 -11
  1227. package/Tests/Runtime/Random/RandomProtoSerializationTests.cs +494 -0
  1228. package/Tests/Runtime/Random/RandomProtoSerializationTests.cs.meta +3 -0
  1229. package/Tests/Runtime/Random/RandomStateSerializationTests.cs +304 -0
  1230. package/Tests/Runtime/Random/RandomStateSerializationTests.cs.meta +4 -0
  1231. package/Tests/Runtime/Random/RandomTestBase.cs +836 -787
  1232. package/Tests/Runtime/Random/RandomTestBase.cs.meta +11 -11
  1233. package/Tests/Runtime/Random/RomuDuoRandomTests.cs +9 -9
  1234. package/Tests/Runtime/Random/RomuDuoRandomTests.cs.meta +2 -2
  1235. package/Tests/Runtime/Random/SplitMix64RandomTests.cs +9 -9
  1236. package/Tests/Runtime/Random/SplitMix64RandomTests.cs.meta +2 -2
  1237. package/Tests/Runtime/Random/SquirrelRandomTests.cs +14 -14
  1238. package/Tests/Runtime/Random/SquirrelRandomTests.cs.meta +11 -11
  1239. package/Tests/Runtime/Random/SystemRandomTests.cs +10 -10
  1240. package/Tests/Runtime/Random/SystemRandomTests.cs.meta +11 -11
  1241. package/Tests/Runtime/Random/UnityRandomTests.cs +9 -9
  1242. package/Tests/Runtime/Random/UnityRandomTests.cs.meta +11 -11
  1243. package/Tests/Runtime/Random/WyRandomTests.cs +9 -9
  1244. package/Tests/Runtime/Random/WyRandomTests.cs.meta +2 -2
  1245. package/Tests/Runtime/Random/XorShiftRandomTests.cs +9 -9
  1246. package/Tests/Runtime/Random/XorShiftRandomTests.cs.meta +11 -11
  1247. package/Tests/Runtime/Random/XoroShiroRandomTests.cs +9 -9
  1248. package/Tests/Runtime/Random/XoroShiroRandomTests.cs.meta +2 -2
  1249. package/Tests/Runtime/Random.meta +8 -8
  1250. package/Tests/Runtime/RuntimeTestTimeouts.cs +3 -0
  1251. package/Tests/Runtime/RuntimeTestTimeouts.cs.meta +11 -0
  1252. package/Tests/Runtime/Scenes/Test1.unity +723 -723
  1253. package/Tests/Runtime/Scenes/Test1.unity.meta +7 -7
  1254. package/Tests/Runtime/Scenes/Test2.unity +723 -723
  1255. package/Tests/Runtime/Scenes/Test2.unity.meta +7 -7
  1256. package/Tests/Runtime/Scenes.meta +2 -2
  1257. package/Tests/Runtime/Serialization/AdaptersJsonTests.cs +67 -0
  1258. package/Tests/Runtime/Serialization/AdaptersJsonTests.cs.meta +11 -0
  1259. package/Tests/Runtime/Serialization/BitSetJsonTests.cs +50 -0
  1260. package/Tests/Runtime/Serialization/BitSetJsonTests.cs.meta +11 -0
  1261. package/Tests/Runtime/Serialization/CyclicBufferJsonTests.cs +67 -0
  1262. package/Tests/Runtime/Serialization/CyclicBufferJsonTests.cs.meta +11 -0
  1263. package/Tests/Runtime/Serialization/DequeJsonTests.cs +70 -0
  1264. package/Tests/Runtime/Serialization/DequeJsonTests.cs.meta +11 -0
  1265. package/Tests/Runtime/Serialization/ImmutableBitSetJsonTests.cs +25 -0
  1266. package/Tests/Runtime/Serialization/ImmutableBitSetJsonTests.cs.meta +11 -0
  1267. package/Tests/Runtime/Serialization/JsonConverterTests.cs +1157 -0
  1268. package/Tests/Runtime/Serialization/JsonConverterTests.cs.meta +11 -0
  1269. package/Tests/Runtime/Serialization/JsonRoundtripComprehensiveTests.cs +239 -0
  1270. package/Tests/Runtime/Serialization/JsonRoundtripComprehensiveTests.cs.meta +11 -0
  1271. package/Tests/Runtime/Serialization/JsonSerializationCorrectnessTests.cs +458 -0
  1272. package/Tests/Runtime/Serialization/JsonSerializationCorrectnessTests.cs.meta +3 -0
  1273. package/Tests/Runtime/Serialization/JsonSerializationTest.cs +156 -156
  1274. package/Tests/Runtime/Serialization/JsonSerializationTest.cs.meta +2 -2
  1275. package/Tests/Runtime/Serialization/MathJsonTests.cs +79 -0
  1276. package/Tests/Runtime/Serialization/MathJsonTests.cs.meta +11 -0
  1277. package/Tests/Runtime/Serialization/ProtoInterfaceResolutionEdgeTests.cs +76 -0
  1278. package/Tests/Runtime/Serialization/ProtoInterfaceResolutionEdgeTests.cs.meta +11 -0
  1279. package/Tests/Runtime/Serialization/ProtoRootRegistrationTests.cs +80 -0
  1280. package/Tests/Runtime/Serialization/ProtoRootRegistrationTests.cs.meta +11 -0
  1281. package/Tests/Runtime/Serialization/ProtoRoundtripComprehensiveTests.cs +257 -0
  1282. package/Tests/Runtime/Serialization/ProtoRoundtripComprehensiveTests.cs.meta +11 -0
  1283. package/Tests/Runtime/Serialization/ProtoSerializationCorrectnessTests.cs +471 -0
  1284. package/Tests/Runtime/Serialization/ProtoSerializationCorrectnessTests.cs.meta +3 -0
  1285. package/Tests/Runtime/Serialization/ProtoSerializationTests.cs +169 -0
  1286. package/Tests/Runtime/Serialization/ProtoSerializationTests.cs.meta +11 -0
  1287. package/Tests/Runtime/Serialization/ProtoSerializeBehaviorTests.cs +62 -0
  1288. package/Tests/Runtime/Serialization/ProtoSerializeBehaviorTests.cs.meta +11 -0
  1289. package/Tests/Runtime/Serialization/SerializerAdditionalTests.cs +895 -0
  1290. package/Tests/Runtime/Serialization/SerializerAdditionalTests.cs.meta +3 -0
  1291. package/Tests/Runtime/Serialization/TypeConverterTests.cs +34 -0
  1292. package/Tests/Runtime/Serialization/TypeConverterTests.cs.meta +11 -0
  1293. package/Tests/Runtime/Serialization.meta +2 -2
  1294. package/Tests/Runtime/Tags/AttributeComponentTests.cs +174 -0
  1295. package/Tests/Runtime/Tags/AttributeComponentTests.cs.meta +3 -0
  1296. package/Tests/Runtime/Tags/AttributeDataTests.cs +312 -0
  1297. package/Tests/Runtime/Tags/AttributeDataTests.cs.meta +11 -0
  1298. package/Tests/Runtime/Tags/AttributeUtilitiesTests.cs +405 -0
  1299. package/Tests/Runtime/Tags/AttributeUtilitiesTests.cs.meta +3 -0
  1300. package/Tests/Runtime/Tags/CosmeticAndCollisionTests.cs +147 -0
  1301. package/Tests/Runtime/Tags/CosmeticAndCollisionTests.cs.meta +11 -0
  1302. package/Tests/Runtime/Tags/CosmeticEffectDataTests.cs +60 -0
  1303. package/Tests/Runtime/Tags/CosmeticEffectDataTests.cs.meta +3 -0
  1304. package/Tests/Runtime/Tags/EffectHandleTests.cs +61 -0
  1305. package/Tests/Runtime/Tags/EffectHandleTests.cs.meta +3 -0
  1306. package/Tests/Runtime/Tags/EffectHandlerTests.cs +270 -0
  1307. package/Tests/Runtime/Tags/EffectHandlerTests.cs.meta +3 -0
  1308. package/Tests/Runtime/Tags/Helpers/RecordingCosmeticComponent.cs +39 -0
  1309. package/Tests/Runtime/Tags/Helpers/RecordingCosmeticComponent.cs.meta +3 -0
  1310. package/Tests/Runtime/Tags/Helpers/TagTestBase.cs +49 -0
  1311. package/Tests/Runtime/Tags/Helpers/TagTestBase.cs.meta +3 -0
  1312. package/Tests/Runtime/Tags/Helpers/TestAttributesComponent.cs +28 -0
  1313. package/Tests/Runtime/Tags/Helpers/TestAttributesComponent.cs.meta +3 -0
  1314. package/Tests/Runtime/Tags/Helpers.meta +3 -0
  1315. package/Tests/Runtime/Tags/TagHandlerTests.cs +108 -0
  1316. package/Tests/Runtime/Tags/TagHandlerTests.cs.meta +3 -0
  1317. package/Tests/Runtime/Tags.meta +8 -0
  1318. package/Tests/Runtime/TestUtils/CommonTestBase.cs +213 -0
  1319. package/Tests/Runtime/TestUtils/CommonTestBase.cs.meta +11 -0
  1320. package/Tests/Runtime/TestUtils/GCAssert.cs +55 -0
  1321. package/Tests/Runtime/TestUtils/GCAssert.cs.meta +11 -0
  1322. package/Tests/Runtime/TestUtils/SpatialAssert.cs +33 -0
  1323. package/Tests/Runtime/TestUtils/SpatialAssert.cs.meta +11 -0
  1324. package/Tests/Runtime/TestUtils/SpatialDiagnostics.cs +195 -0
  1325. package/Tests/Runtime/TestUtils/SpatialDiagnostics.cs.meta +11 -0
  1326. package/Tests/Runtime/TestUtils.meta +8 -0
  1327. package/Tests/Runtime/Utils/AnimationEventEqualityComparerTests.cs +144 -0
  1328. package/Tests/Runtime/Utils/AnimationEventEqualityComparerTests.cs.meta +11 -0
  1329. package/Tests/Runtime/Utils/Ascii85Tests.cs +56 -0
  1330. package/Tests/Runtime/Utils/Ascii85Tests.cs.meta +11 -0
  1331. package/Tests/Runtime/Utils/BuffersTests.cs +1148 -741
  1332. package/Tests/Runtime/Utils/BuffersTests.cs.meta +2 -2
  1333. package/Tests/Runtime/Utils/BuffersWaitInstructionTests.cs +31 -0
  1334. package/Tests/Runtime/Utils/BuffersWaitInstructionTests.cs.meta +11 -0
  1335. package/Tests/Runtime/Utils/CenterPointOffsetTests.cs +67 -0
  1336. package/Tests/Runtime/Utils/CenterPointOffsetTests.cs.meta +11 -0
  1337. package/Tests/Runtime/Utils/ChildSpawnerTests.cs +490 -0
  1338. package/Tests/Runtime/Utils/ChildSpawnerTests.cs.meta +11 -0
  1339. package/Tests/Runtime/Utils/CircleLineRendererTests.cs +80 -0
  1340. package/Tests/Runtime/Utils/CircleLineRendererTests.cs.meta +11 -0
  1341. package/Tests/Runtime/Utils/CollisionProxyTests.cs +442 -0
  1342. package/Tests/Runtime/Utils/CollisionProxyTests.cs.meta +11 -0
  1343. package/Tests/Runtime/Utils/CoroutineHandlerTests.cs +353 -0
  1344. package/Tests/Runtime/Utils/CoroutineHandlerTests.cs.meta +11 -0
  1345. package/Tests/Runtime/Utils/DeferredDisposalResultTests.cs +44 -0
  1346. package/Tests/Runtime/Utils/DeferredDisposalResultTests.cs.meta +11 -0
  1347. package/Tests/Runtime/Utils/LZMAComprehensiveTests.cs +249 -0
  1348. package/Tests/Runtime/Utils/LZMAComprehensiveTests.cs.meta +11 -0
  1349. package/Tests/Runtime/Utils/LZMATests.cs +31 -0
  1350. package/Tests/Runtime/Utils/LZMATests.cs.meta +11 -0
  1351. package/Tests/Runtime/Utils/MatchColliderToSpriteAdditionalTests.cs +86 -0
  1352. package/Tests/Runtime/Utils/MatchColliderToSpriteAdditionalTests.cs.meta +11 -0
  1353. package/Tests/Runtime/Utils/MatchColliderToSpriteTests.cs +503 -0
  1354. package/Tests/Runtime/Utils/MatchColliderToSpriteTests.cs.meta +11 -0
  1355. package/Tests/Runtime/Utils/MatchTransformEdgeTests.cs +34 -0
  1356. package/Tests/Runtime/Utils/MatchTransformEdgeTests.cs.meta +11 -0
  1357. package/Tests/Runtime/Utils/MatchTransformTests.cs +495 -0
  1358. package/Tests/Runtime/Utils/MatchTransformTests.cs.meta +11 -0
  1359. package/Tests/Runtime/Utils/OscillatorTests.cs +540 -0
  1360. package/Tests/Runtime/Utils/OscillatorTests.cs.meta +11 -0
  1361. package/Tests/Runtime/Utils/PolygonCollider2DOptimizerTests.cs +52 -0
  1362. package/Tests/Runtime/Utils/PolygonCollider2DOptimizerTests.cs.meta +11 -0
  1363. package/Tests/Runtime/Utils/RuntimeSingletonTests.cs +766 -0
  1364. package/Tests/Runtime/Utils/RuntimeSingletonTests.cs.meta +11 -0
  1365. package/Tests/Runtime/Utils/SerializedStringComparerEdgeTests.cs +47 -0
  1366. package/Tests/Runtime/Utils/SerializedStringComparerEdgeTests.cs.meta +11 -0
  1367. package/Tests/Runtime/Utils/SerializedStringComparerTests.cs +361 -0
  1368. package/Tests/Runtime/Utils/SerializedStringComparerTests.cs.meta +11 -0
  1369. package/Tests/Runtime/Utils/SpriteRendererMetadataTests.cs +383 -398
  1370. package/Tests/Runtime/Utils/SpriteRendererMetadataTests.cs.meta +2 -2
  1371. package/Tests/Runtime/Utils/SpriteRendererSyncTests.cs +134 -0
  1372. package/Tests/Runtime/Utils/SpriteRendererSyncTests.cs.meta +11 -0
  1373. package/Tests/Runtime/Utils/StartTrackerTests.cs +24 -0
  1374. package/Tests/Runtime/Utils/StartTrackerTests.cs.meta +11 -0
  1375. package/Tests/Runtime/Utils/TextureScaleEdgeTests.cs +114 -0
  1376. package/Tests/Runtime/Utils/TextureScaleEdgeTests.cs.meta +11 -0
  1377. package/Tests/Runtime/Utils/TextureScaleTests.cs +298 -0
  1378. package/Tests/Runtime/Utils/TextureScaleTests.cs.meta +3 -0
  1379. package/Tests/Runtime/Utils/TypeNameSorterAdditionalTests.cs +36 -0
  1380. package/Tests/Runtime/Utils/TypeNameSorterAdditionalTests.cs.meta +11 -0
  1381. package/Tests/Runtime/Utils/TypeNameSorterTests.cs +34 -0
  1382. package/Tests/Runtime/Utils/TypeNameSorterTests.cs.meta +11 -0
  1383. package/Tests/Runtime/Utils/UnityObjectNameComparerEdgeTests.cs +63 -0
  1384. package/Tests/Runtime/Utils/UnityObjectNameComparerEdgeTests.cs.meta +11 -0
  1385. package/Tests/Runtime/Utils/UnityObjectNameComparerTests.cs +59 -0
  1386. package/Tests/Runtime/Utils/UnityObjectNameComparerTests.cs.meta +11 -0
  1387. package/Tests/Runtime/Utils.meta +2 -2
  1388. package/Tests/Runtime/Visuals/AnimatedSpriteLayerTests.cs +266 -0
  1389. package/Tests/Runtime/Visuals/AnimatedSpriteLayerTests.cs.meta +11 -0
  1390. package/Tests/Runtime/Visuals/EnhancedImageTests.cs +184 -0
  1391. package/Tests/Runtime/Visuals/EnhancedImageTests.cs.meta +11 -0
  1392. package/Tests/Runtime/Visuals/LayeredImageTests.cs +422 -0
  1393. package/Tests/Runtime/Visuals/LayeredImageTests.cs.meta +11 -0
  1394. package/Tests/Runtime/Visuals/VisualsTestHelpers.cs +132 -0
  1395. package/Tests/Runtime/Visuals/VisualsTestHelpers.cs.meta +11 -0
  1396. package/Tests/Runtime/Visuals.meta +3 -0
  1397. package/Tests/Runtime/WallstopStudios.UnityHelpers.Tests.Runtime.asmdef +24 -23
  1398. package/Tests/Runtime/WallstopStudios.UnityHelpers.Tests.Runtime.asmdef.meta +7 -7
  1399. package/Tests/Runtime.meta +8 -8
  1400. package/Tests.meta +8 -8
  1401. package/URP/VolumeProfiles/Post Processing Bloom Profile(URP).asset +63 -63
  1402. package/URP/VolumeProfiles/Post Processing Bloom Profile(URP).asset.meta +8 -8
  1403. package/URP/VolumeProfiles.meta +8 -8
  1404. package/URP.meta +8 -8
  1405. package/node_modules.meta +8 -0
  1406. package/package.json +95 -38
  1407. package/package.json.meta +7 -7
  1408. package/scripts/check-eol.ps1 +52 -0
  1409. package/scripts/check-eol.ps1.meta +7 -0
  1410. package/scripts/clean-nul.ps1 +29 -0
  1411. package/scripts/clean-nul.ps1.meta +7 -0
  1412. package/scripts/lint-doc-links.ps1 +80 -0
  1413. package/scripts/lint-doc-links.ps1.meta +7 -0
  1414. package/scripts/normalize-eol.ps1 +71 -0
  1415. package/scripts/normalize-eol.ps1.meta +7 -0
  1416. package/scripts.meta +8 -0
  1417. package/Editor/Sprites/ProjectAnimationSettings.cs +0 -50
  1418. package/Editor/Sprites/ProjectAnimationSettings.cs.meta +0 -3
  1419. package/Editor/Sprites/TextureSettingsApplier.cs +0 -178
  1420. package/Editor/Sprites/TextureSettingsApplier.cs.meta +0 -3
  1421. package/Runtime/Core/Attributes/ParentComponent.cs +0 -189
  1422. package/Runtime/Core/DataStructure/KDTree.cs +0 -434
  1423. package/Runtime/Core/DataStructure/QuadTree.cs +0 -431
  1424. package/Runtime/Core/DataStructure/RTree.cs +0 -356
  1425. package/Runtime/Core/Extension/HashSetExtensions.cs +0 -12
  1426. package/Runtime/Core/Extension/HashSetExtensions.cs.meta +0 -11
  1427. package/Runtime/Core/Math/Line.cs +0 -55
  1428. package/Runtime/Core/Math/Line.cs.meta +0 -11
  1429. package/Runtime/Core/Math/XXHash.cs +0 -310
  1430. package/Runtime/Core/Math/XXHash.cs.meta +0 -11
  1431. package/Tests/Runtime/Components/RelationalComponentsTesterSimple.cs +0 -40
  1432. package/Tests/Runtime/Components.meta +0 -3
  1433. package/Tests/Runtime/DataStructures/BalancedKDTreeTests.cs +0 -14
  1434. package/Tests/Runtime/DataStructures/QuadTreeTests.cs +0 -14
  1435. package/Tests/Runtime/DataStructures/QuadTreeTests.cs.meta +0 -11
  1436. package/Tests/Runtime/DataStructures/SpatialTreeTests.cs +0 -130
  1437. package/Tests/Runtime/DataStructures/SpatialTreeTests.cs.meta +0 -11
  1438. package/Tests/Runtime/DataStructures/UnbalancedKDTreeTests.cs +0 -14
  1439. package/Tests/Runtime/Helper/FormattingHelperTests.cs +0 -129
  1440. package/Tests/Runtime/Helper/FormattingHelperTests.cs.meta +0 -3
  1441. package/Tests/Runtime/Performance/KDTreePerformanceTests.cs +0 -14
  1442. package/Tests/Runtime/Performance/KDTreePerformanceTests.cs.meta +0 -11
  1443. package/Tests/Runtime/Performance/QuadTreePerformanceTests.cs +0 -14
  1444. package/Tests/Runtime/Performance/QuadTreePerformanceTests.cs.meta +0 -11
  1445. package/Tests/Runtime/Performance/SpatialTreePerformanceTest.cs +0 -158
  1446. package/Tests/Runtime/Performance/SpatialTreePerformanceTest.cs.meta +0 -11
  1447. package/Tests/Runtime/Performance/UnbalancedKDTreeTests.cs +0 -14
  1448. package/Tests/Runtime/Performance/UnbalancedKDTreeTests.cs.meta +0 -11
  1449. package/Third Party Notices.md +0 -1
@@ -1,1493 +1,2199 @@
1
- namespace WallstopStudios.UnityHelpers.Tests.Helper
2
- {
3
- using System;
4
- using System.Collections;
5
- using System.Collections.Generic;
6
- using System.Linq;
7
- using System.Reflection;
8
- using NUnit.Framework;
9
- using WallstopStudios.UnityHelpers.Core.Helper;
10
- using WallstopStudios.UnityHelpers.Core.Random;
11
- using CategoryAttribute = System.ComponentModel.CategoryAttribute;
12
- using DescriptionAttribute = System.ComponentModel.DescriptionAttribute;
13
-
14
- [AttributeUsage(AttributeTargets.All)]
15
- public class ReflectionTestAttribute : Attribute
16
- {
17
- public string Name { get; set; }
18
- public int Value { get; set; }
19
-
20
- public ReflectionTestAttribute() { }
21
-
22
- public ReflectionTestAttribute(string name, int value)
23
- {
24
- Name = name;
25
- Value = value;
26
- }
27
- }
28
-
29
- public struct TestStruct
30
- {
31
- public static int staticIntValue;
32
- public int intValue;
33
- }
34
-
35
- public sealed class TestClass
36
- {
37
- public static int staticIntValue;
38
- public int intValue;
39
- }
40
-
41
- public class TestMethodClass
42
- {
43
- public static int StaticMethodCallCount = 0;
44
- public int InstanceMethodCallCount = 0;
45
-
46
- // Void methods
47
- public static void StaticVoidMethod()
48
- {
49
- StaticMethodCallCount++;
50
- }
51
-
52
- public void InstanceVoidMethod()
53
- {
54
- InstanceMethodCallCount++;
55
- }
56
-
57
- // Return value methods
58
- public static int StaticIntMethod()
59
- {
60
- StaticMethodCallCount++;
61
- return 42;
62
- }
63
-
64
- public static string StaticStringMethod()
65
- {
66
- StaticMethodCallCount++;
67
- return "test";
68
- }
69
-
70
- public static bool StaticBoolMethod()
71
- {
72
- StaticMethodCallCount++;
73
- return true;
74
- }
75
-
76
- public int InstanceIntMethod()
77
- {
78
- InstanceMethodCallCount++;
79
- return 100;
80
- }
81
-
82
- public string InstanceStringMethod()
83
- {
84
- InstanceMethodCallCount++;
85
- return "instance";
86
- }
87
-
88
- // Methods with parameters
89
- public static int StaticMethodWithParam(int param)
90
- {
91
- StaticMethodCallCount++;
92
- return param * 2;
93
- }
94
-
95
- public int InstanceMethodWithParam(string param)
96
- {
97
- InstanceMethodCallCount++;
98
- return param?.Length ?? 0;
99
- }
100
-
101
- public static void StaticVoidMethodWithParam(int param)
102
- {
103
- StaticMethodCallCount = param;
104
- }
105
-
106
- // Multiple parameter methods
107
- public static int StaticMethodMultipleParams(int a, string b, bool c)
108
- {
109
- StaticMethodCallCount++;
110
- return a + (b?.Length ?? 0) + (c ? 1 : 0);
111
- }
112
-
113
- public void Reset()
114
- {
115
- StaticMethodCallCount = 0;
116
- InstanceMethodCallCount = 0;
117
- }
118
- }
119
-
120
- public sealed class TestConstructorClass
121
- {
122
- public int Value1 { get; }
123
- public string Value2 { get; }
124
- public bool Value3 { get; }
125
-
126
- public TestConstructorClass()
127
- {
128
- Value1 = 0;
129
- Value2 = "default";
130
- Value3 = false;
131
- }
132
-
133
- public TestConstructorClass(int value1)
134
- {
135
- Value1 = value1;
136
- Value2 = "single";
137
- Value3 = false;
138
- }
139
-
140
- public TestConstructorClass(int value1, string value2)
141
- {
142
- Value1 = value1;
143
- Value2 = value2;
144
- Value3 = false;
145
- }
146
-
147
- public TestConstructorClass(int value1, string value2, bool value3)
148
- {
149
- Value1 = value1;
150
- Value2 = value2;
151
- Value3 = value3;
152
- }
153
- }
154
-
155
- public readonly struct TestConstructorStruct
156
- {
157
- public int Value { get; }
158
-
159
- public TestConstructorStruct(int value)
160
- {
161
- Value = value;
162
- }
163
- }
164
-
165
- public sealed class TestPropertyClass
166
- {
167
- private static int _staticValue = 50;
168
- private int _instanceValue = 25;
169
-
170
- public static int StaticProperty
171
- {
172
- get => _staticValue;
173
- set => _staticValue = value;
174
- }
175
-
176
- public int InstanceProperty
177
- {
178
- get => _instanceValue;
179
- set => _instanceValue = value;
180
- }
181
-
182
- public static string StaticStringProperty { get; set; } = "static";
183
-
184
- public string InstanceStringProperty { get; set; } = "instance";
185
-
186
- // Read-only properties
187
- public static int StaticReadOnlyProperty => 999;
188
- public int InstanceReadOnlyProperty => 888;
189
- }
190
-
191
- [Description("Test class for attribute testing")]
192
- [ReflectionTestAttribute("ClassLevel", 10)]
193
- public sealed class TestAttributeClass
194
- {
195
- [Description("Static field with description")]
196
- [ReflectionTestAttribute("StaticField", 15)]
197
- public static int StaticFieldWithAttribute = 1;
198
-
199
- [Category("TestCategory")]
200
- [ReflectionTestAttribute("InstanceField", 5)]
201
- public int InstanceFieldWithAttribute = 2;
202
-
203
- [Description("Static property for testing")]
204
- [ReflectionTestAttribute("StaticProperty", 20)]
205
- public static string StaticPropertyWithAttribute { get; set; } = "static";
206
-
207
- [Category("TestCategory")]
208
- [Description("Instance property")]
209
- [ReflectionTestAttribute("InstanceProperty", 8)]
210
- public string InstancePropertyWithAttribute { get; set; } = "instance";
211
-
212
- [Description("Static method for testing")]
213
- [ReflectionTestAttribute("StaticMethod", 12)]
214
- public static void StaticMethodWithAttribute() { }
215
-
216
- [Category("TestCategory")]
217
- [ReflectionTestAttribute("InstanceMethod", 7)]
218
- public void InstanceMethodWithAttribute() { }
219
-
220
- public void MethodWithAttributedParameter(
221
- [Description("Parameter with description")] int param
222
- ) { }
223
- }
224
-
225
- public sealed class GenericTestClass<T>
226
- {
227
- public T Value { get; set; }
228
-
229
- public GenericTestClass() { }
230
-
231
- public GenericTestClass(T value)
232
- {
233
- Value = value;
234
- }
235
- }
236
-
237
- public sealed class ReflectionHelperTests
238
- {
239
- private const int NumTries = 1_000;
240
-
241
- [Test]
242
- public void GetFieldGetterClassMemberField()
243
- {
244
- TestClass testClass = new();
245
- Func<object, object> classGetter = ReflectionHelpers.GetFieldGetter(
246
- typeof(TestClass).GetField(nameof(TestClass.intValue))
247
- );
248
- Assert.AreEqual(testClass.intValue, classGetter(testClass));
249
- for (int i = 0; i < NumTries; ++i)
250
- {
251
- testClass.intValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
252
- Assert.AreEqual(testClass.intValue, classGetter(testClass));
253
- }
254
- }
255
-
256
- [Test]
257
- public void GetFieldGetterClassStaticField()
258
- {
259
- TestClass testClass = new();
260
- Func<object, object> classGetter = ReflectionHelpers.GetFieldGetter(
261
- typeof(TestClass).GetField(
262
- nameof(TestClass.staticIntValue),
263
- BindingFlags.Static | BindingFlags.Public
264
- )
265
- );
266
- Assert.AreEqual(TestClass.staticIntValue, classGetter(testClass));
267
- for (int i = 0; i < NumTries; ++i)
268
- {
269
- TestClass.staticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
270
- Assert.AreEqual(TestClass.staticIntValue, classGetter(testClass));
271
- }
272
- }
273
-
274
- [Test]
275
- public void GetStaticFieldGetterThrowsOnNonStaticField()
276
- {
277
- Assert.Throws<ArgumentException>(() =>
278
- ReflectionHelpers.GetStaticFieldGetter(
279
- typeof(TestClass).GetField(nameof(TestClass.intValue))
280
- )
281
- );
282
- }
283
-
284
- [Test]
285
- public void GetStaticFieldGetterClassStaticField()
286
- {
287
- Func<object> classGetter = ReflectionHelpers.GetStaticFieldGetter(
288
- typeof(TestClass).GetField(
289
- nameof(TestClass.staticIntValue),
290
- BindingFlags.Static | BindingFlags.Public
291
- )
292
- );
293
- Assert.AreEqual(TestClass.staticIntValue, classGetter());
294
- for (int i = 0; i < NumTries; ++i)
295
- {
296
- TestClass.staticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
297
- Assert.AreEqual(TestClass.staticIntValue, classGetter());
298
- }
299
- }
300
-
301
- [Test]
302
- public void GetFieldGetterStructMemberField()
303
- {
304
- TestStruct testStruct = new();
305
- Func<object, object> structGetter = ReflectionHelpers.GetFieldGetter(
306
- typeof(TestStruct).GetField(nameof(TestStruct.intValue))
307
- );
308
- Assert.AreEqual(testStruct.intValue, structGetter(testStruct));
309
- for (int i = 0; i < NumTries; ++i)
310
- {
311
- testStruct.intValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
312
- Assert.AreEqual(testStruct.intValue, structGetter(testStruct));
313
- }
314
- }
315
-
316
- [Test]
317
- public void GetFieldGetterStructStaticField()
318
- {
319
- TestStruct testStruct = new();
320
- Func<object, object> structGetter = ReflectionHelpers.GetFieldGetter(
321
- typeof(TestStruct).GetField(
322
- nameof(TestStruct.staticIntValue),
323
- BindingFlags.Static | BindingFlags.Public
324
- )
325
- );
326
- Assert.AreEqual(TestStruct.staticIntValue, structGetter(testStruct));
327
- for (int i = 0; i < NumTries; ++i)
328
- {
329
- TestStruct.staticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
330
- Assert.AreEqual(TestStruct.staticIntValue, structGetter(testStruct));
331
- }
332
- }
333
-
334
- [Test]
335
- public void GetStaticFieldGetterStructStaticField()
336
- {
337
- Func<object> structGetter = ReflectionHelpers.GetStaticFieldGetter(
338
- typeof(TestStruct).GetField(
339
- nameof(TestStruct.staticIntValue),
340
- BindingFlags.Static | BindingFlags.Public
341
- )
342
- );
343
- Assert.AreEqual(TestStruct.staticIntValue, structGetter());
344
- for (int i = 0; i < NumTries; ++i)
345
- {
346
- TestStruct.staticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
347
- Assert.AreEqual(TestStruct.staticIntValue, structGetter());
348
- }
349
- }
350
-
351
- [Test]
352
- public void GetFieldSetterClassMemberField()
353
- {
354
- TestClass testClass = new();
355
- Action<object, object> structSetter = ReflectionHelpers.GetFieldSetter(
356
- typeof(TestClass).GetField(nameof(TestClass.intValue))
357
- );
358
- for (int i = 0; i < NumTries; ++i)
359
- {
360
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
361
- structSetter(testClass, expected);
362
- Assert.AreEqual(expected, testClass.intValue);
363
- }
364
- }
365
-
366
- [Test]
367
- public void GetFieldSetterClassStaticField()
368
- {
369
- TestClass testClass = new();
370
- Action<object, object> structSetter = ReflectionHelpers.GetFieldSetter(
371
- typeof(TestClass).GetField(
372
- nameof(TestClass.staticIntValue),
373
- BindingFlags.Static | BindingFlags.Public
374
- )
375
- );
376
- for (int i = 0; i < NumTries; ++i)
377
- {
378
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
379
- structSetter(testClass, expected);
380
- Assert.AreEqual(expected, TestClass.staticIntValue);
381
- }
382
- }
383
-
384
- [Test]
385
- public void GetStaticFieldSetterThrowsOnNonStaticField()
386
- {
387
- Assert.Throws<ArgumentException>(() =>
388
- ReflectionHelpers.GetStaticFieldSetter(
389
- typeof(TestClass).GetField(nameof(TestClass.intValue))
390
- )
391
- );
392
- }
393
-
394
- [Test]
395
- public void GetStaticFieldSetterClassStaticField()
396
- {
397
- Action<object> structSetter = ReflectionHelpers.GetStaticFieldSetter(
398
- typeof(TestClass).GetField(
399
- nameof(TestClass.staticIntValue),
400
- BindingFlags.Static | BindingFlags.Public
401
- )
402
- );
403
- for (int i = 0; i < NumTries; ++i)
404
- {
405
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
406
- structSetter(expected);
407
- Assert.AreEqual(expected, TestClass.staticIntValue);
408
- }
409
- }
410
-
411
- [Test]
412
- public void GetFieldSetterStructMemberField()
413
- {
414
- // Need boxing
415
- object testStruct = new TestStruct();
416
- Action<object, object> structSetter = ReflectionHelpers.GetFieldSetter(
417
- typeof(TestStruct).GetField(nameof(TestStruct.intValue))
418
- );
419
- for (int i = 0; i < NumTries; ++i)
420
- {
421
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
422
- structSetter(testStruct, expected);
423
- Assert.AreEqual(expected, ((TestStruct)testStruct).intValue);
424
- }
425
- }
426
-
427
- [Test]
428
- public void GetFieldSetterStructStaticField()
429
- {
430
- // Need boxing
431
- object testStruct = new TestStruct();
432
- Action<object, object> structSetter = ReflectionHelpers.GetFieldSetter(
433
- typeof(TestStruct).GetField(
434
- nameof(TestStruct.staticIntValue),
435
- BindingFlags.Static | BindingFlags.Public
436
- )
437
- );
438
- for (int i = 0; i < NumTries; ++i)
439
- {
440
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
441
- structSetter(testStruct, expected);
442
- Assert.AreEqual(expected, TestStruct.staticIntValue);
443
- }
444
- }
445
-
446
- [Test]
447
- public void GetStaticFieldSetterStructStaticField()
448
- {
449
- Action<object> structSetter = ReflectionHelpers.GetStaticFieldSetter(
450
- typeof(TestStruct).GetField(
451
- nameof(TestStruct.staticIntValue),
452
- BindingFlags.Static | BindingFlags.Public
453
- )
454
- );
455
- for (int i = 0; i < NumTries; ++i)
456
- {
457
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
458
- structSetter(expected);
459
- Assert.AreEqual(expected, TestStruct.staticIntValue);
460
- }
461
- }
462
-
463
- [Test]
464
- public void GetFieldSetterClassGenericMemberField()
465
- {
466
- TestClass testClass = new();
467
- FieldSetter<TestClass, int> classSetter = ReflectionHelpers.GetFieldSetter<
468
- TestClass,
469
- int
470
- >(typeof(TestClass).GetField(nameof(TestClass.intValue)));
471
- for (int i = 0; i < NumTries; ++i)
472
- {
473
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
474
- classSetter(ref testClass, expected);
475
- Assert.AreEqual(expected, testClass.intValue);
476
- }
477
- }
478
-
479
- [Test]
480
- public void GetFieldSetterClassGenericStaticField()
481
- {
482
- TestClass testClass = new();
483
- FieldSetter<TestClass, int> classSetter = ReflectionHelpers.GetFieldSetter<
484
- TestClass,
485
- int
486
- >(
487
- typeof(TestClass).GetField(
488
- nameof(TestClass.staticIntValue),
489
- BindingFlags.Static | BindingFlags.Public
490
- )
491
- );
492
- for (int i = 0; i < NumTries; ++i)
493
- {
494
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
495
- classSetter(ref testClass, expected);
496
- Assert.AreEqual(expected, TestClass.staticIntValue);
497
- }
498
- }
499
-
500
- [Test]
501
- public void GetStaticFieldSetterGenericThrowsOnNonStaticField()
502
- {
503
- Assert.Throws<ArgumentException>(() =>
504
- ReflectionHelpers.GetStaticFieldSetter<int>(
505
- typeof(TestClass).GetField(nameof(TestClass.intValue))
506
- )
507
- );
508
- }
509
-
510
- [Test]
511
- public void GetStaticFieldSetterClassGenericStaticField()
512
- {
513
- Action<int> classSetter = ReflectionHelpers.GetStaticFieldSetter<int>(
514
- typeof(TestClass).GetField(
515
- nameof(TestClass.staticIntValue),
516
- BindingFlags.Static | BindingFlags.Public
517
- )
518
- );
519
- for (int i = 0; i < NumTries; ++i)
520
- {
521
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
522
- classSetter(expected);
523
- Assert.AreEqual(expected, TestClass.staticIntValue);
524
- }
525
- }
526
-
527
- [Test]
528
- public void GetFieldSetterStructGenericMemberField()
529
- {
530
- TestStruct testStruct = new();
531
- FieldSetter<TestStruct, int> structSetter = ReflectionHelpers.GetFieldSetter<
532
- TestStruct,
533
- int
534
- >(typeof(TestStruct).GetField(nameof(TestStruct.intValue)));
535
- for (int i = 0; i < NumTries; ++i)
536
- {
537
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
538
- structSetter(ref testStruct, expected);
539
- Assert.AreEqual(expected, testStruct.intValue);
540
- }
541
- }
542
-
543
- [Test]
544
- public void GetFieldSetterStructGenericStaticField()
545
- {
546
- TestStruct testStruct = new();
547
- FieldSetter<TestStruct, int> structSetter = ReflectionHelpers.GetFieldSetter<
548
- TestStruct,
549
- int
550
- >(
551
- typeof(TestStruct).GetField(
552
- nameof(TestStruct.staticIntValue),
553
- BindingFlags.Static | BindingFlags.Public
554
- )
555
- );
556
- for (int i = 0; i < NumTries; ++i)
557
- {
558
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
559
- structSetter(ref testStruct, expected);
560
- Assert.AreEqual(expected, TestStruct.staticIntValue);
561
- }
562
- }
563
-
564
- [Test]
565
- public void GetStaticFieldSetterStructGenericStaticField()
566
- {
567
- Action<int> structSetter = ReflectionHelpers.GetStaticFieldSetter<int>(
568
- typeof(TestStruct).GetField(
569
- nameof(TestStruct.staticIntValue),
570
- BindingFlags.Static | BindingFlags.Public
571
- )
572
- );
573
- for (int i = 0; i < NumTries; ++i)
574
- {
575
- int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
576
- structSetter(expected);
577
- Assert.AreEqual(expected, TestStruct.staticIntValue);
578
- }
579
- }
580
-
581
- [Test]
582
- public void GetFieldGetterClassGenericMemberField()
583
- {
584
- TestClass testClass = new();
585
- Func<TestClass, int> classGetter = ReflectionHelpers.GetFieldGetter<TestClass, int>(
586
- typeof(TestClass).GetField(nameof(TestClass.intValue))
587
- );
588
- for (int i = 0; i < NumTries; ++i)
589
- {
590
- testClass.intValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
591
- Assert.AreEqual(testClass.intValue, classGetter(testClass));
592
- }
593
- }
594
-
595
- [Test]
596
- public void GetFieldGetterClassGenericStaticField()
597
- {
598
- TestClass testClass = new();
599
- Func<TestClass, int> classGetter = ReflectionHelpers.GetFieldGetter<TestClass, int>(
600
- typeof(TestClass).GetField(
601
- nameof(TestClass.staticIntValue),
602
- BindingFlags.Static | BindingFlags.Public
603
- )
604
- );
605
- for (int i = 0; i < NumTries; ++i)
606
- {
607
- TestClass.staticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
608
- Assert.AreEqual(TestClass.staticIntValue, classGetter(testClass));
609
- }
610
- }
611
-
612
- [Test]
613
- public void GetStaticFieldGetterGenericThrowsOnNonStaticField()
614
- {
615
- Assert.Throws<ArgumentException>(() =>
616
- ReflectionHelpers.GetStaticFieldGetter<int>(
617
- typeof(TestClass).GetField(nameof(TestClass.intValue))
618
- )
619
- );
620
- }
621
-
622
- [Test]
623
- public void GetStaticFieldGetterClassGenericStaticField()
624
- {
625
- Func<int> classGetter = ReflectionHelpers.GetStaticFieldGetter<int>(
626
- typeof(TestClass).GetField(
627
- nameof(TestClass.staticIntValue),
628
- BindingFlags.Static | BindingFlags.Public
629
- )
630
- );
631
- for (int i = 0; i < NumTries; ++i)
632
- {
633
- TestClass.staticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
634
- Assert.AreEqual(TestClass.staticIntValue, classGetter());
635
- }
636
- }
637
-
638
- [Test]
639
- public void GetFieldGetterStructGenericMemberField()
640
- {
641
- TestStruct testStruct = new();
642
- Func<TestStruct, int> structSetter = ReflectionHelpers.GetFieldGetter<TestStruct, int>(
643
- typeof(TestStruct).GetField(nameof(TestStruct.intValue))
644
- );
645
- for (int i = 0; i < NumTries; ++i)
646
- {
647
- testStruct.intValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
648
- Assert.AreEqual(testStruct.intValue, structSetter(testStruct));
649
- }
650
- }
651
-
652
- [Test]
653
- public void GetFieldGetterStructGenericStaticField()
654
- {
655
- TestStruct testStruct = new();
656
- Func<TestStruct, int> structSetter = ReflectionHelpers.GetFieldGetter<TestStruct, int>(
657
- typeof(TestStruct).GetField(
658
- nameof(TestStruct.staticIntValue),
659
- BindingFlags.Static | BindingFlags.Public
660
- )
661
- );
662
- for (int i = 0; i < NumTries; ++i)
663
- {
664
- TestStruct.staticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
665
- Assert.AreEqual(TestStruct.staticIntValue, structSetter(testStruct));
666
- }
667
- }
668
-
669
- [Test]
670
- public void GetStaticFieldGetterStructGenericStaticField()
671
- {
672
- Func<int> structSetter = ReflectionHelpers.GetStaticFieldGetter<int>(
673
- typeof(TestStruct).GetField(
674
- nameof(TestStruct.staticIntValue),
675
- BindingFlags.Static | BindingFlags.Public
676
- )
677
- );
678
- for (int i = 0; i < NumTries; ++i)
679
- {
680
- TestStruct.staticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
681
- Assert.AreEqual(TestStruct.staticIntValue, structSetter());
682
- }
683
- }
684
-
685
- [Test]
686
- public void ArrayCreator()
687
- {
688
- for (int i = 0; i < NumTries; ++i)
689
- {
690
- int count = PRNG.Instance.Next(1_000);
691
- Array created = ReflectionHelpers.CreateArray(typeof(int), count);
692
- Assert.AreEqual(count, created.Length);
693
- Assert.IsTrue(created is int[]);
694
- int[] typed = (int[])created;
695
- Assert.AreEqual(count, typed.Length);
696
- }
697
- }
698
-
699
- [Test]
700
- public void ListCreator()
701
- {
702
- for (int i = 0; i < NumTries; ++i)
703
- {
704
- IList created = ReflectionHelpers.CreateList(typeof(int));
705
- Assert.AreEqual(0, created.Count);
706
- Assert.IsTrue(created is List<int>);
707
- List<int> typedCreated = (List<int>)created;
708
- int count = PRNG.Instance.Next(50);
709
- List<int> expected = new();
710
- for (int j = 0; j < count; ++j)
711
- {
712
- int element = PRNG.Instance.Next();
713
- created.Add(element);
714
- expected.Add(element);
715
- Assert.AreEqual(j + 1, created.Count);
716
- Assert.That(expected, Is.EqualTo(typedCreated));
717
- }
718
- }
719
- }
720
-
721
- [Test]
722
- public void ListWithSizeCreator()
723
- {
724
- for (int i = 0; i < NumTries; ++i)
725
- {
726
- int capacity = PRNG.Instance.Next(1_000);
727
- IList created = ReflectionHelpers.CreateList(typeof(int), capacity);
728
- Assert.AreEqual(0, created.Count);
729
- Assert.IsTrue(created is List<int>);
730
- List<int> typedCreated = (List<int>)created;
731
- Assert.AreEqual(capacity, typedCreated.Capacity);
732
-
733
- int count = PRNG.Instance.Next(50);
734
- List<int> expected = new();
735
- for (int j = 0; j < count; ++j)
736
- {
737
- int element = PRNG.Instance.Next();
738
- created.Add(element);
739
- expected.Add(element);
740
- Assert.AreEqual(j + 1, created.Count);
741
- Assert.That(expected, Is.EqualTo(typedCreated));
742
- }
743
- }
744
- }
745
-
746
- [Test]
747
- public void GetArrayCreator()
748
- {
749
- Func<int, Array> arrayCreator = ReflectionHelpers.GetArrayCreator(typeof(int));
750
- Assert.IsNotNull(arrayCreator);
751
-
752
- for (int i = 0; i < 10; ++i)
753
- {
754
- int size = PRNG.Instance.Next(1, 100);
755
- Array created = arrayCreator(size);
756
- Assert.IsNotNull(created);
757
- Assert.AreEqual(size, created.Length);
758
- Assert.IsTrue(created is int[]);
759
- }
760
- }
761
-
762
- [Test]
763
- public void GetListCreator()
764
- {
765
- Func<IList> listCreator = ReflectionHelpers.GetListCreator(typeof(string));
766
- Assert.IsNotNull(listCreator);
767
-
768
- for (int i = 0; i < 10; ++i)
769
- {
770
- IList created = listCreator();
771
- Assert.IsNotNull(created);
772
- Assert.AreEqual(0, created.Count);
773
- Assert.IsTrue(created is List<string>);
774
- }
775
- }
776
-
777
- [Test]
778
- public void GetListWithCapacityCreator()
779
- {
780
- Func<int, IList> listCreator = ReflectionHelpers.GetListWithCapacityCreator(
781
- typeof(bool)
782
- );
783
- Assert.IsNotNull(listCreator);
784
-
785
- for (int i = 0; i < 10; ++i)
786
- {
787
- int capacity = PRNG.Instance.Next(1, 100);
788
- IList created = listCreator(capacity);
789
- Assert.IsNotNull(created);
790
- Assert.AreEqual(0, created.Count);
791
- Assert.IsTrue(created is List<bool>);
792
- Assert.AreEqual(capacity, ((List<bool>)created).Capacity);
793
- }
794
- }
795
-
796
- [Test]
797
- public void InvokeStaticVoidMethod()
798
- {
799
- TestMethodClass testObj = new();
800
- testObj.Reset();
801
-
802
- MethodInfo method = typeof(TestMethodClass).GetMethod(
803
- nameof(TestMethodClass.StaticVoidMethod)
804
- );
805
- Assert.IsNotNull(method);
806
-
807
- int initialCount = TestMethodClass.StaticMethodCallCount;
808
- object result = ReflectionHelpers.InvokeStaticMethod(method);
809
-
810
- Assert.IsNull(result);
811
- Assert.AreEqual(initialCount + 1, TestMethodClass.StaticMethodCallCount);
812
- }
813
-
814
- [Test]
815
- public void InvokeStaticMethodWithReturnValue()
816
- {
817
- TestMethodClass testObj = new();
818
- testObj.Reset();
819
-
820
- MethodInfo intMethod = typeof(TestMethodClass).GetMethod(
821
- nameof(TestMethodClass.StaticIntMethod)
822
- );
823
- MethodInfo stringMethod = typeof(TestMethodClass).GetMethod(
824
- nameof(TestMethodClass.StaticStringMethod)
825
- );
826
- MethodInfo boolMethod = typeof(TestMethodClass).GetMethod(
827
- nameof(TestMethodClass.StaticBoolMethod)
828
- );
829
-
830
- Assert.AreEqual(42, ReflectionHelpers.InvokeStaticMethod(intMethod));
831
- Assert.AreEqual("test", ReflectionHelpers.InvokeStaticMethod(stringMethod));
832
- Assert.AreEqual(true, ReflectionHelpers.InvokeStaticMethod(boolMethod));
833
- Assert.AreEqual(3, TestMethodClass.StaticMethodCallCount);
834
- }
835
-
836
- [Test]
837
- public void InvokeStaticMethodWithParameters()
838
- {
839
- int directResult = TestMethodClass.StaticMethodWithParam(10);
840
- Assert.AreEqual(20, directResult);
841
-
842
- TestMethodClass testObj = new();
843
- testObj.Reset();
844
-
845
- MethodInfo paramMethod = typeof(TestMethodClass).GetMethod(
846
- nameof(TestMethodClass.StaticMethodWithParam)
847
- );
848
- MethodInfo voidParamMethod = typeof(TestMethodClass).GetMethod(
849
- nameof(TestMethodClass.StaticVoidMethodWithParam)
850
- );
851
- MethodInfo multiParamMethod = typeof(TestMethodClass).GetMethod(
852
- nameof(TestMethodClass.StaticMethodMultipleParams)
853
- );
854
-
855
- object result1 = ReflectionHelpers.InvokeStaticMethod(paramMethod, 10);
856
- Assert.AreEqual(20, result1);
857
- ReflectionHelpers.InvokeStaticMethod(voidParamMethod, 99);
858
- Assert.AreEqual(99, TestMethodClass.StaticMethodCallCount);
859
- object result3 = ReflectionHelpers.InvokeStaticMethod(multiParamMethod, 5, "abc", true);
860
- Assert.AreEqual(9, result3);
861
- }
862
-
863
- [Test]
864
- public void InvokeInstanceMethod()
865
- {
866
- TestMethodClass testObj = new();
867
- testObj.Reset();
868
-
869
- MethodInfo voidMethod = typeof(TestMethodClass).GetMethod(
870
- nameof(TestMethodClass.InstanceVoidMethod)
871
- );
872
- MethodInfo intMethod = typeof(TestMethodClass).GetMethod(
873
- nameof(TestMethodClass.InstanceIntMethod)
874
- );
875
- MethodInfo stringMethod = typeof(TestMethodClass).GetMethod(
876
- nameof(TestMethodClass.InstanceStringMethod)
877
- );
878
- MethodInfo paramMethod = typeof(TestMethodClass).GetMethod(
879
- nameof(TestMethodClass.InstanceMethodWithParam)
880
- );
881
-
882
- Assert.IsNull(ReflectionHelpers.InvokeMethod(voidMethod, testObj));
883
- Assert.AreEqual(1, testObj.InstanceMethodCallCount);
884
-
885
- Assert.AreEqual(100, ReflectionHelpers.InvokeMethod(intMethod, testObj));
886
- Assert.AreEqual("instance", ReflectionHelpers.InvokeMethod(stringMethod, testObj));
887
- Assert.AreEqual(5, ReflectionHelpers.InvokeMethod(paramMethod, testObj, "hello"));
888
- Assert.AreEqual(4, testObj.InstanceMethodCallCount);
889
- }
890
-
891
- [Test]
892
- public void GetMethodInvoker()
893
- {
894
- TestMethodClass testObj = new();
895
- testObj.Reset();
896
-
897
- MethodInfo voidMethod = typeof(TestMethodClass).GetMethod(
898
- nameof(TestMethodClass.InstanceVoidMethod)
899
- );
900
- MethodInfo intMethod = typeof(TestMethodClass).GetMethod(
901
- nameof(TestMethodClass.InstanceIntMethod)
902
- );
903
- MethodInfo paramMethod = typeof(TestMethodClass).GetMethod(
904
- nameof(TestMethodClass.InstanceMethodWithParam)
905
- );
906
-
907
- Func<object, object[], object> voidInvoker = ReflectionHelpers.GetMethodInvoker(
908
- voidMethod
909
- );
910
- Func<object, object[], object> intInvoker = ReflectionHelpers.GetMethodInvoker(
911
- intMethod
912
- );
913
- Func<object, object[], object> paramInvoker = ReflectionHelpers.GetMethodInvoker(
914
- paramMethod
915
- );
916
-
917
- Assert.IsNull(voidInvoker(testObj, Array.Empty<object>()));
918
- Assert.AreEqual(1, testObj.InstanceMethodCallCount);
919
-
920
- Assert.AreEqual(100, intInvoker(testObj, Array.Empty<object>()));
921
- Assert.AreEqual(2, testObj.InstanceMethodCallCount);
922
-
923
- Assert.AreEqual(5, paramInvoker(testObj, new object[] { "hello" }));
924
- Assert.AreEqual(3, testObj.InstanceMethodCallCount);
925
- }
926
-
927
- [Test]
928
- public void GetStaticMethodInvoker()
929
- {
930
- TestMethodClass testObj = new();
931
- testObj.Reset();
932
-
933
- MethodInfo voidMethod = typeof(TestMethodClass).GetMethod(
934
- nameof(TestMethodClass.StaticVoidMethod)
935
- );
936
- MethodInfo intMethod = typeof(TestMethodClass).GetMethod(
937
- nameof(TestMethodClass.StaticIntMethod)
938
- );
939
- MethodInfo paramMethod = typeof(TestMethodClass).GetMethod(
940
- nameof(TestMethodClass.StaticMethodWithParam)
941
- );
942
-
943
- Func<object[], object> voidInvoker = ReflectionHelpers.GetStaticMethodInvoker(
944
- voidMethod
945
- );
946
- Func<object[], object> intInvoker = ReflectionHelpers.GetStaticMethodInvoker(intMethod);
947
- Func<object[], object> paramInvoker = ReflectionHelpers.GetStaticMethodInvoker(
948
- paramMethod
949
- );
950
-
951
- Assert.IsNull(voidInvoker(Array.Empty<object>()));
952
- Assert.AreEqual(1, TestMethodClass.StaticMethodCallCount);
953
-
954
- Assert.AreEqual(42, intInvoker(Array.Empty<object>()));
955
- Assert.AreEqual(2, TestMethodClass.StaticMethodCallCount);
956
-
957
- Assert.AreEqual(20, paramInvoker(new object[] { 10 }));
958
- Assert.AreEqual(3, TestMethodClass.StaticMethodCallCount);
959
- }
960
-
961
- [Test]
962
- public void CreateInstanceParameterless()
963
- {
964
- TestConstructorClass defaultInstance =
965
- ReflectionHelpers.CreateInstance<TestConstructorClass>();
966
- Assert.IsNotNull(defaultInstance);
967
- Assert.AreEqual(0, defaultInstance.Value1);
968
- Assert.AreEqual("default", defaultInstance.Value2);
969
- Assert.AreEqual(false, defaultInstance.Value3);
970
- }
971
-
972
- [Test]
973
- public void CreateInstanceWithParameters()
974
- {
975
- TestConstructorClass singleParam =
976
- ReflectionHelpers.CreateInstance<TestConstructorClass>(42);
977
- Assert.IsNotNull(singleParam);
978
- Assert.AreEqual(42, singleParam.Value1);
979
- Assert.AreEqual("single", singleParam.Value2);
980
- Assert.AreEqual(false, singleParam.Value3);
981
-
982
- TestConstructorClass twoParam = ReflectionHelpers.CreateInstance<TestConstructorClass>(
983
- 10,
984
- "test"
985
- );
986
- Assert.IsNotNull(twoParam);
987
- Assert.AreEqual(10, twoParam.Value1);
988
- Assert.AreEqual("test", twoParam.Value2);
989
- Assert.AreEqual(false, twoParam.Value3);
990
-
991
- TestConstructorClass threeParam =
992
- ReflectionHelpers.CreateInstance<TestConstructorClass>(5, "hello", true);
993
- Assert.IsNotNull(threeParam);
994
- Assert.AreEqual(5, threeParam.Value1);
995
- Assert.AreEqual("hello", threeParam.Value2);
996
- Assert.AreEqual(true, threeParam.Value3);
997
- }
998
-
999
- [Test]
1000
- public void CreateInstanceUsingConstructorInfo()
1001
- {
1002
- ConstructorInfo[] constructors = typeof(TestConstructorClass).GetConstructors();
1003
- ConstructorInfo parameterlessConstructor = constructors.First(c =>
1004
- c.GetParameters().Length == 0
1005
- );
1006
- ConstructorInfo singleParamConstructor = constructors.First(c =>
1007
- c.GetParameters().Length == 1
1008
- );
1009
-
1010
- Func<object[], object> parameterlessDelegate = ReflectionHelpers.GetConstructor(
1011
- parameterlessConstructor
1012
- );
1013
- Func<object[], object> singleParamDelegate = ReflectionHelpers.GetConstructor(
1014
- singleParamConstructor
1015
- );
1016
-
1017
- TestConstructorClass instance1 = (TestConstructorClass)parameterlessDelegate(
1018
- Array.Empty<object>()
1019
- );
1020
- Assert.AreEqual(0, instance1.Value1);
1021
- Assert.AreEqual("default", instance1.Value2);
1022
-
1023
- TestConstructorClass instance2 = (TestConstructorClass)singleParamDelegate(
1024
- new object[] { 99 }
1025
- );
1026
- Assert.AreEqual(99, instance2.Value1);
1027
- Assert.AreEqual("single", instance2.Value2);
1028
- }
1029
-
1030
- [Test]
1031
- public void GetParameterlessConstructor()
1032
- {
1033
- Func<TestConstructorClass> constructor =
1034
- ReflectionHelpers.GetParameterlessConstructor<TestConstructorClass>();
1035
- Assert.IsNotNull(constructor);
1036
-
1037
- for (int i = 0; i < 100; i++)
1038
- {
1039
- TestConstructorClass instance = constructor();
1040
- Assert.IsNotNull(instance);
1041
- Assert.AreEqual(0, instance.Value1);
1042
- Assert.AreEqual("default", instance.Value2);
1043
- Assert.AreEqual(false, instance.Value3);
1044
- }
1045
- }
1046
-
1047
- [Test]
1048
- public void CreateGenericInstance()
1049
- {
1050
- object intGeneric = ReflectionHelpers.CreateGenericInstance<object>(
1051
- typeof(GenericTestClass<>),
1052
- new[] { typeof(int) },
1053
- 42
1054
- );
1055
-
1056
- Assert.IsNotNull(intGeneric);
1057
- Assert.IsInstanceOf<GenericTestClass<int>>(intGeneric);
1058
- Assert.AreEqual(42, ((GenericTestClass<int>)intGeneric).Value);
1059
-
1060
- object stringGeneric = ReflectionHelpers.CreateGenericInstance<object>(
1061
- typeof(GenericTestClass<>),
1062
- new[] { typeof(string) },
1063
- "hello"
1064
- );
1065
-
1066
- Assert.IsNotNull(stringGeneric);
1067
- Assert.IsInstanceOf<GenericTestClass<string>>(stringGeneric);
1068
- Assert.AreEqual("hello", ((GenericTestClass<string>)stringGeneric).Value);
1069
- }
1070
-
1071
- [Test]
1072
- public void GetGenericParameterlessConstructor()
1073
- {
1074
- Func<object> constructor = ReflectionHelpers.GetGenericParameterlessConstructor<object>(
1075
- typeof(GenericTestClass<>),
1076
- typeof(int)
1077
- );
1078
-
1079
- Assert.IsNotNull(constructor);
1080
-
1081
- object instance = constructor();
1082
- Assert.IsNotNull(instance);
1083
- Assert.IsInstanceOf<GenericTestClass<int>>(instance);
1084
- }
1085
-
1086
- [Test]
1087
- public void CreateStructInstance()
1088
- {
1089
- TestConstructorStruct structInstance =
1090
- ReflectionHelpers.CreateInstance<TestConstructorStruct>(123);
1091
- Assert.AreEqual(123, structInstance.Value);
1092
- }
1093
-
1094
- [Test]
1095
- public void GetPropertyGetterStatic()
1096
- {
1097
- PropertyInfo staticProp = typeof(TestPropertyClass).GetProperty(
1098
- nameof(TestPropertyClass.StaticProperty)
1099
- );
1100
- PropertyInfo staticStringProp = typeof(TestPropertyClass).GetProperty(
1101
- nameof(TestPropertyClass.StaticStringProperty)
1102
- );
1103
- PropertyInfo staticReadOnlyProp = typeof(TestPropertyClass).GetProperty(
1104
- nameof(TestPropertyClass.StaticReadOnlyProperty)
1105
- );
1106
-
1107
- Func<object, object> staticGetter = ReflectionHelpers.GetPropertyGetter(staticProp);
1108
- Func<object, object> staticStringGetter = ReflectionHelpers.GetPropertyGetter(
1109
- staticStringProp
1110
- );
1111
- Func<object, object> staticReadOnlyGetter = ReflectionHelpers.GetPropertyGetter(
1112
- staticReadOnlyProp
1113
- );
1114
-
1115
- // Test initial values
1116
- Assert.AreEqual(50, staticGetter(null));
1117
- Assert.AreEqual("static", staticStringGetter(null));
1118
- Assert.AreEqual(999, staticReadOnlyGetter(null));
1119
-
1120
- // Test after changing values
1121
- TestPropertyClass.StaticProperty = 100;
1122
- TestPropertyClass.StaticStringProperty = "changed";
1123
-
1124
- Assert.AreEqual(100, staticGetter(null));
1125
- Assert.AreEqual("changed", staticStringGetter(null));
1126
- Assert.AreEqual(999, staticReadOnlyGetter(null)); // Read-only shouldn't change
1127
- }
1128
-
1129
- [Test]
1130
- public void GetPropertyGetterInstance()
1131
- {
1132
- TestPropertyClass testObj = new();
1133
- PropertyInfo instanceProp = typeof(TestPropertyClass).GetProperty(
1134
- nameof(TestPropertyClass.InstanceProperty)
1135
- );
1136
- PropertyInfo instanceStringProp = typeof(TestPropertyClass).GetProperty(
1137
- nameof(TestPropertyClass.InstanceStringProperty)
1138
- );
1139
- PropertyInfo instanceReadOnlyProp = typeof(TestPropertyClass).GetProperty(
1140
- nameof(TestPropertyClass.InstanceReadOnlyProperty)
1141
- );
1142
-
1143
- Func<object, object> instanceGetter = ReflectionHelpers.GetPropertyGetter(instanceProp);
1144
- Func<object, object> instanceStringGetter = ReflectionHelpers.GetPropertyGetter(
1145
- instanceStringProp
1146
- );
1147
- Func<object, object> instanceReadOnlyGetter = ReflectionHelpers.GetPropertyGetter(
1148
- instanceReadOnlyProp
1149
- );
1150
-
1151
- // Test initial values
1152
- Assert.AreEqual(25, instanceGetter(testObj));
1153
- Assert.AreEqual("instance", instanceStringGetter(testObj));
1154
- Assert.AreEqual(888, instanceReadOnlyGetter(testObj));
1155
-
1156
- // Test after changing values
1157
- testObj.InstanceProperty = 200;
1158
- testObj.InstanceStringProperty = "modified";
1159
-
1160
- Assert.AreEqual(200, instanceGetter(testObj));
1161
- Assert.AreEqual("modified", instanceStringGetter(testObj));
1162
- Assert.AreEqual(888, instanceReadOnlyGetter(testObj)); // Read-only shouldn't change
1163
- }
1164
-
1165
- [Test]
1166
- public void GetStaticPropertyGetter()
1167
- {
1168
- Func<int> staticGetter = ReflectionHelpers.GetStaticPropertyGetter<int>(
1169
- typeof(TestPropertyClass).GetProperty(nameof(TestPropertyClass.StaticProperty))
1170
- );
1171
-
1172
- Func<string> staticStringGetter = ReflectionHelpers.GetStaticPropertyGetter<string>(
1173
- typeof(TestPropertyClass).GetProperty(
1174
- nameof(TestPropertyClass.StaticStringProperty)
1175
- )
1176
- );
1177
-
1178
- Assert.AreEqual(TestPropertyClass.StaticProperty, staticGetter());
1179
- Assert.AreEqual(TestPropertyClass.StaticStringProperty, staticStringGetter());
1180
-
1181
- TestPropertyClass.StaticProperty = 777;
1182
- TestPropertyClass.StaticStringProperty = "new value";
1183
-
1184
- Assert.AreEqual(777, staticGetter());
1185
- Assert.AreEqual("new value", staticStringGetter());
1186
- }
1187
-
1188
- [Test]
1189
- public void GetAllLoadedAssemblies()
1190
- {
1191
- Assembly[] assemblies = ReflectionHelpers.GetAllLoadedAssemblies().ToArray();
1192
- Assert.IsNotNull(assemblies);
1193
- Assert.Greater(assemblies.Length, 0);
1194
- Assert.IsTrue(assemblies.All(a => a != null));
1195
- Assert.IsTrue(assemblies.All(a => !a.IsDynamic));
1196
- }
1197
-
1198
- [Test]
1199
- public void GetAllLoadedTypes()
1200
- {
1201
- Type[] types = ReflectionHelpers.GetAllLoadedTypes().Take(100).ToArray();
1202
- Assert.IsNotNull(types);
1203
- Assert.Greater(types.Length, 0);
1204
- Assert.IsTrue(types.All(t => t != null));
1205
- }
1206
-
1207
- [Test]
1208
- public void GetTypesFromAssembly()
1209
- {
1210
- Assembly testAssembly = typeof(ReflectionHelperTests).Assembly;
1211
- Type[] types = ReflectionHelpers.GetTypesFromAssembly(testAssembly).ToArray();
1212
-
1213
- Assert.IsNotNull(types);
1214
- Assert.Greater(types.Length, 0);
1215
- Assert.IsTrue(types.Contains(typeof(ReflectionHelperTests)));
1216
- Assert.IsTrue(types.Contains(typeof(TestAttributeClass)));
1217
- Assert.IsTrue(types.Contains(typeof(TestMethodClass)));
1218
- }
1219
-
1220
- [Test]
1221
- public void GetTypesFromAssemblyName()
1222
- {
1223
- Type[] types = ReflectionHelpers
1224
- .GetTypesFromAssemblyName("System.Core")
1225
- .Take(10)
1226
- .ToArray();
1227
- Assert.IsNotNull(types);
1228
- // May be empty on some platforms, but should not throw
1229
- }
1230
-
1231
- [Test]
1232
- public void GetTypesWithAttribute()
1233
- {
1234
- Type[] typesWithDescAttr = ReflectionHelpers
1235
- .GetTypesWithAttribute<DescriptionAttribute>()
1236
- .ToArray();
1237
- Assert.IsNotNull(typesWithDescAttr);
1238
- Assert.IsTrue(typesWithDescAttr.Contains(typeof(TestAttributeClass)));
1239
-
1240
- Type[] typesByType = ReflectionHelpers
1241
- .GetTypesWithAttribute(typeof(DescriptionAttribute))
1242
- .ToArray();
1243
- Assert.IsNotNull(typesByType);
1244
- Assert.IsTrue(typesByType.Contains(typeof(TestAttributeClass)));
1245
- }
1246
-
1247
- [Test]
1248
- public void HasAttributeSafe()
1249
- {
1250
- Type testType = typeof(TestAttributeClass);
1251
- FieldInfo staticField = testType.GetField(
1252
- nameof(TestAttributeClass.StaticFieldWithAttribute)
1253
- );
1254
- MethodInfo instanceMethod = testType.GetMethod(
1255
- nameof(TestAttributeClass.InstanceMethodWithAttribute)
1256
- );
1257
-
1258
- Assert.IsTrue(ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(testType));
1259
- Assert.IsTrue(ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(staticField));
1260
- Assert.IsTrue(
1261
- ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(instanceMethod)
1262
- );
1263
-
1264
- Assert.IsTrue(
1265
- ReflectionHelpers.HasAttributeSafe(testType, typeof(ReflectionTestAttribute))
1266
- );
1267
- Assert.IsTrue(
1268
- ReflectionHelpers.HasAttributeSafe(staticField, typeof(ReflectionTestAttribute))
1269
- );
1270
- Assert.IsTrue(
1271
- ReflectionHelpers.HasAttributeSafe(instanceMethod, typeof(ReflectionTestAttribute))
1272
- );
1273
-
1274
- // Test with types that don't have attributes
1275
- Assert.IsFalse(
1276
- ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(typeof(TestMethodClass))
1277
- );
1278
- Assert.IsFalse(
1279
- ReflectionHelpers.HasAttributeSafe(
1280
- typeof(TestMethodClass),
1281
- typeof(ReflectionTestAttribute)
1282
- )
1283
- );
1284
-
1285
- // Test with null (should return false, not throw)
1286
- Assert.IsFalse(ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(null));
1287
- Assert.IsFalse(
1288
- ReflectionHelpers.HasAttributeSafe(null, typeof(ReflectionTestAttribute))
1289
- );
1290
- }
1291
-
1292
- [Test]
1293
- public void GetAttributeSafe()
1294
- {
1295
- Type testType = typeof(TestAttributeClass);
1296
- FieldInfo instanceField = testType.GetField(
1297
- nameof(TestAttributeClass.InstanceFieldWithAttribute)
1298
- );
1299
-
1300
- ReflectionTestAttribute classAttr =
1301
- ReflectionHelpers.GetAttributeSafe<ReflectionTestAttribute>(testType);
1302
- Assert.IsNotNull(classAttr);
1303
- Assert.AreEqual("ClassLevel", classAttr.Name);
1304
- Assert.AreEqual(10, classAttr.Value);
1305
-
1306
- ReflectionTestAttribute fieldAttr =
1307
- ReflectionHelpers.GetAttributeSafe<ReflectionTestAttribute>(instanceField);
1308
- Assert.IsNotNull(fieldAttr);
1309
- Assert.AreEqual("InstanceField", fieldAttr.Name);
1310
- Assert.AreEqual(5, fieldAttr.Value);
1311
-
1312
- // Test non-generic version
1313
- Attribute classAttrObj = ReflectionHelpers.GetAttributeSafe(
1314
- testType,
1315
- typeof(ReflectionTestAttribute)
1316
- );
1317
- Assert.IsNotNull(classAttrObj);
1318
- Assert.IsInstanceOf<ReflectionTestAttribute>(classAttrObj);
1319
-
1320
- // Test with null
1321
- Assert.IsNull(ReflectionHelpers.GetAttributeSafe<ReflectionTestAttribute>(null));
1322
- Assert.IsNull(
1323
- ReflectionHelpers.GetAttributeSafe(null, typeof(ReflectionTestAttribute))
1324
- );
1325
- }
1326
-
1327
- [Test]
1328
- public void GetAllAttributesSafe()
1329
- {
1330
- Type testType = typeof(TestAttributeClass);
1331
- PropertyInfo instanceProperty = testType.GetProperty(
1332
- nameof(TestAttributeClass.InstancePropertyWithAttribute)
1333
- );
1334
-
1335
- ReflectionTestAttribute[] typeAttrs = ReflectionHelpers
1336
- .GetAllAttributesSafe<ReflectionTestAttribute>(testType)
1337
- .ToArray();
1338
- Assert.IsNotNull(typeAttrs);
1339
- Assert.AreEqual(1, typeAttrs.Length);
1340
- Assert.AreEqual("ClassLevel", typeAttrs[0].Name);
1341
-
1342
- ReflectionTestAttribute[] propAttrs = ReflectionHelpers
1343
- .GetAllAttributesSafe<ReflectionTestAttribute>(instanceProperty)
1344
- .ToArray();
1345
- Assert.IsNotNull(propAttrs);
1346
- Assert.AreEqual(1, propAttrs.Length);
1347
- Assert.AreEqual("InstanceProperty", propAttrs[0].Name);
1348
-
1349
- // Test non-generic version
1350
- Attribute[] allTypeAttrs = ReflectionHelpers.GetAllAttributesSafe(testType).ToArray();
1351
- Assert.IsNotNull(allTypeAttrs);
1352
- Assert.Greater(allTypeAttrs.Length, 0);
1353
-
1354
- Attribute[] allPropAttrs = ReflectionHelpers
1355
- .GetAllAttributesSafe(instanceProperty, typeof(ReflectionTestAttribute))
1356
- .ToArray();
1357
- Assert.IsNotNull(allPropAttrs);
1358
- Assert.AreEqual(1, allPropAttrs.Length);
1359
-
1360
- // Test with null
1361
- Assert.AreEqual(
1362
- 0,
1363
- ReflectionHelpers.GetAllAttributesSafe<ReflectionTestAttribute>(null).Length
1364
- );
1365
- Assert.AreEqual(0, ReflectionHelpers.GetAllAttributesSafe(null).Length);
1366
- }
1367
-
1368
- [Test]
1369
- public void GetAllAttributeValuesSafe()
1370
- {
1371
- Type testType = typeof(TestAttributeClass);
1372
- Dictionary<string, object> attrValues = ReflectionHelpers.GetAllAttributeValuesSafe(
1373
- testType
1374
- );
1375
-
1376
- Assert.IsNotNull(attrValues);
1377
- Assert.IsTrue(attrValues.ContainsKey("ReflectionTest"));
1378
- Assert.IsInstanceOf<ReflectionTestAttribute>(attrValues["ReflectionTest"]);
1379
-
1380
- // Test with null
1381
- Dictionary<string, object> nullResult = ReflectionHelpers.GetAllAttributeValuesSafe(
1382
- null
1383
- );
1384
- Assert.IsNotNull(nullResult);
1385
- Assert.AreEqual(0, nullResult.Count);
1386
- }
1387
-
1388
- [Test]
1389
- public void GetMembersWithAttributeSafe()
1390
- {
1391
- Type testType = typeof(TestAttributeClass);
1392
-
1393
- MethodInfo[] methods = ReflectionHelpers
1394
- .GetMethodsWithAttributeSafe<ReflectionTestAttribute>(testType)
1395
- .ToArray();
1396
- Assert.IsNotNull(methods);
1397
- Assert.Greater(methods.Length, 0);
1398
- Assert.IsTrue(
1399
- methods.Any(m => m.Name == nameof(TestAttributeClass.StaticMethodWithAttribute))
1400
- );
1401
- Assert.IsTrue(
1402
- methods.Any(m => m.Name == nameof(TestAttributeClass.InstanceMethodWithAttribute))
1403
- );
1404
-
1405
- PropertyInfo[] properties = ReflectionHelpers
1406
- .GetPropertiesWithAttributeSafe<ReflectionTestAttribute>(testType)
1407
- .ToArray();
1408
- Assert.IsNotNull(properties);
1409
- Assert.Greater(properties.Length, 0);
1410
- Assert.IsTrue(
1411
- properties.Any(p =>
1412
- p.Name == nameof(TestAttributeClass.StaticPropertyWithAttribute)
1413
- )
1414
- );
1415
-
1416
- FieldInfo[] fields = ReflectionHelpers
1417
- .GetFieldsWithAttributeSafe<ReflectionTestAttribute>(testType)
1418
- .ToArray();
1419
- Assert.IsNotNull(fields);
1420
- Assert.Greater(fields.Length, 0);
1421
- Assert.IsTrue(
1422
- fields.Any(f => f.Name == nameof(TestAttributeClass.StaticFieldWithAttribute))
1423
- );
1424
-
1425
- // Test with null
1426
- Assert.AreEqual(
1427
- 0,
1428
- ReflectionHelpers.GetMethodsWithAttributeSafe<ReflectionTestAttribute>(null).Length
1429
- );
1430
- Assert.AreEqual(
1431
- 0,
1432
- ReflectionHelpers
1433
- .GetPropertiesWithAttributeSafe<ReflectionTestAttribute>(null)
1434
- .Length
1435
- );
1436
- Assert.AreEqual(
1437
- 0,
1438
- ReflectionHelpers.GetFieldsWithAttributeSafe<ReflectionTestAttribute>(null).Length
1439
- );
1440
- }
1441
-
1442
- [Test]
1443
- public void LoadStaticPropertiesForType()
1444
- {
1445
- Dictionary<string, PropertyInfo> staticProperties =
1446
- ReflectionHelpers.LoadStaticPropertiesForType<TestPropertyClass>();
1447
- Assert.IsNotNull(staticProperties);
1448
-
1449
- // Note: This method looks for static properties that return the same type as the class
1450
- // Our TestPropertyClass doesn't have static properties that return TestPropertyClass,
1451
- // so the result should be empty, but the method should not throw
1452
- Assert.IsNotNull(staticProperties);
1453
- }
1454
-
1455
- [Test]
1456
- public void LoadStaticFieldsForType()
1457
- {
1458
- Dictionary<string, FieldInfo> staticFields =
1459
- ReflectionHelpers.LoadStaticFieldsForType<TestPropertyClass>();
1460
- Assert.IsNotNull(staticFields);
1461
-
1462
- // Note: This method looks for static fields that are of the same type as the class
1463
- // Our TestPropertyClass doesn't have such fields, so the result should be empty,
1464
- // but the method should not throw
1465
- Assert.IsNotNull(staticFields);
1466
- }
1467
-
1468
- [Test]
1469
- public void IsAttributeDefined()
1470
- {
1471
- Type testType = typeof(TestAttributeClass);
1472
- FieldInfo testField = testType.GetField(
1473
- nameof(TestAttributeClass.InstanceFieldWithAttribute)
1474
- );
1475
-
1476
- // Test the extension method version
1477
- Assert.IsTrue(testType.IsAttributeDefined(out ReflectionTestAttribute typeAttr));
1478
- Assert.IsNotNull(typeAttr);
1479
- Assert.AreEqual("ClassLevel", typeAttr.Name);
1480
- Assert.AreEqual(10, typeAttr.Value);
1481
-
1482
- Assert.IsTrue(testField.IsAttributeDefined(out ReflectionTestAttribute fieldAttr));
1483
- Assert.IsNotNull(fieldAttr);
1484
- Assert.AreEqual("InstanceField", fieldAttr.Name);
1485
- Assert.AreEqual(5, fieldAttr.Value);
1486
-
1487
- // Test with type that doesn't have the attribute
1488
- Type methodType = typeof(TestMethodClass);
1489
- Assert.IsFalse(methodType.IsAttributeDefined(out ReflectionTestAttribute noAttr));
1490
- Assert.IsNull(noAttr);
1491
- }
1492
- }
1493
- }
1
+ namespace WallstopStudios.UnityHelpers.Tests.Helper
2
+ {
3
+ using System;
4
+ using System.Collections;
5
+ using System.Collections.Generic;
6
+ using System.Linq;
7
+ using System.Reflection;
8
+ using NUnit.Framework;
9
+ using UnityEngine;
10
+ using WallstopStudios.UnityHelpers.Core.Helper;
11
+ using WallstopStudios.UnityHelpers.Core.Random;
12
+ using CategoryAttribute = System.ComponentModel.CategoryAttribute;
13
+ using DescriptionAttribute = System.ComponentModel.DescriptionAttribute;
14
+
15
+ [AttributeUsage(AttributeTargets.All)]
16
+ public class ReflectionTestAttribute : Attribute
17
+ {
18
+ public string Name { get; set; }
19
+ public int Value { get; set; }
20
+
21
+ public ReflectionTestAttribute() { }
22
+
23
+ public ReflectionTestAttribute(string name, int value)
24
+ {
25
+ Name = name;
26
+ Value = value;
27
+ }
28
+ }
29
+
30
+ public struct TestStruct
31
+ {
32
+ public static int StaticIntValue;
33
+ public int intValue;
34
+ }
35
+
36
+ public sealed class TestClass
37
+ {
38
+ public static int StaticIntValue;
39
+ public int intValue;
40
+ }
41
+
42
+ public class TestMethodClass
43
+ {
44
+ public static int StaticMethodCallCount = 0;
45
+ public int instanceMethodCallCount = 0;
46
+
47
+ // Void methods
48
+ public static void StaticVoidMethod()
49
+ {
50
+ StaticMethodCallCount++;
51
+ }
52
+
53
+ public void InstanceVoidMethod()
54
+ {
55
+ instanceMethodCallCount++;
56
+ }
57
+
58
+ // Return value methods
59
+ public static int StaticIntMethod()
60
+ {
61
+ StaticMethodCallCount++;
62
+ return 42;
63
+ }
64
+
65
+ public static string StaticStringMethod()
66
+ {
67
+ StaticMethodCallCount++;
68
+ return "test";
69
+ }
70
+
71
+ public static bool StaticBoolMethod()
72
+ {
73
+ StaticMethodCallCount++;
74
+ return true;
75
+ }
76
+
77
+ public int InstanceIntMethod()
78
+ {
79
+ instanceMethodCallCount++;
80
+ return 100;
81
+ }
82
+
83
+ public string InstanceStringMethod()
84
+ {
85
+ instanceMethodCallCount++;
86
+ return "instance";
87
+ }
88
+
89
+ // Methods with parameters
90
+ public static int StaticMethodWithParam(int param)
91
+ {
92
+ StaticMethodCallCount++;
93
+ return param * 2;
94
+ }
95
+
96
+ public int InstanceMethodWithParam(string param)
97
+ {
98
+ instanceMethodCallCount++;
99
+ return param?.Length ?? 0;
100
+ }
101
+
102
+ public static void StaticVoidMethodWithParam(int param)
103
+ {
104
+ StaticMethodCallCount = param;
105
+ }
106
+
107
+ // Multiple parameter methods
108
+ public static int StaticMethodMultipleParams(int a, string b, bool c)
109
+ {
110
+ StaticMethodCallCount++;
111
+ return a + (b?.Length ?? 0) + (c ? 1 : 0);
112
+ }
113
+
114
+ public static int StaticMethodFourParams(int a, int b, int c, int d)
115
+ {
116
+ StaticMethodCallCount++;
117
+ return a + b + c + d;
118
+ }
119
+
120
+ public static void StaticActionThree(int a, int b, int c)
121
+ {
122
+ StaticMethodCallCount = a + b + c;
123
+ }
124
+
125
+ public int InstanceSum(int a, int b)
126
+ {
127
+ instanceMethodCallCount++;
128
+ return a + b;
129
+ }
130
+
131
+ public void InstanceSetThree(int a, int b, int c)
132
+ {
133
+ instanceMethodCallCount = a + b + c;
134
+ }
135
+
136
+ public int InstanceSumFour(int a, int b, int c, int d)
137
+ {
138
+ instanceMethodCallCount++;
139
+ return a + b + c + d;
140
+ }
141
+
142
+ public void Reset()
143
+ {
144
+ StaticMethodCallCount = 0;
145
+ instanceMethodCallCount = 0;
146
+ }
147
+ }
148
+
149
+ public sealed class TestConstructorClass
150
+ {
151
+ public int Value1 { get; }
152
+ public string Value2 { get; }
153
+ public bool Value3 { get; }
154
+
155
+ public TestConstructorClass()
156
+ {
157
+ Value1 = 0;
158
+ Value2 = "default";
159
+ Value3 = false;
160
+ }
161
+
162
+ public TestConstructorClass(int value1)
163
+ {
164
+ Value1 = value1;
165
+ Value2 = "single";
166
+ Value3 = false;
167
+ }
168
+
169
+ public TestConstructorClass(int value1, string value2)
170
+ {
171
+ Value1 = value1;
172
+ Value2 = value2;
173
+ Value3 = false;
174
+ }
175
+
176
+ public TestConstructorClass(int value1, string value2, bool value3)
177
+ {
178
+ Value1 = value1;
179
+ Value2 = value2;
180
+ Value3 = value3;
181
+ }
182
+ }
183
+
184
+ public readonly struct TestConstructorStruct
185
+ {
186
+ public int Value { get; }
187
+
188
+ public TestConstructorStruct(int value)
189
+ {
190
+ Value = value;
191
+ }
192
+ }
193
+
194
+ public sealed class TestPropertyClass
195
+ {
196
+ private static int _StaticValue = 50;
197
+ private int _instanceValue = 25;
198
+
199
+ public static int StaticProperty
200
+ {
201
+ get => _StaticValue;
202
+ set => _StaticValue = value;
203
+ }
204
+
205
+ public int InstanceProperty
206
+ {
207
+ get => _instanceValue;
208
+ set => _instanceValue = value;
209
+ }
210
+
211
+ public static string StaticStringProperty { get; set; } = "static";
212
+
213
+ public string InstanceStringProperty { get; set; } = "instance";
214
+
215
+ // Read-only properties
216
+ public static int StaticReadOnlyProperty => 999;
217
+ public int InstanceReadOnlyProperty => 888;
218
+ }
219
+
220
+ public sealed class SelfReferentialType
221
+ {
222
+ public static SelfReferentialType InstanceField = new();
223
+ public static SelfReferentialType InstanceProperty { get; } = new();
224
+ }
225
+
226
+ public struct ValueStruct
227
+ {
228
+ public int x;
229
+ public int y;
230
+
231
+ public int Sum(int a, int b) => a + b + x + y;
232
+ }
233
+
234
+ public sealed class IndexerClass
235
+ {
236
+ private readonly int[] data = new int[10];
237
+ public int this[int i]
238
+ {
239
+ get => data[i];
240
+ set => data[i] = value;
241
+ }
242
+ }
243
+
244
+ public static class RefOutMethods
245
+ {
246
+ public static void RefInc(ref int x)
247
+ {
248
+ x++;
249
+ }
250
+
251
+ public static void OutSet(out int x)
252
+ {
253
+ x = 7;
254
+ }
255
+ }
256
+
257
+ [Description("Test class for attribute testing")]
258
+ [ReflectionTestAttribute("ClassLevel", 10)]
259
+ public sealed class TestAttributeClass
260
+ {
261
+ [Description("Static field with description")]
262
+ [ReflectionTestAttribute("StaticField", 15)]
263
+ public static int StaticFieldWithAttribute = 1;
264
+
265
+ [Category("TestCategory")]
266
+ [ReflectionTestAttribute("InstanceField", 5)]
267
+ public int instanceFieldWithAttribute = 2;
268
+
269
+ [Description("Static property for testing")]
270
+ [ReflectionTestAttribute("StaticProperty", 20)]
271
+ public static string StaticPropertyWithAttribute { get; set; } = "static";
272
+
273
+ [Category("TestCategory")]
274
+ [Description("Instance property")]
275
+ [ReflectionTestAttribute("InstanceProperty", 8)]
276
+ public string InstancePropertyWithAttribute { get; set; } = "instance";
277
+
278
+ [Description("Static method for testing")]
279
+ [ReflectionTestAttribute("StaticMethod", 12)]
280
+ public static void StaticMethodWithAttribute() { }
281
+
282
+ [Category("TestCategory")]
283
+ [ReflectionTestAttribute("InstanceMethod", 7)]
284
+ public void InstanceMethodWithAttribute() { }
285
+
286
+ public void MethodWithAttributedParameter(
287
+ [Description("Parameter with description")] int param
288
+ ) { }
289
+ }
290
+
291
+ public sealed class GenericTestClass<T>
292
+ {
293
+ public T Value { get; set; }
294
+
295
+ public GenericTestClass() { }
296
+
297
+ public GenericTestClass(T value)
298
+ {
299
+ Value = value;
300
+ }
301
+ }
302
+
303
+ public sealed class ReflectionHelperTests
304
+ {
305
+ private const int NumTries = 1_000;
306
+
307
+ private sealed class NoParameterlessCtor
308
+ {
309
+ public int V { get; }
310
+
311
+ public NoParameterlessCtor(int v)
312
+ {
313
+ V = v;
314
+ }
315
+ }
316
+
317
+ public sealed class EnabledProbe : MonoBehaviour { }
318
+
319
+ [Test]
320
+ public void GetFieldGetterClassMemberField()
321
+ {
322
+ TestClass testClass = new();
323
+ Func<object, object> classGetter = ReflectionHelpers.GetFieldGetter(
324
+ typeof(TestClass).GetField(nameof(TestClass.intValue))
325
+ );
326
+ Assert.AreEqual(testClass.intValue, classGetter(testClass));
327
+ for (int i = 0; i < NumTries; ++i)
328
+ {
329
+ testClass.intValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
330
+ Assert.AreEqual(testClass.intValue, classGetter(testClass));
331
+ }
332
+ }
333
+
334
+ [Test]
335
+ public void GetFieldGetterClassStaticField()
336
+ {
337
+ TestClass testClass = new();
338
+ Func<object, object> classGetter = ReflectionHelpers.GetFieldGetter(
339
+ typeof(TestClass).GetField(
340
+ nameof(TestClass.StaticIntValue),
341
+ BindingFlags.Static | BindingFlags.Public
342
+ )
343
+ );
344
+ Assert.AreEqual(TestClass.StaticIntValue, classGetter(testClass));
345
+ for (int i = 0; i < NumTries; ++i)
346
+ {
347
+ TestClass.StaticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
348
+ Assert.AreEqual(TestClass.StaticIntValue, classGetter(testClass));
349
+ }
350
+ }
351
+
352
+ [Test]
353
+ public void GetStaticFieldGetterThrowsOnNonStaticField()
354
+ {
355
+ Assert.Throws<ArgumentException>(() =>
356
+ ReflectionHelpers.GetStaticFieldGetter(
357
+ typeof(TestClass).GetField(nameof(TestClass.intValue))
358
+ )
359
+ );
360
+ }
361
+
362
+ [Test]
363
+ public void GetStaticFieldGetterClassStaticField()
364
+ {
365
+ Func<object> classGetter = ReflectionHelpers.GetStaticFieldGetter(
366
+ typeof(TestClass).GetField(
367
+ nameof(TestClass.StaticIntValue),
368
+ BindingFlags.Static | BindingFlags.Public
369
+ )
370
+ );
371
+ Assert.AreEqual(TestClass.StaticIntValue, classGetter());
372
+ for (int i = 0; i < NumTries; ++i)
373
+ {
374
+ TestClass.StaticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
375
+ Assert.AreEqual(TestClass.StaticIntValue, classGetter());
376
+ }
377
+ }
378
+
379
+ [Test]
380
+ public void GetFieldGetterStructMemberField()
381
+ {
382
+ TestStruct testStruct = new();
383
+ Func<object, object> structGetter = ReflectionHelpers.GetFieldGetter(
384
+ typeof(TestStruct).GetField(nameof(TestStruct.intValue))
385
+ );
386
+ Assert.AreEqual(testStruct.intValue, structGetter(testStruct));
387
+ for (int i = 0; i < NumTries; ++i)
388
+ {
389
+ testStruct.intValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
390
+ Assert.AreEqual(testStruct.intValue, structGetter(testStruct));
391
+ }
392
+ }
393
+
394
+ [Test]
395
+ public void GetFieldGetterStructStaticField()
396
+ {
397
+ TestStruct testStruct = new();
398
+ Func<object, object> structGetter = ReflectionHelpers.GetFieldGetter(
399
+ typeof(TestStruct).GetField(
400
+ nameof(TestStruct.StaticIntValue),
401
+ BindingFlags.Static | BindingFlags.Public
402
+ )
403
+ );
404
+ Assert.AreEqual(TestStruct.StaticIntValue, structGetter(testStruct));
405
+ for (int i = 0; i < NumTries; ++i)
406
+ {
407
+ TestStruct.StaticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
408
+ Assert.AreEqual(TestStruct.StaticIntValue, structGetter(testStruct));
409
+ }
410
+ }
411
+
412
+ [Test]
413
+ public void GetStaticFieldGetterStructStaticField()
414
+ {
415
+ Func<object> structGetter = ReflectionHelpers.GetStaticFieldGetter(
416
+ typeof(TestStruct).GetField(
417
+ nameof(TestStruct.StaticIntValue),
418
+ BindingFlags.Static | BindingFlags.Public
419
+ )
420
+ );
421
+ Assert.AreEqual(TestStruct.StaticIntValue, structGetter());
422
+ for (int i = 0; i < NumTries; ++i)
423
+ {
424
+ TestStruct.StaticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
425
+ Assert.AreEqual(TestStruct.StaticIntValue, structGetter());
426
+ }
427
+ }
428
+
429
+ [Test]
430
+ public void GetFieldSetterClassMemberField()
431
+ {
432
+ TestClass testClass = new();
433
+ Action<object, object> structSetter = ReflectionHelpers.GetFieldSetter(
434
+ typeof(TestClass).GetField(nameof(TestClass.intValue))
435
+ );
436
+ for (int i = 0; i < NumTries; ++i)
437
+ {
438
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
439
+ structSetter(testClass, expected);
440
+ Assert.AreEqual(expected, testClass.intValue);
441
+ }
442
+ }
443
+
444
+ [Test]
445
+ public void GetFieldSetterClassStaticField()
446
+ {
447
+ TestClass testClass = new();
448
+ Action<object, object> structSetter = ReflectionHelpers.GetFieldSetter(
449
+ typeof(TestClass).GetField(
450
+ nameof(TestClass.StaticIntValue),
451
+ BindingFlags.Static | BindingFlags.Public
452
+ )
453
+ );
454
+ for (int i = 0; i < NumTries; ++i)
455
+ {
456
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
457
+ structSetter(testClass, expected);
458
+ Assert.AreEqual(expected, TestClass.StaticIntValue);
459
+ }
460
+ }
461
+
462
+ [Test]
463
+ public void GetStaticFieldSetterThrowsOnNonStaticField()
464
+ {
465
+ Assert.Throws<ArgumentException>(() =>
466
+ ReflectionHelpers.GetStaticFieldSetter(
467
+ typeof(TestClass).GetField(nameof(TestClass.intValue))
468
+ )
469
+ );
470
+ }
471
+
472
+ [Test]
473
+ public void GetStaticFieldSetterClassStaticField()
474
+ {
475
+ Action<object> structSetter = ReflectionHelpers.GetStaticFieldSetter(
476
+ typeof(TestClass).GetField(
477
+ nameof(TestClass.StaticIntValue),
478
+ BindingFlags.Static | BindingFlags.Public
479
+ )
480
+ );
481
+ for (int i = 0; i < NumTries; ++i)
482
+ {
483
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
484
+ structSetter(expected);
485
+ Assert.AreEqual(expected, TestClass.StaticIntValue);
486
+ }
487
+ }
488
+
489
+ [Test]
490
+ public void GetFieldSetterStructMemberField()
491
+ {
492
+ // Need boxing
493
+ object testStruct = new TestStruct();
494
+ Action<object, object> structSetter = ReflectionHelpers.GetFieldSetter(
495
+ typeof(TestStruct).GetField(nameof(TestStruct.intValue))
496
+ );
497
+ for (int i = 0; i < NumTries; ++i)
498
+ {
499
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
500
+ structSetter(testStruct, expected);
501
+ Assert.AreEqual(expected, ((TestStruct)testStruct).intValue);
502
+ }
503
+ }
504
+
505
+ [Test]
506
+ public void GetFieldSetterStructStaticField()
507
+ {
508
+ // Need boxing
509
+ object testStruct = new TestStruct();
510
+ Action<object, object> structSetter = ReflectionHelpers.GetFieldSetter(
511
+ typeof(TestStruct).GetField(
512
+ nameof(TestStruct.StaticIntValue),
513
+ BindingFlags.Static | BindingFlags.Public
514
+ )
515
+ );
516
+ for (int i = 0; i < NumTries; ++i)
517
+ {
518
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
519
+ structSetter(testStruct, expected);
520
+ Assert.AreEqual(expected, TestStruct.StaticIntValue);
521
+ }
522
+ }
523
+
524
+ [Test]
525
+ public void GetStaticFieldSetterStructStaticField()
526
+ {
527
+ Action<object> structSetter = ReflectionHelpers.GetStaticFieldSetter(
528
+ typeof(TestStruct).GetField(
529
+ nameof(TestStruct.StaticIntValue),
530
+ BindingFlags.Static | BindingFlags.Public
531
+ )
532
+ );
533
+ for (int i = 0; i < NumTries; ++i)
534
+ {
535
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
536
+ structSetter(expected);
537
+ Assert.AreEqual(expected, TestStruct.StaticIntValue);
538
+ }
539
+ }
540
+
541
+ [Test]
542
+ public void GetFieldSetterClassGenericMemberField()
543
+ {
544
+ TestClass testClass = new();
545
+ FieldSetter<TestClass, int> classSetter = ReflectionHelpers.GetFieldSetter<
546
+ TestClass,
547
+ int
548
+ >(typeof(TestClass).GetField(nameof(TestClass.intValue)));
549
+ for (int i = 0; i < NumTries; ++i)
550
+ {
551
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
552
+ classSetter(ref testClass, expected);
553
+ Assert.AreEqual(expected, testClass.intValue);
554
+ }
555
+ }
556
+
557
+ [Test]
558
+ public void GetFieldSetterClassGenericStaticField()
559
+ {
560
+ TestClass testClass = new();
561
+ FieldSetter<TestClass, int> classSetter = ReflectionHelpers.GetFieldSetter<
562
+ TestClass,
563
+ int
564
+ >(
565
+ typeof(TestClass).GetField(
566
+ nameof(TestClass.StaticIntValue),
567
+ BindingFlags.Static | BindingFlags.Public
568
+ )
569
+ );
570
+ for (int i = 0; i < NumTries; ++i)
571
+ {
572
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
573
+ classSetter(ref testClass, expected);
574
+ Assert.AreEqual(expected, TestClass.StaticIntValue);
575
+ }
576
+ }
577
+
578
+ [Test]
579
+ public void GetStaticFieldSetterGenericThrowsOnNonStaticField()
580
+ {
581
+ Assert.Throws<ArgumentException>(() =>
582
+ ReflectionHelpers.GetStaticFieldSetter<int>(
583
+ typeof(TestClass).GetField(nameof(TestClass.intValue))
584
+ )
585
+ );
586
+ }
587
+
588
+ [Test]
589
+ public void GetStaticFieldSetterClassGenericStaticField()
590
+ {
591
+ Action<int> classSetter = ReflectionHelpers.GetStaticFieldSetter<int>(
592
+ typeof(TestClass).GetField(
593
+ nameof(TestClass.StaticIntValue),
594
+ BindingFlags.Static | BindingFlags.Public
595
+ )
596
+ );
597
+ for (int i = 0; i < NumTries; ++i)
598
+ {
599
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
600
+ classSetter(expected);
601
+ Assert.AreEqual(expected, TestClass.StaticIntValue);
602
+ }
603
+ }
604
+
605
+ [Test]
606
+ public void GetFieldSetterStructGenericMemberField()
607
+ {
608
+ TestStruct testStruct = new();
609
+ FieldSetter<TestStruct, int> structSetter = ReflectionHelpers.GetFieldSetter<
610
+ TestStruct,
611
+ int
612
+ >(typeof(TestStruct).GetField(nameof(TestStruct.intValue)));
613
+ for (int i = 0; i < NumTries; ++i)
614
+ {
615
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
616
+ structSetter(ref testStruct, expected);
617
+ Assert.AreEqual(expected, testStruct.intValue);
618
+ }
619
+ }
620
+
621
+ [Test]
622
+ public void GetFieldSetterStructGenericStaticField()
623
+ {
624
+ TestStruct testStruct = new();
625
+ FieldSetter<TestStruct, int> structSetter = ReflectionHelpers.GetFieldSetter<
626
+ TestStruct,
627
+ int
628
+ >(
629
+ typeof(TestStruct).GetField(
630
+ nameof(TestStruct.StaticIntValue),
631
+ BindingFlags.Static | BindingFlags.Public
632
+ )
633
+ );
634
+ for (int i = 0; i < NumTries; ++i)
635
+ {
636
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
637
+ structSetter(ref testStruct, expected);
638
+ Assert.AreEqual(expected, TestStruct.StaticIntValue);
639
+ }
640
+ }
641
+
642
+ [Test]
643
+ public void GetStaticFieldSetterStructGenericStaticField()
644
+ {
645
+ Action<int> structSetter = ReflectionHelpers.GetStaticFieldSetter<int>(
646
+ typeof(TestStruct).GetField(
647
+ nameof(TestStruct.StaticIntValue),
648
+ BindingFlags.Static | BindingFlags.Public
649
+ )
650
+ );
651
+ for (int i = 0; i < NumTries; ++i)
652
+ {
653
+ int expected = PRNG.Instance.Next(int.MinValue, int.MaxValue);
654
+ structSetter(expected);
655
+ Assert.AreEqual(expected, TestStruct.StaticIntValue);
656
+ }
657
+ }
658
+
659
+ [Test]
660
+ public void GetFieldGetterClassGenericMemberField()
661
+ {
662
+ TestClass testClass = new();
663
+ Func<TestClass, int> classGetter = ReflectionHelpers.GetFieldGetter<TestClass, int>(
664
+ typeof(TestClass).GetField(nameof(TestClass.intValue))
665
+ );
666
+ for (int i = 0; i < NumTries; ++i)
667
+ {
668
+ testClass.intValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
669
+ Assert.AreEqual(testClass.intValue, classGetter(testClass));
670
+ }
671
+ }
672
+
673
+ [Test]
674
+ public void GetFieldGetterClassGenericStaticField()
675
+ {
676
+ TestClass testClass = new();
677
+ Func<TestClass, int> classGetter = ReflectionHelpers.GetFieldGetter<TestClass, int>(
678
+ typeof(TestClass).GetField(
679
+ nameof(TestClass.StaticIntValue),
680
+ BindingFlags.Static | BindingFlags.Public
681
+ )
682
+ );
683
+ for (int i = 0; i < NumTries; ++i)
684
+ {
685
+ TestClass.StaticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
686
+ Assert.AreEqual(TestClass.StaticIntValue, classGetter(testClass));
687
+ }
688
+ }
689
+
690
+ [Test]
691
+ public void GetStaticFieldGetterGenericThrowsOnNonStaticField()
692
+ {
693
+ Assert.Throws<ArgumentException>(() =>
694
+ ReflectionHelpers.GetStaticFieldGetter<int>(
695
+ typeof(TestClass).GetField(nameof(TestClass.intValue))
696
+ )
697
+ );
698
+ }
699
+
700
+ [Test]
701
+ public void GetStaticFieldGetterClassGenericStaticField()
702
+ {
703
+ Func<int> classGetter = ReflectionHelpers.GetStaticFieldGetter<int>(
704
+ typeof(TestClass).GetField(
705
+ nameof(TestClass.StaticIntValue),
706
+ BindingFlags.Static | BindingFlags.Public
707
+ )
708
+ );
709
+ for (int i = 0; i < NumTries; ++i)
710
+ {
711
+ TestClass.StaticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
712
+ Assert.AreEqual(TestClass.StaticIntValue, classGetter());
713
+ }
714
+ }
715
+
716
+ [Test]
717
+ public void GetFieldGetterStructGenericMemberField()
718
+ {
719
+ TestStruct testStruct = new();
720
+ Func<TestStruct, int> structSetter = ReflectionHelpers.GetFieldGetter<TestStruct, int>(
721
+ typeof(TestStruct).GetField(nameof(TestStruct.intValue))
722
+ );
723
+ for (int i = 0; i < NumTries; ++i)
724
+ {
725
+ testStruct.intValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
726
+ Assert.AreEqual(testStruct.intValue, structSetter(testStruct));
727
+ }
728
+ }
729
+
730
+ [Test]
731
+ public void GetFieldGetterStructGenericStaticField()
732
+ {
733
+ TestStruct testStruct = new();
734
+ Func<TestStruct, int> structSetter = ReflectionHelpers.GetFieldGetter<TestStruct, int>(
735
+ typeof(TestStruct).GetField(
736
+ nameof(TestStruct.StaticIntValue),
737
+ BindingFlags.Static | BindingFlags.Public
738
+ )
739
+ );
740
+ for (int i = 0; i < NumTries; ++i)
741
+ {
742
+ TestStruct.StaticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
743
+ Assert.AreEqual(TestStruct.StaticIntValue, structSetter(testStruct));
744
+ }
745
+ }
746
+
747
+ [Test]
748
+ public void GetStaticFieldGetterStructGenericStaticField()
749
+ {
750
+ Func<int> structSetter = ReflectionHelpers.GetStaticFieldGetter<int>(
751
+ typeof(TestStruct).GetField(
752
+ nameof(TestStruct.StaticIntValue),
753
+ BindingFlags.Static | BindingFlags.Public
754
+ )
755
+ );
756
+ for (int i = 0; i < NumTries; ++i)
757
+ {
758
+ TestStruct.StaticIntValue = PRNG.Instance.Next(int.MinValue, int.MaxValue);
759
+ Assert.AreEqual(TestStruct.StaticIntValue, structSetter());
760
+ }
761
+ }
762
+
763
+ [Test]
764
+ public void ArrayCreator()
765
+ {
766
+ for (int i = 0; i < NumTries; ++i)
767
+ {
768
+ int count = PRNG.Instance.Next(1_000);
769
+ Array created = ReflectionHelpers.CreateArray(typeof(int), count);
770
+ Assert.AreEqual(count, created.Length);
771
+ Assert.IsTrue(created is int[]);
772
+ int[] typed = (int[])created;
773
+ Assert.AreEqual(count, typed.Length);
774
+ }
775
+ }
776
+
777
+ [Test]
778
+ public void ListCreator()
779
+ {
780
+ for (int i = 0; i < NumTries; ++i)
781
+ {
782
+ IList created = ReflectionHelpers.CreateList(typeof(int));
783
+ Assert.AreEqual(0, created.Count);
784
+ Assert.IsTrue(created is List<int>);
785
+ List<int> typedCreated = (List<int>)created;
786
+ int count = PRNG.Instance.Next(50);
787
+ List<int> expected = new();
788
+ for (int j = 0; j < count; ++j)
789
+ {
790
+ int element = PRNG.Instance.Next();
791
+ created.Add(element);
792
+ expected.Add(element);
793
+ Assert.AreEqual(j + 1, created.Count);
794
+ Assert.That(expected, Is.EqualTo(typedCreated));
795
+ }
796
+ }
797
+ }
798
+
799
+ [Test]
800
+ public void ListWithSizeCreator()
801
+ {
802
+ for (int i = 0; i < NumTries; ++i)
803
+ {
804
+ int capacity = PRNG.Instance.Next(1_000);
805
+ IList created = ReflectionHelpers.CreateList(typeof(int), capacity);
806
+ Assert.AreEqual(0, created.Count);
807
+ Assert.IsTrue(created is List<int>);
808
+ List<int> typedCreated = (List<int>)created;
809
+ Assert.AreEqual(capacity, typedCreated.Capacity);
810
+
811
+ int count = PRNG.Instance.Next(50);
812
+ List<int> expected = new();
813
+ for (int j = 0; j < count; ++j)
814
+ {
815
+ int element = PRNG.Instance.Next();
816
+ created.Add(element);
817
+ expected.Add(element);
818
+ Assert.AreEqual(j + 1, created.Count);
819
+ Assert.That(expected, Is.EqualTo(typedCreated));
820
+ }
821
+ }
822
+ }
823
+
824
+ [Test]
825
+ public void GetArrayCreator()
826
+ {
827
+ Func<int, Array> arrayCreator = ReflectionHelpers.GetArrayCreator(typeof(int));
828
+ Assert.IsNotNull(arrayCreator);
829
+
830
+ for (int i = 0; i < 10; ++i)
831
+ {
832
+ int size = PRNG.Instance.Next(1, 100);
833
+ Array created = arrayCreator(size);
834
+ Assert.IsNotNull(created);
835
+ Assert.AreEqual(size, created.Length);
836
+ Assert.IsTrue(created is int[]);
837
+ }
838
+ }
839
+
840
+ [Test]
841
+ public void GetListCreator()
842
+ {
843
+ Func<IList> listCreator = ReflectionHelpers.GetListCreator(typeof(string));
844
+ Assert.IsNotNull(listCreator);
845
+
846
+ for (int i = 0; i < 10; ++i)
847
+ {
848
+ IList created = listCreator();
849
+ Assert.IsNotNull(created);
850
+ Assert.AreEqual(0, created.Count);
851
+ Assert.IsTrue(created is List<string>);
852
+ }
853
+ }
854
+
855
+ [Test]
856
+ public void GetListWithCapacityCreator()
857
+ {
858
+ Func<int, IList> listCreator = ReflectionHelpers.GetListWithCapacityCreator(
859
+ typeof(bool)
860
+ );
861
+ Assert.IsNotNull(listCreator);
862
+
863
+ for (int i = 0; i < 10; ++i)
864
+ {
865
+ int capacity = PRNG.Instance.Next(1, 100);
866
+ IList created = listCreator(capacity);
867
+ Assert.IsNotNull(created);
868
+ Assert.AreEqual(0, created.Count);
869
+ Assert.IsTrue(created is List<bool>);
870
+ Assert.AreEqual(capacity, ((List<bool>)created).Capacity);
871
+ }
872
+ }
873
+
874
+ [Test]
875
+ public void InvokeStaticVoidMethod()
876
+ {
877
+ TestMethodClass testObj = new();
878
+ testObj.Reset();
879
+
880
+ MethodInfo method = typeof(TestMethodClass).GetMethod(
881
+ nameof(TestMethodClass.StaticVoidMethod)
882
+ );
883
+ Assert.IsNotNull(method);
884
+
885
+ int initialCount = TestMethodClass.StaticMethodCallCount;
886
+ object result = ReflectionHelpers.InvokeStaticMethod(method);
887
+
888
+ Assert.IsNull(result);
889
+ Assert.AreEqual(initialCount + 1, TestMethodClass.StaticMethodCallCount);
890
+ }
891
+
892
+ [Test]
893
+ public void InvokeStaticMethodWithReturnValue()
894
+ {
895
+ TestMethodClass testObj = new();
896
+ testObj.Reset();
897
+
898
+ MethodInfo intMethod = typeof(TestMethodClass).GetMethod(
899
+ nameof(TestMethodClass.StaticIntMethod)
900
+ );
901
+ MethodInfo stringMethod = typeof(TestMethodClass).GetMethod(
902
+ nameof(TestMethodClass.StaticStringMethod)
903
+ );
904
+ MethodInfo boolMethod = typeof(TestMethodClass).GetMethod(
905
+ nameof(TestMethodClass.StaticBoolMethod)
906
+ );
907
+
908
+ Assert.AreEqual(42, ReflectionHelpers.InvokeStaticMethod(intMethod));
909
+ Assert.AreEqual("test", ReflectionHelpers.InvokeStaticMethod(stringMethod));
910
+ Assert.AreEqual(true, ReflectionHelpers.InvokeStaticMethod(boolMethod));
911
+ Assert.AreEqual(3, TestMethodClass.StaticMethodCallCount);
912
+ }
913
+
914
+ [Test]
915
+ public void InvokeStaticMethodWithParameters()
916
+ {
917
+ int directResult = TestMethodClass.StaticMethodWithParam(10);
918
+ Assert.AreEqual(20, directResult);
919
+
920
+ TestMethodClass testObj = new();
921
+ testObj.Reset();
922
+
923
+ MethodInfo paramMethod = typeof(TestMethodClass).GetMethod(
924
+ nameof(TestMethodClass.StaticMethodWithParam)
925
+ );
926
+ MethodInfo voidParamMethod = typeof(TestMethodClass).GetMethod(
927
+ nameof(TestMethodClass.StaticVoidMethodWithParam)
928
+ );
929
+ MethodInfo multiParamMethod = typeof(TestMethodClass).GetMethod(
930
+ nameof(TestMethodClass.StaticMethodMultipleParams)
931
+ );
932
+
933
+ object result1 = ReflectionHelpers.InvokeStaticMethod(paramMethod, 10);
934
+ Assert.AreEqual(20, result1);
935
+ ReflectionHelpers.InvokeStaticMethod(voidParamMethod, 99);
936
+ Assert.AreEqual(99, TestMethodClass.StaticMethodCallCount);
937
+ object result3 = ReflectionHelpers.InvokeStaticMethod(multiParamMethod, 5, "abc", true);
938
+ Assert.AreEqual(9, result3);
939
+ }
940
+
941
+ [Test]
942
+ public void InvokeInstanceMethod()
943
+ {
944
+ TestMethodClass testObj = new();
945
+ testObj.Reset();
946
+
947
+ MethodInfo voidMethod = typeof(TestMethodClass).GetMethod(
948
+ nameof(TestMethodClass.InstanceVoidMethod)
949
+ );
950
+ MethodInfo intMethod = typeof(TestMethodClass).GetMethod(
951
+ nameof(TestMethodClass.InstanceIntMethod)
952
+ );
953
+ MethodInfo stringMethod = typeof(TestMethodClass).GetMethod(
954
+ nameof(TestMethodClass.InstanceStringMethod)
955
+ );
956
+ MethodInfo paramMethod = typeof(TestMethodClass).GetMethod(
957
+ nameof(TestMethodClass.InstanceMethodWithParam)
958
+ );
959
+
960
+ Assert.IsNull(ReflectionHelpers.InvokeMethod(voidMethod, testObj));
961
+ Assert.AreEqual(1, testObj.instanceMethodCallCount);
962
+
963
+ Assert.AreEqual(100, ReflectionHelpers.InvokeMethod(intMethod, testObj));
964
+ Assert.AreEqual("instance", ReflectionHelpers.InvokeMethod(stringMethod, testObj));
965
+ Assert.AreEqual(5, ReflectionHelpers.InvokeMethod(paramMethod, testObj, "hello"));
966
+ Assert.AreEqual(4, testObj.instanceMethodCallCount);
967
+ }
968
+
969
+ [Test]
970
+ public void GetMethodInvoker()
971
+ {
972
+ TestMethodClass testObj = new();
973
+ testObj.Reset();
974
+
975
+ MethodInfo voidMethod = typeof(TestMethodClass).GetMethod(
976
+ nameof(TestMethodClass.InstanceVoidMethod)
977
+ );
978
+ MethodInfo intMethod = typeof(TestMethodClass).GetMethod(
979
+ nameof(TestMethodClass.InstanceIntMethod)
980
+ );
981
+ MethodInfo paramMethod = typeof(TestMethodClass).GetMethod(
982
+ nameof(TestMethodClass.InstanceMethodWithParam)
983
+ );
984
+
985
+ Func<object, object[], object> voidInvoker = ReflectionHelpers.GetMethodInvoker(
986
+ voidMethod
987
+ );
988
+ Func<object, object[], object> intInvoker = ReflectionHelpers.GetMethodInvoker(
989
+ intMethod
990
+ );
991
+ Func<object, object[], object> paramInvoker = ReflectionHelpers.GetMethodInvoker(
992
+ paramMethod
993
+ );
994
+
995
+ Assert.IsNull(voidInvoker(testObj, Array.Empty<object>()));
996
+ Assert.AreEqual(1, testObj.instanceMethodCallCount);
997
+
998
+ Assert.AreEqual(100, intInvoker(testObj, Array.Empty<object>()));
999
+ Assert.AreEqual(2, testObj.instanceMethodCallCount);
1000
+
1001
+ Assert.AreEqual(5, paramInvoker(testObj, new object[] { "hello" }));
1002
+ Assert.AreEqual(3, testObj.instanceMethodCallCount);
1003
+ }
1004
+
1005
+ [Test]
1006
+ public void GetStaticMethodInvoker()
1007
+ {
1008
+ TestMethodClass testObj = new();
1009
+ testObj.Reset();
1010
+
1011
+ MethodInfo voidMethod = typeof(TestMethodClass).GetMethod(
1012
+ nameof(TestMethodClass.StaticVoidMethod)
1013
+ );
1014
+ MethodInfo intMethod = typeof(TestMethodClass).GetMethod(
1015
+ nameof(TestMethodClass.StaticIntMethod)
1016
+ );
1017
+ MethodInfo paramMethod = typeof(TestMethodClass).GetMethod(
1018
+ nameof(TestMethodClass.StaticMethodWithParam)
1019
+ );
1020
+
1021
+ Func<object[], object> voidInvoker = ReflectionHelpers.GetStaticMethodInvoker(
1022
+ voidMethod
1023
+ );
1024
+ Func<object[], object> intInvoker = ReflectionHelpers.GetStaticMethodInvoker(intMethod);
1025
+ Func<object[], object> paramInvoker = ReflectionHelpers.GetStaticMethodInvoker(
1026
+ paramMethod
1027
+ );
1028
+
1029
+ Assert.IsNull(voidInvoker(Array.Empty<object>()));
1030
+ Assert.AreEqual(1, TestMethodClass.StaticMethodCallCount);
1031
+
1032
+ Assert.AreEqual(42, intInvoker(Array.Empty<object>()));
1033
+ Assert.AreEqual(2, TestMethodClass.StaticMethodCallCount);
1034
+
1035
+ Assert.AreEqual(20, paramInvoker(new object[] { 10 }));
1036
+ Assert.AreEqual(3, TestMethodClass.StaticMethodCallCount);
1037
+ }
1038
+
1039
+ [Test]
1040
+ public void CreateInstanceParameterless()
1041
+ {
1042
+ TestConstructorClass defaultInstance =
1043
+ ReflectionHelpers.CreateInstance<TestConstructorClass>();
1044
+ Assert.IsNotNull(defaultInstance);
1045
+ Assert.AreEqual(0, defaultInstance.Value1);
1046
+ Assert.AreEqual("default", defaultInstance.Value2);
1047
+ Assert.AreEqual(false, defaultInstance.Value3);
1048
+ }
1049
+
1050
+ [Test]
1051
+ public void CreateInstanceWithParameters()
1052
+ {
1053
+ TestConstructorClass singleParam =
1054
+ ReflectionHelpers.CreateInstance<TestConstructorClass>(42);
1055
+ Assert.IsNotNull(singleParam);
1056
+ Assert.AreEqual(42, singleParam.Value1);
1057
+ Assert.AreEqual("single", singleParam.Value2);
1058
+ Assert.AreEqual(false, singleParam.Value3);
1059
+
1060
+ TestConstructorClass twoParam = ReflectionHelpers.CreateInstance<TestConstructorClass>(
1061
+ 10,
1062
+ "test"
1063
+ );
1064
+ Assert.IsNotNull(twoParam);
1065
+ Assert.AreEqual(10, twoParam.Value1);
1066
+ Assert.AreEqual("test", twoParam.Value2);
1067
+ Assert.AreEqual(false, twoParam.Value3);
1068
+
1069
+ TestConstructorClass threeParam =
1070
+ ReflectionHelpers.CreateInstance<TestConstructorClass>(5, "hello", true);
1071
+ Assert.IsNotNull(threeParam);
1072
+ Assert.AreEqual(5, threeParam.Value1);
1073
+ Assert.AreEqual("hello", threeParam.Value2);
1074
+ Assert.AreEqual(true, threeParam.Value3);
1075
+ }
1076
+
1077
+ [Test]
1078
+ public void CreateInstanceUsingConstructorInfo()
1079
+ {
1080
+ ConstructorInfo[] constructors = typeof(TestConstructorClass).GetConstructors();
1081
+ ConstructorInfo parameterlessConstructor = constructors.First(c =>
1082
+ c.GetParameters().Length == 0
1083
+ );
1084
+ ConstructorInfo singleParamConstructor = constructors.First(c =>
1085
+ c.GetParameters().Length == 1
1086
+ );
1087
+
1088
+ Func<object[], object> parameterlessDelegate = ReflectionHelpers.GetConstructor(
1089
+ parameterlessConstructor
1090
+ );
1091
+ Func<object[], object> singleParamDelegate = ReflectionHelpers.GetConstructor(
1092
+ singleParamConstructor
1093
+ );
1094
+
1095
+ TestConstructorClass instance1 = (TestConstructorClass)parameterlessDelegate(
1096
+ Array.Empty<object>()
1097
+ );
1098
+ Assert.AreEqual(0, instance1.Value1);
1099
+ Assert.AreEqual("default", instance1.Value2);
1100
+
1101
+ TestConstructorClass instance2 = (TestConstructorClass)singleParamDelegate(
1102
+ new object[] { 99 }
1103
+ );
1104
+ Assert.AreEqual(99, instance2.Value1);
1105
+ Assert.AreEqual("single", instance2.Value2);
1106
+ }
1107
+
1108
+ [Test]
1109
+ public void GetParameterlessConstructor()
1110
+ {
1111
+ Func<TestConstructorClass> constructor =
1112
+ ReflectionHelpers.GetParameterlessConstructor<TestConstructorClass>();
1113
+ Assert.IsNotNull(constructor);
1114
+
1115
+ for (int i = 0; i < 100; i++)
1116
+ {
1117
+ TestConstructorClass instance = constructor();
1118
+ Assert.IsNotNull(instance);
1119
+ Assert.AreEqual(0, instance.Value1);
1120
+ Assert.AreEqual("default", instance.Value2);
1121
+ Assert.AreEqual(false, instance.Value3);
1122
+ }
1123
+ }
1124
+
1125
+ [Test]
1126
+ public void CreateGenericInstance()
1127
+ {
1128
+ object intGeneric = ReflectionHelpers.CreateGenericInstance<object>(
1129
+ typeof(GenericTestClass<>),
1130
+ new[] { typeof(int) },
1131
+ 42
1132
+ );
1133
+
1134
+ Assert.IsNotNull(intGeneric);
1135
+ Assert.IsInstanceOf<GenericTestClass<int>>(intGeneric);
1136
+ Assert.AreEqual(42, ((GenericTestClass<int>)intGeneric).Value);
1137
+
1138
+ object stringGeneric = ReflectionHelpers.CreateGenericInstance<object>(
1139
+ typeof(GenericTestClass<>),
1140
+ new[] { typeof(string) },
1141
+ "hello"
1142
+ );
1143
+
1144
+ Assert.IsNotNull(stringGeneric);
1145
+ Assert.IsInstanceOf<GenericTestClass<string>>(stringGeneric);
1146
+ Assert.AreEqual("hello", ((GenericTestClass<string>)stringGeneric).Value);
1147
+ }
1148
+
1149
+ [Test]
1150
+ public void GetGenericParameterlessConstructor()
1151
+ {
1152
+ Func<object> constructor = ReflectionHelpers.GetGenericParameterlessConstructor<object>(
1153
+ typeof(GenericTestClass<>),
1154
+ typeof(int)
1155
+ );
1156
+
1157
+ Assert.IsNotNull(constructor);
1158
+
1159
+ object instance = constructor();
1160
+ Assert.IsNotNull(instance);
1161
+ Assert.IsInstanceOf<GenericTestClass<int>>(instance);
1162
+ }
1163
+
1164
+ [Test]
1165
+ public void CreateStructInstance()
1166
+ {
1167
+ TestConstructorStruct structInstance =
1168
+ ReflectionHelpers.CreateInstance<TestConstructorStruct>(123);
1169
+ Assert.AreEqual(123, structInstance.Value);
1170
+ }
1171
+
1172
+ [Test]
1173
+ public void GetPropertyGetterStatic()
1174
+ {
1175
+ // Reset static state to initial values
1176
+ TestPropertyClass.StaticProperty = 50;
1177
+ TestPropertyClass.StaticStringProperty = "static";
1178
+
1179
+ PropertyInfo staticProp = typeof(TestPropertyClass).GetProperty(
1180
+ nameof(TestPropertyClass.StaticProperty)
1181
+ );
1182
+ PropertyInfo staticStringProp = typeof(TestPropertyClass).GetProperty(
1183
+ nameof(TestPropertyClass.StaticStringProperty)
1184
+ );
1185
+ PropertyInfo staticReadOnlyProp = typeof(TestPropertyClass).GetProperty(
1186
+ nameof(TestPropertyClass.StaticReadOnlyProperty)
1187
+ );
1188
+
1189
+ Func<object, object> staticGetter = ReflectionHelpers.GetPropertyGetter(staticProp);
1190
+ Func<object, object> staticStringGetter = ReflectionHelpers.GetPropertyGetter(
1191
+ staticStringProp
1192
+ );
1193
+ Func<object, object> staticReadOnlyGetter = ReflectionHelpers.GetPropertyGetter(
1194
+ staticReadOnlyProp
1195
+ );
1196
+
1197
+ // Test initial values
1198
+ Assert.AreEqual(50, staticGetter(null));
1199
+ Assert.AreEqual("static", staticStringGetter(null));
1200
+ Assert.AreEqual(999, staticReadOnlyGetter(null));
1201
+
1202
+ // Test after changing values
1203
+ TestPropertyClass.StaticProperty = 100;
1204
+ TestPropertyClass.StaticStringProperty = "changed";
1205
+
1206
+ Assert.AreEqual(100, staticGetter(null));
1207
+ Assert.AreEqual("changed", staticStringGetter(null));
1208
+ Assert.AreEqual(999, staticReadOnlyGetter(null)); // Read-only shouldn't change
1209
+ }
1210
+
1211
+ [Test]
1212
+ public void GetPropertyGetterInstance()
1213
+ {
1214
+ TestPropertyClass testObj = new();
1215
+ PropertyInfo instanceProp = typeof(TestPropertyClass).GetProperty(
1216
+ nameof(TestPropertyClass.InstanceProperty)
1217
+ );
1218
+ PropertyInfo instanceStringProp = typeof(TestPropertyClass).GetProperty(
1219
+ nameof(TestPropertyClass.InstanceStringProperty)
1220
+ );
1221
+ PropertyInfo instanceReadOnlyProp = typeof(TestPropertyClass).GetProperty(
1222
+ nameof(TestPropertyClass.InstanceReadOnlyProperty)
1223
+ );
1224
+
1225
+ Func<object, object> instanceGetter = ReflectionHelpers.GetPropertyGetter(instanceProp);
1226
+ Func<object, object> instanceStringGetter = ReflectionHelpers.GetPropertyGetter(
1227
+ instanceStringProp
1228
+ );
1229
+ Func<object, object> instanceReadOnlyGetter = ReflectionHelpers.GetPropertyGetter(
1230
+ instanceReadOnlyProp
1231
+ );
1232
+
1233
+ // Test initial values
1234
+ Assert.AreEqual(25, instanceGetter(testObj));
1235
+ Assert.AreEqual("instance", instanceStringGetter(testObj));
1236
+ Assert.AreEqual(888, instanceReadOnlyGetter(testObj));
1237
+
1238
+ // Test after changing values
1239
+ testObj.InstanceProperty = 200;
1240
+ testObj.InstanceStringProperty = "modified";
1241
+
1242
+ Assert.AreEqual(200, instanceGetter(testObj));
1243
+ Assert.AreEqual("modified", instanceStringGetter(testObj));
1244
+ Assert.AreEqual(888, instanceReadOnlyGetter(testObj)); // Read-only shouldn't change
1245
+ }
1246
+
1247
+ [Test]
1248
+ public void GetStaticPropertyGetter()
1249
+ {
1250
+ Func<int> staticGetter = ReflectionHelpers.GetStaticPropertyGetter<int>(
1251
+ typeof(TestPropertyClass).GetProperty(nameof(TestPropertyClass.StaticProperty))
1252
+ );
1253
+
1254
+ Func<string> staticStringGetter = ReflectionHelpers.GetStaticPropertyGetter<string>(
1255
+ typeof(TestPropertyClass).GetProperty(
1256
+ nameof(TestPropertyClass.StaticStringProperty)
1257
+ )
1258
+ );
1259
+
1260
+ Assert.AreEqual(TestPropertyClass.StaticProperty, staticGetter());
1261
+ Assert.AreEqual(TestPropertyClass.StaticStringProperty, staticStringGetter());
1262
+
1263
+ TestPropertyClass.StaticProperty = 777;
1264
+ TestPropertyClass.StaticStringProperty = "new value";
1265
+
1266
+ Assert.AreEqual(777, staticGetter());
1267
+ Assert.AreEqual("new value", staticStringGetter());
1268
+ }
1269
+
1270
+ [Test]
1271
+ public void GetAllLoadedAssemblies()
1272
+ {
1273
+ Assembly[] assemblies = ReflectionHelpers.GetAllLoadedAssemblies().ToArray();
1274
+ Assert.IsNotNull(assemblies);
1275
+ Assert.Greater(assemblies.Length, 0);
1276
+ Assert.IsTrue(assemblies.All(a => a != null));
1277
+ Assert.IsTrue(assemblies.All(a => !a.IsDynamic));
1278
+ }
1279
+
1280
+ [Test]
1281
+ public void GetAllLoadedTypes()
1282
+ {
1283
+ Type[] types = ReflectionHelpers.GetAllLoadedTypes().Take(100).ToArray();
1284
+ Assert.IsNotNull(types);
1285
+ Assert.Greater(types.Length, 0);
1286
+ Assert.IsTrue(types.All(t => t != null));
1287
+ }
1288
+
1289
+ [Test]
1290
+ public void GetPropertySetterInstanceAndStatic()
1291
+ {
1292
+ TestPropertyClass instance = new();
1293
+
1294
+ // Instance setter
1295
+ PropertyInfo instProp = typeof(TestPropertyClass).GetProperty(
1296
+ nameof(TestPropertyClass.InstanceProperty)
1297
+ );
1298
+ Action<object, object> instSetter = ReflectionHelpers.GetPropertySetter(instProp);
1299
+ instSetter(instance, 555);
1300
+ Assert.AreEqual(555, instance.InstanceProperty);
1301
+
1302
+ // Static setter
1303
+ PropertyInfo staticProp = typeof(TestPropertyClass).GetProperty(
1304
+ nameof(TestPropertyClass.StaticProperty)
1305
+ );
1306
+ Action<object, object> staticSetter = ReflectionHelpers.GetPropertySetter(staticProp);
1307
+ staticSetter(null, 777);
1308
+ Assert.AreEqual(777, TestPropertyClass.StaticProperty);
1309
+ }
1310
+
1311
+ [Test]
1312
+ public void GetPropertySetterThrowsOnReadOnly()
1313
+ {
1314
+ PropertyInfo roInstance = typeof(TestPropertyClass).GetProperty(
1315
+ nameof(TestPropertyClass.InstanceReadOnlyProperty)
1316
+ );
1317
+ Assert.Throws<ArgumentException>(
1318
+ () => ReflectionHelpers.GetPropertySetter(roInstance),
1319
+ "Property InstanceReadOnlyProperty has no setter should throw"
1320
+ );
1321
+
1322
+ PropertyInfo roStatic = typeof(TestPropertyClass).GetProperty(
1323
+ nameof(TestPropertyClass.StaticReadOnlyProperty)
1324
+ );
1325
+ Assert.Throws<ArgumentException>(
1326
+ () => ReflectionHelpers.GetPropertySetter(roStatic),
1327
+ "Property StaticReadOnlyProperty has no setter should throw"
1328
+ );
1329
+ }
1330
+
1331
+ [Test]
1332
+ public void GetPropertyGetterGenericCoversInstanceAndStatic()
1333
+ {
1334
+ TestPropertyClass obj = new() { InstanceProperty = 123 };
1335
+
1336
+ Func<TestPropertyClass, int> instGetter = ReflectionHelpers.GetPropertyGetter<
1337
+ TestPropertyClass,
1338
+ int
1339
+ >(typeof(TestPropertyClass).GetProperty(nameof(TestPropertyClass.InstanceProperty)));
1340
+ Assert.AreEqual(123, instGetter(obj));
1341
+
1342
+ TestPropertyClass.StaticProperty = 246;
1343
+ Func<TestPropertyClass, int> staticGetter = ReflectionHelpers.GetPropertyGetter<
1344
+ TestPropertyClass,
1345
+ int
1346
+ >(typeof(TestPropertyClass).GetProperty(nameof(TestPropertyClass.StaticProperty)));
1347
+ Assert.AreEqual(246, staticGetter(obj)); // instance arg ignored for static
1348
+ }
1349
+
1350
+ [Test]
1351
+ public void HashSetCreatorAndAdder()
1352
+ {
1353
+ object intSetObj = ReflectionHelpers.CreateHashSet(typeof(int), 0);
1354
+ Assert.IsInstanceOf<HashSet<int>>(intSetObj);
1355
+ Action<object, object> addInt = ReflectionHelpers.GetHashSetAdder(typeof(int));
1356
+ addInt(intSetObj, 1);
1357
+ addInt(intSetObj, 1);
1358
+ addInt(intSetObj, 2);
1359
+ Assert.That((HashSet<int>)intSetObj, Is.EquivalentTo(new[] { 1, 2 }));
1360
+
1361
+ object strSetObj = ReflectionHelpers.CreateHashSet(typeof(string), 0);
1362
+ Assert.IsInstanceOf<HashSet<string>>(strSetObj);
1363
+ Action<object, object> addStr = ReflectionHelpers.GetHashSetAdder(typeof(string));
1364
+ addStr(strSetObj, null);
1365
+ addStr(strSetObj, "a");
1366
+ addStr(strSetObj, "a");
1367
+ Assert.IsTrue(((HashSet<string>)strSetObj).Contains(null));
1368
+ Assert.That((HashSet<string>)strSetObj, Is.EquivalentTo(new string[] { null, "a" }));
1369
+ }
1370
+
1371
+ [Test]
1372
+ public void GetStaticMethodInvokerTypedTwoParams()
1373
+ {
1374
+ MethodInfo concat = typeof(string).GetMethod(
1375
+ nameof(string.Concat),
1376
+ new[] { typeof(string), typeof(string) }
1377
+ );
1378
+ Func<string, string, string> invoker = ReflectionHelpers.GetStaticMethodInvoker<
1379
+ string,
1380
+ string,
1381
+ string
1382
+ >(concat);
1383
+ Assert.AreEqual("ab", invoker("a", "b"));
1384
+ }
1385
+
1386
+ [Test]
1387
+ public void GetStaticMethodInvokerTypedThrowsOnSignatureMismatch()
1388
+ {
1389
+ MethodInfo concat = typeof(string).GetMethod(
1390
+ nameof(string.Concat),
1391
+ new[] { typeof(string), typeof(string) }
1392
+ );
1393
+ Assert.Throws<ArgumentException>(
1394
+ () => ReflectionHelpers.GetStaticMethodInvoker<int, int, int>(concat),
1395
+ "Mismatched generic signature should throw"
1396
+ );
1397
+
1398
+ MethodInfo instanceToString = typeof(object).GetMethod(nameof(ToString));
1399
+ Assert.Throws<ArgumentException>(
1400
+ () =>
1401
+ ReflectionHelpers.GetStaticMethodInvoker<object, object, string>(
1402
+ instanceToString
1403
+ ),
1404
+ "Non-static method should throw"
1405
+ );
1406
+ }
1407
+
1408
+ [Test]
1409
+ public void GetParameterlessConstructorTypeOverload()
1410
+ {
1411
+ Func<object> ctor = ReflectionHelpers.GetParameterlessConstructor(
1412
+ typeof(TestConstructorClass)
1413
+ );
1414
+ object instance = ctor();
1415
+ Assert.IsInstanceOf<TestConstructorClass>(instance);
1416
+
1417
+ Assert.Throws<ArgumentException>(
1418
+ () => ReflectionHelpers.GetParameterlessConstructor(typeof(NoParameterlessCtor)),
1419
+ "Type without parameterless constructor should throw"
1420
+ );
1421
+ }
1422
+
1423
+ [Test]
1424
+ public void BuildParameterlessInstanceMethodIfExists()
1425
+ {
1426
+ Action<TestMethodClass> action =
1427
+ ReflectionHelpers.BuildParameterlessInstanceMethodIfExists<TestMethodClass>(
1428
+ "Reset"
1429
+ );
1430
+ Assert.IsNotNull(action);
1431
+ TestMethodClass obj = new();
1432
+ TestMethodClass.StaticMethodCallCount = 5;
1433
+ obj.instanceMethodCallCount = 4;
1434
+ action(obj);
1435
+ Assert.AreEqual(0, TestMethodClass.StaticMethodCallCount);
1436
+ Assert.AreEqual(0, obj.instanceMethodCallCount);
1437
+
1438
+ Action<TestMethodClass> missing =
1439
+ ReflectionHelpers.BuildParameterlessInstanceMethodIfExists<TestMethodClass>(
1440
+ "DoesNotExist"
1441
+ );
1442
+ Assert.IsNull(missing);
1443
+ }
1444
+
1445
+ [Test]
1446
+ public void IsComponentEnabledCoversMonoBehaviourAndScriptableObject()
1447
+ {
1448
+ GameObject go = new("probe");
1449
+ try
1450
+ {
1451
+ EnabledProbe probe = go.AddComponent<EnabledProbe>();
1452
+ Assert.IsTrue(probe.IsComponentEnabled());
1453
+ probe.enabled = false;
1454
+ Assert.IsFalse(probe.IsComponentEnabled());
1455
+
1456
+ ScriptableObject so = ScriptableObject.CreateInstance<ScriptableObject>();
1457
+ Assert.IsTrue(so.IsComponentEnabled());
1458
+ }
1459
+ finally
1460
+ {
1461
+ UnityEngine.Object.DestroyImmediate(go);
1462
+ }
1463
+ }
1464
+
1465
+ [Test]
1466
+ public void GetTypesFromAssembly()
1467
+ {
1468
+ Assembly testAssembly = typeof(ReflectionHelperTests).Assembly;
1469
+ Type[] types = ReflectionHelpers.GetTypesFromAssembly(testAssembly).ToArray();
1470
+
1471
+ Assert.IsNotNull(types);
1472
+ Assert.Greater(types.Length, 0);
1473
+ Assert.IsTrue(types.Contains(typeof(ReflectionHelperTests)));
1474
+ Assert.IsTrue(types.Contains(typeof(TestAttributeClass)));
1475
+ Assert.IsTrue(types.Contains(typeof(TestMethodClass)));
1476
+ }
1477
+
1478
+ [Test]
1479
+ public void GetTypesFromAssemblyName()
1480
+ {
1481
+ Type[] types = ReflectionHelpers
1482
+ .GetTypesFromAssemblyName("System.Core")
1483
+ .Take(10)
1484
+ .ToArray();
1485
+ Assert.IsNotNull(types);
1486
+ // May be empty on some platforms, but should not throw
1487
+ }
1488
+
1489
+ [Test]
1490
+ public void GetTypesWithAttribute()
1491
+ {
1492
+ Type[] typesWithDescAttr = ReflectionHelpers
1493
+ .GetTypesWithAttribute<DescriptionAttribute>()
1494
+ .ToArray();
1495
+ Assert.IsNotNull(typesWithDescAttr);
1496
+ Assert.IsTrue(typesWithDescAttr.Contains(typeof(TestAttributeClass)));
1497
+
1498
+ Type[] typesByType = ReflectionHelpers
1499
+ .GetTypesWithAttribute(typeof(DescriptionAttribute))
1500
+ .ToArray();
1501
+ Assert.IsNotNull(typesByType);
1502
+ Assert.IsTrue(typesByType.Contains(typeof(TestAttributeClass)));
1503
+ }
1504
+
1505
+ [Test]
1506
+ public void HasAttributeSafe()
1507
+ {
1508
+ Type testType = typeof(TestAttributeClass);
1509
+ FieldInfo staticField = testType.GetField(
1510
+ nameof(TestAttributeClass.StaticFieldWithAttribute)
1511
+ );
1512
+ MethodInfo instanceMethod = testType.GetMethod(
1513
+ nameof(TestAttributeClass.InstanceMethodWithAttribute)
1514
+ );
1515
+
1516
+ Assert.IsTrue(ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(testType));
1517
+ Assert.IsTrue(ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(staticField));
1518
+ Assert.IsTrue(
1519
+ ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(instanceMethod)
1520
+ );
1521
+
1522
+ Assert.IsTrue(
1523
+ ReflectionHelpers.HasAttributeSafe(testType, typeof(ReflectionTestAttribute))
1524
+ );
1525
+ Assert.IsTrue(
1526
+ ReflectionHelpers.HasAttributeSafe(staticField, typeof(ReflectionTestAttribute))
1527
+ );
1528
+ Assert.IsTrue(
1529
+ ReflectionHelpers.HasAttributeSafe(instanceMethod, typeof(ReflectionTestAttribute))
1530
+ );
1531
+
1532
+ // Test with types that don't have attributes
1533
+ Assert.IsFalse(
1534
+ ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(typeof(TestMethodClass))
1535
+ );
1536
+ Assert.IsFalse(
1537
+ ReflectionHelpers.HasAttributeSafe(
1538
+ typeof(TestMethodClass),
1539
+ typeof(ReflectionTestAttribute)
1540
+ )
1541
+ );
1542
+
1543
+ // Test with null (should return false, not throw)
1544
+ Assert.IsFalse(ReflectionHelpers.HasAttributeSafe<ReflectionTestAttribute>(null));
1545
+ Assert.IsFalse(
1546
+ ReflectionHelpers.HasAttributeSafe(null, typeof(ReflectionTestAttribute))
1547
+ );
1548
+ }
1549
+
1550
+ [Test]
1551
+ public void GetAttributeSafe()
1552
+ {
1553
+ Type testType = typeof(TestAttributeClass);
1554
+ FieldInfo instanceField = testType.GetField(
1555
+ nameof(TestAttributeClass.instanceFieldWithAttribute)
1556
+ );
1557
+
1558
+ ReflectionTestAttribute classAttr =
1559
+ ReflectionHelpers.GetAttributeSafe<ReflectionTestAttribute>(testType);
1560
+ Assert.IsNotNull(classAttr);
1561
+ Assert.AreEqual("ClassLevel", classAttr.Name);
1562
+ Assert.AreEqual(10, classAttr.Value);
1563
+
1564
+ ReflectionTestAttribute fieldAttr =
1565
+ ReflectionHelpers.GetAttributeSafe<ReflectionTestAttribute>(instanceField);
1566
+ Assert.IsNotNull(fieldAttr);
1567
+ Assert.AreEqual("InstanceField", fieldAttr.Name);
1568
+ Assert.AreEqual(5, fieldAttr.Value);
1569
+
1570
+ // Test non-generic version
1571
+ Attribute classAttrObj = ReflectionHelpers.GetAttributeSafe(
1572
+ testType,
1573
+ typeof(ReflectionTestAttribute)
1574
+ );
1575
+ Assert.IsNotNull(classAttrObj);
1576
+ Assert.IsInstanceOf<ReflectionTestAttribute>(classAttrObj);
1577
+
1578
+ // Test with null
1579
+ Assert.IsNull(ReflectionHelpers.GetAttributeSafe<ReflectionTestAttribute>(null));
1580
+ Assert.IsNull(
1581
+ ReflectionHelpers.GetAttributeSafe(null, typeof(ReflectionTestAttribute))
1582
+ );
1583
+ }
1584
+
1585
+ [Test]
1586
+ public void GetAllAttributesSafe()
1587
+ {
1588
+ Type testType = typeof(TestAttributeClass);
1589
+ PropertyInfo instanceProperty = testType.GetProperty(
1590
+ nameof(TestAttributeClass.InstancePropertyWithAttribute)
1591
+ );
1592
+
1593
+ ReflectionTestAttribute[] typeAttrs = testType
1594
+ .GetAllAttributesSafe<ReflectionTestAttribute>()
1595
+ .ToArray();
1596
+ Assert.IsNotNull(typeAttrs);
1597
+ Assert.AreEqual(1, typeAttrs.Length);
1598
+ Assert.AreEqual("ClassLevel", typeAttrs[0].Name);
1599
+
1600
+ ReflectionTestAttribute[] propAttrs = instanceProperty
1601
+ .GetAllAttributesSafe<ReflectionTestAttribute>()
1602
+ .ToArray();
1603
+ Assert.IsNotNull(propAttrs);
1604
+ Assert.AreEqual(1, propAttrs.Length);
1605
+ Assert.AreEqual("InstanceProperty", propAttrs[0].Name);
1606
+
1607
+ // Test non-generic version
1608
+ Attribute[] allTypeAttrs = testType.GetAllAttributesSafe().ToArray();
1609
+ Assert.IsNotNull(allTypeAttrs);
1610
+ Assert.Greater(allTypeAttrs.Length, 0);
1611
+
1612
+ Attribute[] allPropAttrs = instanceProperty
1613
+ .GetAllAttributesSafe(typeof(ReflectionTestAttribute))
1614
+ .ToArray();
1615
+ Assert.IsNotNull(allPropAttrs);
1616
+ Assert.AreEqual(1, allPropAttrs.Length);
1617
+
1618
+ // Test with null
1619
+ Assert.AreEqual(
1620
+ 0,
1621
+ ReflectionHelpers.GetAllAttributesSafe<ReflectionTestAttribute>(null).Length
1622
+ );
1623
+ Assert.AreEqual(0, ReflectionHelpers.GetAllAttributesSafe(null).Length);
1624
+ }
1625
+
1626
+ [Test]
1627
+ public void GetAllAttributeValuesSafe()
1628
+ {
1629
+ Type testType = typeof(TestAttributeClass);
1630
+ Dictionary<string, object> attrValues = testType.GetAllAttributeValuesSafe();
1631
+
1632
+ Assert.IsNotNull(attrValues);
1633
+ Assert.IsTrue(attrValues.ContainsKey("ReflectionTest"));
1634
+ Assert.IsInstanceOf<ReflectionTestAttribute>(attrValues["ReflectionTest"]);
1635
+
1636
+ // Test with null
1637
+ Dictionary<string, object> nullResult = ReflectionHelpers.GetAllAttributeValuesSafe(
1638
+ null
1639
+ );
1640
+ Assert.IsNotNull(nullResult);
1641
+ Assert.AreEqual(0, nullResult.Count);
1642
+ }
1643
+
1644
+ [Test]
1645
+ public void GetMembersWithAttributeSafe()
1646
+ {
1647
+ Type testType = typeof(TestAttributeClass);
1648
+
1649
+ MethodInfo[] methods = testType
1650
+ .GetMethodsWithAttributeSafe<ReflectionTestAttribute>()
1651
+ .ToArray();
1652
+ Assert.IsNotNull(methods);
1653
+ Assert.Greater(methods.Length, 0);
1654
+ Assert.IsTrue(
1655
+ methods.Any(m => m.Name == nameof(TestAttributeClass.StaticMethodWithAttribute))
1656
+ );
1657
+ Assert.IsTrue(
1658
+ methods.Any(m => m.Name == nameof(TestAttributeClass.InstanceMethodWithAttribute))
1659
+ );
1660
+
1661
+ PropertyInfo[] properties = testType
1662
+ .GetPropertiesWithAttributeSafe<ReflectionTestAttribute>()
1663
+ .ToArray();
1664
+ Assert.IsNotNull(properties);
1665
+ Assert.Greater(properties.Length, 0);
1666
+ Assert.IsTrue(
1667
+ properties.Any(p =>
1668
+ p.Name == nameof(TestAttributeClass.StaticPropertyWithAttribute)
1669
+ )
1670
+ );
1671
+
1672
+ FieldInfo[] fields = testType
1673
+ .GetFieldsWithAttributeSafe<ReflectionTestAttribute>()
1674
+ .ToArray();
1675
+ Assert.IsNotNull(fields);
1676
+ Assert.Greater(fields.Length, 0);
1677
+ Assert.IsTrue(
1678
+ fields.Any(f => f.Name == nameof(TestAttributeClass.StaticFieldWithAttribute))
1679
+ );
1680
+
1681
+ // Test with null
1682
+ Assert.AreEqual(
1683
+ 0,
1684
+ ReflectionHelpers.GetMethodsWithAttributeSafe<ReflectionTestAttribute>(null).Length
1685
+ );
1686
+ Assert.AreEqual(
1687
+ 0,
1688
+ ReflectionHelpers
1689
+ .GetPropertiesWithAttributeSafe<ReflectionTestAttribute>(null)
1690
+ .Length
1691
+ );
1692
+ Assert.AreEqual(
1693
+ 0,
1694
+ ReflectionHelpers.GetFieldsWithAttributeSafe<ReflectionTestAttribute>(null).Length
1695
+ );
1696
+ }
1697
+
1698
+ [Test]
1699
+ public void LoadStaticPropertiesForType()
1700
+ {
1701
+ Dictionary<string, PropertyInfo> staticProperties =
1702
+ ReflectionHelpers.LoadStaticPropertiesForType<TestPropertyClass>();
1703
+ Assert.IsNotNull(staticProperties);
1704
+
1705
+ // Note: This method looks for static properties that return the same type as the class
1706
+ // Our TestPropertyClass doesn't have static properties that return TestPropertyClass,
1707
+ // so the result should be empty, but the method should not throw
1708
+ Assert.IsNotNull(staticProperties);
1709
+ }
1710
+
1711
+ [Test]
1712
+ public void LoadStaticFieldsForType()
1713
+ {
1714
+ Dictionary<string, FieldInfo> staticFields =
1715
+ ReflectionHelpers.LoadStaticFieldsForType<TestPropertyClass>();
1716
+ Assert.IsNotNull(staticFields);
1717
+
1718
+ // Note: This method looks for static fields that are of the same type as the class
1719
+ // Our TestPropertyClass doesn't have such fields, so the result should be empty,
1720
+ // but the method should not throw
1721
+ Assert.IsNotNull(staticFields);
1722
+ }
1723
+
1724
+ [Test]
1725
+ public void IsAttributeDefined()
1726
+ {
1727
+ Type testType = typeof(TestAttributeClass);
1728
+ FieldInfo testField = testType.GetField(
1729
+ nameof(TestAttributeClass.instanceFieldWithAttribute)
1730
+ );
1731
+
1732
+ // Test the extension method version
1733
+ Assert.IsTrue(testType.IsAttributeDefined(out ReflectionTestAttribute typeAttr));
1734
+ Assert.IsNotNull(typeAttr);
1735
+ Assert.AreEqual("ClassLevel", typeAttr.Name);
1736
+ Assert.AreEqual(10, typeAttr.Value);
1737
+
1738
+ Assert.IsTrue(testField.IsAttributeDefined(out ReflectionTestAttribute fieldAttr));
1739
+ Assert.IsNotNull(fieldAttr);
1740
+ Assert.AreEqual("InstanceField", fieldAttr.Name);
1741
+ Assert.AreEqual(5, fieldAttr.Value);
1742
+
1743
+ // Test with type that doesn't have the attribute
1744
+ Type methodType = typeof(TestMethodClass);
1745
+ Assert.IsFalse(methodType.IsAttributeDefined(out ReflectionTestAttribute noAttr));
1746
+ Assert.IsNull(noAttr);
1747
+ }
1748
+
1749
+ [Test]
1750
+ public void PropertySetterThrowsOnReadOnly()
1751
+ {
1752
+ PropertyInfo ro = typeof(TestPropertyClass).GetProperty(
1753
+ nameof(TestPropertyClass.InstanceReadOnlyProperty)
1754
+ );
1755
+ Assert.Throws<ArgumentException>(() => ReflectionHelpers.GetPropertySetter(ro));
1756
+ Assert.Throws<ArgumentException>(() =>
1757
+ ReflectionHelpers.GetPropertySetter<TestPropertyClass, int>(ro)
1758
+ );
1759
+ }
1760
+
1761
+ [Test]
1762
+ public void StaticPropertySetterThrowsOnInstanceProperty()
1763
+ {
1764
+ PropertyInfo pi = typeof(TestPropertyClass).GetProperty(
1765
+ nameof(TestPropertyClass.InstanceProperty)
1766
+ );
1767
+ Assert.Throws<ArgumentException>(() =>
1768
+ ReflectionHelpers.GetStaticPropertySetter<int>(pi)
1769
+ );
1770
+ }
1771
+
1772
+ [Test]
1773
+ public void IndexerHelpersThrowOnNonIndexer()
1774
+ {
1775
+ PropertyInfo pi = typeof(TestPropertyClass).GetProperty(
1776
+ nameof(TestPropertyClass.InstanceProperty)
1777
+ );
1778
+ Assert.Throws<ArgumentException>(() => ReflectionHelpers.GetIndexerGetter(pi));
1779
+ Assert.Throws<ArgumentException>(() => ReflectionHelpers.GetIndexerSetter(pi));
1780
+ }
1781
+
1782
+ [Test]
1783
+ public void TypedPropertyGetterStaticIgnoresInstance()
1784
+ {
1785
+ PropertyInfo spi = typeof(TestPropertyClass).GetProperty(
1786
+ nameof(TestPropertyClass.StaticProperty)
1787
+ );
1788
+ Action<int> setter = ReflectionHelpers.GetStaticPropertySetter<int>(spi);
1789
+ setter(777);
1790
+ Func<TestPropertyClass, int> getter = ReflectionHelpers.GetPropertyGetter<
1791
+ TestPropertyClass,
1792
+ int
1793
+ >(spi);
1794
+ TestPropertyClass dummy = new();
1795
+ Assert.AreEqual(777, getter(dummy));
1796
+ }
1797
+
1798
+ [Test]
1799
+ public void TypedStaticInvokerWrongReturnTypeThrows()
1800
+ {
1801
+ MethodInfo m0 = typeof(TestMethodClass).GetMethod(
1802
+ nameof(TestMethodClass.StaticIntMethod)
1803
+ );
1804
+ Assert.Throws<ArgumentException>(() =>
1805
+ ReflectionHelpers.GetStaticMethodInvoker<string>(m0)
1806
+ );
1807
+ }
1808
+
1809
+ [Test]
1810
+ public void TypedInstanceInvokerWrongInstanceTypeThrows()
1811
+ {
1812
+ MethodInfo mi = typeof(TestMethodClass).GetMethod(
1813
+ nameof(TestMethodClass.InstanceIntMethod)
1814
+ );
1815
+ Assert.Throws<ArgumentException>(() =>
1816
+ ReflectionHelpers.GetInstanceMethodInvoker<string, int>(mi)
1817
+ );
1818
+ }
1819
+
1820
+ [Test]
1821
+ public void ValueTypeInstanceTypedInvoker()
1822
+ {
1823
+ MethodInfo mi = typeof(ValueStruct).GetMethod(nameof(ValueStruct.Sum));
1824
+ Func<ValueStruct, int, int, int> inv = ReflectionHelpers.GetInstanceMethodInvoker<
1825
+ ValueStruct,
1826
+ int,
1827
+ int,
1828
+ int
1829
+ >(mi);
1830
+ ValueStruct vs = new() { x = 1, y = 2 };
1831
+ Assert.AreEqual(1 + 2 + 1 + 2, inv(vs, 1, 2));
1832
+ }
1833
+
1834
+ [Test]
1835
+ public void HashSetAdderTypeMismatchThrows()
1836
+ {
1837
+ object set = ReflectionHelpers.CreateHashSet(typeof(int), 0);
1838
+ Action<object, object> add = ReflectionHelpers.GetHashSetAdder(typeof(int));
1839
+ Assert.Throws<InvalidCastException>(() => add(set, "oops"));
1840
+ }
1841
+
1842
+ [Test]
1843
+ public void ArrayCreatorNegativeLengthThrows()
1844
+ {
1845
+ Func<int, Array> makeObj = ReflectionHelpers.GetArrayCreator(typeof(int));
1846
+ Assert.Throws<OverflowException>(() => makeObj(-1));
1847
+ Func<int, int[]> makeT = ReflectionHelpers.GetArrayCreator<int>();
1848
+ Assert.Throws<OverflowException>(() => makeT(-1));
1849
+ }
1850
+
1851
+ [Test]
1852
+ public void LoadStaticFieldsAndPropertiesForType()
1853
+ {
1854
+ Dictionary<string, FieldInfo> fields =
1855
+ ReflectionHelpers.LoadStaticFieldsForType<SelfReferentialType>();
1856
+ Dictionary<string, PropertyInfo> props =
1857
+ ReflectionHelpers.LoadStaticPropertiesForType<SelfReferentialType>();
1858
+ Assert.IsTrue(fields.ContainsKey(nameof(SelfReferentialType.InstanceField)));
1859
+ Assert.IsTrue(fields.ContainsKey(nameof(SelfReferentialType.InstanceField).ToLower()));
1860
+ Assert.IsTrue(props.ContainsKey(nameof(SelfReferentialType.InstanceProperty)));
1861
+ Assert.IsTrue(
1862
+ props.ContainsKey(nameof(SelfReferentialType.InstanceProperty).ToLower())
1863
+ );
1864
+ }
1865
+
1866
+ [Test]
1867
+ public void IndexerSetterInvalidIndexTypeThrows()
1868
+ {
1869
+ PropertyInfo idx = typeof(IndexerClass).GetProperty("Item");
1870
+ Action<object, object, object[]> setter = ReflectionHelpers.GetIndexerSetter(idx);
1871
+ IndexerClass obj = new();
1872
+ Assert.Throws<InvalidCastException>(() => setter(obj, 3, new object[] { "notInt" }));
1873
+ }
1874
+
1875
+ [Test]
1876
+ public void StaticActionInvokerThrowsOnNonStatic()
1877
+ {
1878
+ MethodInfo m = typeof(TestMethodClass).GetMethod(
1879
+ nameof(TestMethodClass.InstanceVoidMethod)
1880
+ );
1881
+ Assert.Throws<ArgumentException>(() => ReflectionHelpers.GetStaticActionInvoker(m));
1882
+ }
1883
+
1884
+ [Test]
1885
+ public void TypedPropertySetters()
1886
+ {
1887
+ PropertyInfo pi = typeof(TestPropertyClass).GetProperty(
1888
+ nameof(TestPropertyClass.InstanceProperty)
1889
+ );
1890
+ Action<TestPropertyClass, int> set = ReflectionHelpers.GetPropertySetter<
1891
+ TestPropertyClass,
1892
+ int
1893
+ >(pi);
1894
+ TestPropertyClass obj = new();
1895
+ set(obj, 123);
1896
+ Assert.AreEqual(123, obj.InstanceProperty);
1897
+
1898
+ PropertyInfo spi = typeof(TestPropertyClass).GetProperty(
1899
+ nameof(TestPropertyClass.StaticProperty)
1900
+ );
1901
+ Action<int> sset = ReflectionHelpers.GetStaticPropertySetter<int>(spi);
1902
+ sset(456);
1903
+ Assert.AreEqual(456, TestPropertyClass.StaticProperty);
1904
+ }
1905
+
1906
+ [Test]
1907
+ public void TypedStaticMethodInvokersFuncAndAction()
1908
+ {
1909
+ MethodInfo m0 = typeof(TestMethodClass).GetMethod(
1910
+ nameof(TestMethodClass.StaticIntMethod)
1911
+ );
1912
+ Func<int> f0 = ReflectionHelpers.GetStaticMethodInvoker<int>(m0);
1913
+ Assert.AreEqual(42, f0());
1914
+
1915
+ MethodInfo m1 = typeof(TestMethodClass).GetMethod(
1916
+ nameof(TestMethodClass.StaticMethodWithParam)
1917
+ );
1918
+ Func<int, int> f1 = ReflectionHelpers.GetStaticMethodInvoker<int, int>(m1);
1919
+ Assert.AreEqual(10, f1(5));
1920
+
1921
+ MethodInfo m3 = typeof(TestMethodClass).GetMethod(
1922
+ nameof(TestMethodClass.StaticMethodMultipleParams)
1923
+ );
1924
+ Func<int, string, bool, int> f3 = ReflectionHelpers.GetStaticMethodInvoker<
1925
+ int,
1926
+ string,
1927
+ bool,
1928
+ int
1929
+ >(m3);
1930
+ Assert.AreEqual(1 + 3 + 1, f3(1, "hey", true));
1931
+
1932
+ MethodInfo m4 = typeof(TestMethodClass).GetMethod(
1933
+ nameof(TestMethodClass.StaticMethodFourParams)
1934
+ );
1935
+ Func<int, int, int, int, int> f4 = ReflectionHelpers.GetStaticMethodInvoker<
1936
+ int,
1937
+ int,
1938
+ int,
1939
+ int,
1940
+ int
1941
+ >(m4);
1942
+ Assert.AreEqual(10, f4(1, 2, 3, 4));
1943
+
1944
+ MethodInfo a0 = typeof(TestMethodClass).GetMethod(
1945
+ nameof(TestMethodClass.StaticVoidMethod)
1946
+ );
1947
+ TestMethodClass.StaticMethodCallCount = 0;
1948
+ Action a0i = ReflectionHelpers.GetStaticActionInvoker(a0);
1949
+ a0i();
1950
+ Assert.AreEqual(1, TestMethodClass.StaticMethodCallCount);
1951
+
1952
+ MethodInfo a3 = typeof(TestMethodClass).GetMethod(
1953
+ nameof(TestMethodClass.StaticActionThree)
1954
+ );
1955
+ Action<int, int, int> a3i = ReflectionHelpers.GetStaticActionInvoker<int, int, int>(a3);
1956
+ a3i(1, 2, 3);
1957
+ Assert.AreEqual(6, TestMethodClass.StaticMethodCallCount);
1958
+ }
1959
+
1960
+ [Test]
1961
+ public void TypedInstanceMethodInvokersFuncAndAction()
1962
+ {
1963
+ TestMethodClass o = new();
1964
+ o.Reset();
1965
+
1966
+ MethodInfo i0 = typeof(TestMethodClass).GetMethod(
1967
+ nameof(TestMethodClass.InstanceIntMethod)
1968
+ );
1969
+ Func<TestMethodClass, int> fi0 = ReflectionHelpers.GetInstanceMethodInvoker<
1970
+ TestMethodClass,
1971
+ int
1972
+ >(i0);
1973
+ Assert.AreEqual(100, fi0(o));
1974
+ Assert.AreEqual(1, o.instanceMethodCallCount);
1975
+
1976
+ MethodInfo i1 = typeof(TestMethodClass).GetMethod(
1977
+ nameof(TestMethodClass.InstanceMethodWithParam)
1978
+ );
1979
+ Func<TestMethodClass, string, int> fi1 = ReflectionHelpers.GetInstanceMethodInvoker<
1980
+ TestMethodClass,
1981
+ string,
1982
+ int
1983
+ >(i1);
1984
+ Assert.AreEqual(4, fi1(o, "four"));
1985
+
1986
+ MethodInfo i2 = typeof(TestMethodClass).GetMethod(nameof(TestMethodClass.InstanceSum));
1987
+ Func<TestMethodClass, int, int, int> fi2 = ReflectionHelpers.GetInstanceMethodInvoker<
1988
+ TestMethodClass,
1989
+ int,
1990
+ int,
1991
+ int
1992
+ >(i2);
1993
+ Assert.AreEqual(7, fi2(o, 3, 4));
1994
+
1995
+ MethodInfo ia3 = typeof(TestMethodClass).GetMethod(
1996
+ nameof(TestMethodClass.InstanceSetThree)
1997
+ );
1998
+ Action<TestMethodClass, int, int, int> ai3 = ReflectionHelpers.GetInstanceActionInvoker<
1999
+ TestMethodClass,
2000
+ int,
2001
+ int,
2002
+ int
2003
+ >(ia3);
2004
+ ai3(o, 1, 2, 3);
2005
+ Assert.AreEqual(6, o.instanceMethodCallCount);
2006
+
2007
+ MethodInfo i4 = typeof(TestMethodClass).GetMethod(
2008
+ nameof(TestMethodClass.InstanceSumFour)
2009
+ );
2010
+ Func<TestMethodClass, int, int, int, int, int> fi4 =
2011
+ ReflectionHelpers.GetInstanceMethodInvoker<
2012
+ TestMethodClass,
2013
+ int,
2014
+ int,
2015
+ int,
2016
+ int,
2017
+ int
2018
+ >(i4);
2019
+ Assert.AreEqual(10, fi4(o, 1, 2, 3, 4));
2020
+ }
2021
+
2022
+ [Test]
2023
+ public void RefOutTypedInvokersThrow()
2024
+ {
2025
+ MethodInfo refm = typeof(RefOutMethods).GetMethod(nameof(RefOutMethods.RefInc));
2026
+ Assert.Throws<NotSupportedException>(() =>
2027
+ ReflectionHelpers.GetStaticActionInvoker<int>(refm)
2028
+ );
2029
+
2030
+ MethodInfo outm = typeof(RefOutMethods).GetMethod(nameof(RefOutMethods.OutSet));
2031
+ Assert.Throws<NotSupportedException>(() =>
2032
+ ReflectionHelpers.GetStaticActionInvoker<int>(outm)
2033
+ );
2034
+ }
2035
+
2036
+ [Test]
2037
+ public void IndexerGetterAndSetter()
2038
+ {
2039
+ PropertyInfo idxProp = typeof(IndexerClass).GetProperty("Item");
2040
+ Func<object, object[], object> getter = ReflectionHelpers.GetIndexerGetter(idxProp);
2041
+ Action<object, object, object[]> setter = ReflectionHelpers.GetIndexerSetter(idxProp);
2042
+ IndexerClass obj = new();
2043
+ setter(obj, 5, new object[] { 2 });
2044
+ Assert.AreEqual(5, getter(obj, new object[] { 2 }));
2045
+ }
2046
+
2047
+ [Test]
2048
+ public void DictionaryCreators()
2049
+ {
2050
+ int capacity = 32;
2051
+ object dictObj = ReflectionHelpers.CreateDictionary(
2052
+ typeof(int),
2053
+ typeof(string),
2054
+ capacity
2055
+ );
2056
+ Assert.IsInstanceOf<Dictionary<int, string>>(dictObj);
2057
+ Func<int, Dictionary<int, string>> typed = ReflectionHelpers.GetDictionaryCreator<
2058
+ int,
2059
+ string
2060
+ >();
2061
+ Dictionary<int, string> d2 = typed(capacity);
2062
+ Assert.IsNotNull(d2);
2063
+ Assert.AreEqual(0, d2.Count);
2064
+ }
2065
+
2066
+ [Test]
2067
+ public void TypedCollectionCreators()
2068
+ {
2069
+ Func<int, int[]> makeArray = ReflectionHelpers.GetArrayCreator<int>();
2070
+ int[] arr = makeArray(5);
2071
+ Assert.AreEqual(5, arr.Length);
2072
+
2073
+ Func<IList> makeList = ReflectionHelpers.GetListCreator<string>();
2074
+ IList list = makeList();
2075
+ Assert.IsInstanceOf<List<string>>(list);
2076
+
2077
+ Func<int, IList> makeListCap = ReflectionHelpers.GetListWithCapacityCreator<float>();
2078
+ IList listCap = makeListCap(16);
2079
+ Assert.IsInstanceOf<List<float>>(listCap);
2080
+ Assert.AreEqual(16, ((List<float>)listCap).Capacity);
2081
+
2082
+ Func<int, HashSet<int>> makeSet =
2083
+ ReflectionHelpers.GetHashSetWithCapacityCreator<int>();
2084
+ HashSet<int> set = makeSet(8);
2085
+ Action<HashSet<int>, int> add = ReflectionHelpers.GetHashSetAdder<int>();
2086
+ add(set, 3);
2087
+ add(set, 3);
2088
+ add(set, 4);
2089
+ Assert.IsTrue(set.Contains(3));
2090
+ Assert.IsTrue(set.Contains(4));
2091
+ Assert.AreEqual(2, set.Count);
2092
+ }
2093
+
2094
+ [Test]
2095
+ public void IsActiveAndEnabledChecksGameObjectState()
2096
+ {
2097
+ GameObject go = new("probe2");
2098
+ try
2099
+ {
2100
+ EnabledProbe probe = go.AddComponent<EnabledProbe>();
2101
+ go.SetActive(false);
2102
+ Assert.IsFalse(probe.IsActiveAndEnabled());
2103
+ go.SetActive(true);
2104
+ probe.enabled = true;
2105
+ Assert.IsTrue(probe.IsActiveAndEnabled());
2106
+ probe.enabled = false;
2107
+ Assert.IsFalse(probe.IsActiveAndEnabled());
2108
+ }
2109
+ finally
2110
+ {
2111
+ UnityEngine.Object.DestroyImmediate(go);
2112
+ }
2113
+ }
2114
+
2115
+ [Test]
2116
+ public void InvokeInstanceVoidMethod()
2117
+ {
2118
+ TestMethodClass obj = new();
2119
+ MethodInfo m = typeof(TestMethodClass).GetMethod(
2120
+ nameof(TestMethodClass.InstanceVoidMethod)
2121
+ );
2122
+ object result = ReflectionHelpers.InvokeMethod(m, obj);
2123
+ Assert.IsNull(result);
2124
+ Assert.AreEqual(1, obj.instanceMethodCallCount);
2125
+ }
2126
+
2127
+ [Test]
2128
+ public void InvokeInstanceMethodWithReturnValue()
2129
+ {
2130
+ TestMethodClass obj = new();
2131
+ MethodInfo m = typeof(TestMethodClass).GetMethod(
2132
+ nameof(TestMethodClass.InstanceStringMethod)
2133
+ );
2134
+ object result = ReflectionHelpers.InvokeMethod(m, obj);
2135
+ Assert.AreEqual("instance", result);
2136
+ }
2137
+
2138
+ [Test]
2139
+ public void InvokeInstanceMethodWithParameters()
2140
+ {
2141
+ TestMethodClass obj = new();
2142
+ MethodInfo m = typeof(TestMethodClass).GetMethod(
2143
+ nameof(TestMethodClass.InstanceMethodWithParam)
2144
+ );
2145
+ object result = ReflectionHelpers.InvokeMethod(m, obj, "hello");
2146
+ Assert.AreEqual(5, result);
2147
+ }
2148
+
2149
+ [Test]
2150
+ public void BoxedSetterOnStructDoesNotMutateOriginal()
2151
+ {
2152
+ FieldInfo field = typeof(TestStruct).GetField(nameof(TestStruct.intValue));
2153
+ Action<object, object> setter = ReflectionHelpers.GetFieldSetter(field);
2154
+ TestStruct s = default;
2155
+ setter(s, 99);
2156
+ Assert.AreEqual(0, s.intValue);
2157
+ }
2158
+
2159
+ [Test]
2160
+ public void GenericParameterlessConstructorThrowsOnMissing()
2161
+ {
2162
+ Assert.Throws<ArgumentException>(() =>
2163
+ ReflectionHelpers.GetParameterlessConstructor<NoParameterlessCtor>()
2164
+ );
2165
+ }
2166
+
2167
+ [Test]
2168
+ public void GenericParameterlessConstructorWorks()
2169
+ {
2170
+ Func<List<int>> ctor = ReflectionHelpers.GetParameterlessConstructor<List<int>>();
2171
+ List<int> list = ctor();
2172
+ Assert.IsInstanceOf<List<int>>(list);
2173
+ }
2174
+
2175
+ [Test]
2176
+ public void DictionaryWithCapacityCreator()
2177
+ {
2178
+ Func<int, Dictionary<int, string>> creator = ReflectionHelpers.GetDictionaryCreator<
2179
+ int,
2180
+ string
2181
+ >();
2182
+ Dictionary<int, string> d = creator(16);
2183
+ Assert.IsInstanceOf<Dictionary<int, string>>(d);
2184
+ d[1] = "a";
2185
+ Assert.AreEqual("a", d[1]);
2186
+ }
2187
+
2188
+ [Test]
2189
+ public void IndexerGetterSetterWrongIndexLengthThrows()
2190
+ {
2191
+ PropertyInfo prop = typeof(IndexerClass).GetProperty("Item");
2192
+ Func<object, object[], object> getter = ReflectionHelpers.GetIndexerGetter(prop);
2193
+ Action<object, object, object[]> setter = ReflectionHelpers.GetIndexerSetter(prop);
2194
+ IndexerClass obj = new();
2195
+ Assert.Throws<IndexOutOfRangeException>(() => getter(obj, new object[] { }));
2196
+ Assert.Throws<IndexOutOfRangeException>(() => setter(obj, 1, new object[] { }));
2197
+ }
2198
+ }
2199
+ }