Commit 61731fc
Adding tests for filewatcher sources (#1)
* Adding tests for filewatcher sources
* Improve FileWatcher test robustness and resource management
Address code review feedback from PR #1 with the following improvements:
**Resource Management:**
- Add `using` declarations to all test methods for proper disposal
- Implement try/finally blocks to ensure cleanup even on assertion failures
- Guarantee CancellationTokenSource cancellation and task awaiting in all paths
**Type Safety:**
- Replace string-based type exclusions with typeof() comparisons
- Add explicit Tekken8ReplayFileSource import for compile-time verification
**Pattern Discovery:**
- Support both ApplyDefaults(FileWatcherOptions) and ApplyDefaults(string?) overloads
- Throw InvalidOperationException when patterns cannot be retrieved
- Validate patterns in test data generation (fail-fast on missing configuration)
**Test Coverage:**
- Update AllDiscoveredSources_AreInstantiable to use DiscoverAllSources() directly
- Ensure all discovered sources are validated (no silent exclusions)
- Add explicit pattern validation for all sources except Tekken8
These changes ensure reliable test cleanup, prevent resource leaks, and
guarantee complete test coverage of all FileWatcher source implementations.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Fix PR review issues in FileWatcher tests
- Add explicit System.IO import to FileWatcherSourceDiscovery
- Fix constructor invocation to use Array.Empty<object>() instead of null
- Add test for sources without subdirectory support
Addresses Copilot PR review comments:
1. Missing namespace import for Path.GetTempPath()
2. Unused SourcesWithoutSubdirectories() test data method
3. Incorrect constructor invocation with null parameter
The new test gracefully handles sources with inconsistent subdirectory
configuration between ApplyDefaults and string constructors.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 5d09435 commit 61731fc
File tree
3 files changed
+1047
-0
lines changed- GamesDat.Tests
- Helpers
3 files changed
+1047
-0
lines changed
0 commit comments