Skip to content

Conversation

@magesoe
Copy link
Collaborator

@magesoe magesoe commented Sep 11, 2025

Added caching of the static parts of XrmMockup, such that each test can get its own instance with their own db.

This enables parallel execution

- Added a permissions structure to `settings.local.json` for specific Bash commands.
- Updated `CLAUDE.md` with project overview and removed outdated commands.
- Refactored `XrmMockup365` to utilize a static metadata cache for better performance.
- Introduced `StaticMetadataCache` in `Core.cs` for improved data handling.
- Modified `Core` constructor to accept the new cache, enabling metadata reuse.
- Implemented thread safety tests in `TestThreadSafety.cs` to ensure instance independence.
- Updated `settings.local.json` to add new commands for .NET project creation and timing tests.
- Marked a test in `TestTableReset.cs` to be skipped due to parallel execution issues.
- Refactored `UnitTestBase.cs`, `UnitTestBaseNoProxyTypes.cs`, and `UnitTestBaseNoReset.cs` to implement `IClassFixture`, improving test isolation and removing unnecessary environment reset logic.
- Deprecated `XrmMockupCollection` and `XrmMockupCollectionNoProxyTypes` as tests now run in parallel with individual instances.
- Introduced shared settings in `XrmMockupFixture.cs` and `XrmMockupFixtureNoProxyTypes.cs` to optimize metadata cache hits.
- Updated `XrmMockup365Test.csproj` to include `xunit.runner.json`, which is now copied to the output directory.
- Added a new `xunit.runner.json` file to configure parallel test execution settings for improved performance.
Copy link
Member

@mkholt mkholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, I have a few worries regarding the test-completeness around the instances, and also if this will break existing installations?

See comments

- Added `StaticMetadataCache` class to `DG.Tools.XrmMockup`.
- Removed old `StaticMetadataCache` definition from `Core.cs`.
- Updated condition in `BuildEntityTypeMap` method.
- Adjusted logical grouping for `preImage` check in `PluginTrigger.cs`.
- Removed deprecated test collections from `SharedTests.projitems`.
- Deleted `XrmmockupCollection` and `XrmmockupCollectionNoProxyTypes` classes.
- Modified test logic in `TestThreadSafety.cs` for static contact names.
Changed the condition to proceed only if usable assemblies
are available, improving the logic flow in the method.
- Updated assembly version and file version to "1.15.4".
- Changed `MainDict` in `DbTable` to `ConcurrentDictionary` for improved thread safety.
- Modified `Remove` method to use `TryRemove` for safe concurrent removal.
- Updated `GetEnumerator` to return a snapshot of values to avoid modification exceptions.
- Adjusted `Clone` method to maintain thread safety during cloning.
- Changed `RestoreSerializableDTO` to use `ConcurrentDictionary` for `MainDict`.
- Modified retrieval logic in `XrmDb` to create snapshots before concurrent modifications.
- Added new tests in `TestThreadSafety.cs` to validate concurrent operations and ensure thread safety.
@magesoe magesoe merged commit a59ea7b into master Sep 12, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants