Repository navigation
Add CollectSFData.Tests unit test project and run it in CI - #185
Draft
Jason Gilbertson (jagilber) wants to merge 8 commits into
Draft
Jason Gilbertson (jagilber) wants to merge 8 commits into
Jason Gilbertson (jagilber) wants to merge 8 commits into
Conversation
- Add comprehensive testing roadmap (TESTING_ROADMAP.md) - Create CollectSFData.Tests project with multi-target framework support (net462;net48;net6.0;net8.0) - Implement 10 baseline unit tests for ConfigurationOptions class: * ConvertToUtcTime method (valid/invalid formats) * GatherType property behavior and FileType normalization * CleanTableName behavior via destination validation - Add test dependencies: xUnit, FluentAssertions, Coverlet coverage collector - Configure legacy framework compatibility (C# 7.3, conditional features) - Tests passing on modern frameworks (net6.0, net8.0) - Document known issue: strong name verification failures on legacy frameworks Establishes foundation for progressive test coverage improvement per roadmap phases.
…tions - Implemented tests for FileManagerProcess to validate handling of null file objects and unknown file data types. - Added Phase4BasicAPIValidationTests to ensure correct behavior of API-related configurations and file object collections. - Created SerializationTests to verify CSV and JSON serialization logic, including size constraints and segment splitting. - Developed TestAuditFixture for lightweight audit metadata generation during test runs. - Introduced TimeValidationTests to validate time-related configurations and edge cases. - Added UploadConfigurationTests to check upload configuration scenarios. - Established IFileSystemAbstraction and ITimeProvider interfaces for better dependency injection and testing. - Created TestableConfigurationOptions to facilitate testing with mockable dependencies.
Drop the personal MCP server config, session logs, and learn-candidate capture that were committed alongside the test project. Move the testing roadmap under docs/, keep only the test project entry in the solution, and ignore IDE .lscache files. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ITimeProvider, IFileSystemAbstraction and TestableConfigurationOptions are used only by the test project, so keep them out of the shipped assembly and NuGet package. The only production changes left are making ConfigurationOptions.ConvertToUtcTime virtual and a null guard in FileManager.PopulateCollection. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
TestAuditFixture now writes nothing unless COLLECTSFDATA_TEST_AUDIT=1 is set, and no longer records machine or user names. Remove an unused field and variable and replace a blocking Task.Wait in an async test. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Add a dotnet test step after the build that runs CollectSFData.Tests on net8.0 and net48 in Release using the repository runsettings. Document the CI test step and the opt-in test audit output. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The test project never compiled for net462 or net48: TestAuditFixture uses nullable annotations and C# 8 syntax that the full-framework LangVersion 7.3 pin rejected. Target one full-framework and one modern runtime, enable the same language settings for both, add the System.Text.Json reference net48 needs, and annotate the moved helper types for nullable analysis. Give the synthetic CSV test file a directory path: a bare name makes FileObject call Path.GetDirectoryName on an empty string after compression, which throws on .NET Framework but not on .NET. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
CollectSFData.TestsxUnit project (101 tests) and runs it in CI after the build. The repository previously had no unit tests.Shipped code changes are limited to two lines in
CollectSFDataDll:ConfigurationOptions.ConvertToUtcTimeis nowvirtualso tests can inject time.FileManager.PopulateCollectionthrowsArgumentNullExceptionfor a null file object instead of aNullReferenceException.What is in the test project
ITimeProvider,IFileSystemAbstraction,TestableConfigurationOptions) live in the test project, not the shipped assembly.net48andnet8.0: one full-framework and one modern runtime forCollectSFDataDll, which targets net462/net48/net6.0/net8.0.CollectSFData.Tests.runsettingsdisables parallelism and AppDomain reuse to avoid file-lock flakiness;docs/contributing.mdexplains how to run locally.test-audits/folder only whenCOLLECTSFDATA_TEST_AUDIT=1is set. It records no machine or user names.CI
workflow.ymlgains adotnet teststep after the build that runs the project on net8.0 and net48 in Release. A test failure fails the run. Triggers and permissions are unchanged from #183.Verification
dotnet test -c Releaselocally: 101 passed on net8.0 and 101 passed on net48, no build warnings.node --test .github/tests/release-policy.test.cjs: 17 passed.actionlinton the workflow: clean.Notes for reviewers
docs/testing-roadmap.mdis the phase plan this work follows; later phases are not part of this PR.FileObject.ExtractNodeNamecallsPath.GetDirectoryNameon an empty string for a bare file name with a.zipextension, which throws on .NET Framework. Real blob URIs always contain directories, so the test now uses one.FileManager.SerializeCsvalso trims the file name withTrimEnd(".csv".ToCharArray()), which strips trailingc,s,vand.characters from the base name (for examplesyntheticbecomessyntheti). Both could be hardened in a follow-up.🤖 Generated with Claude Code