test: add AAAT unit tests for GeneralUpdate.Core uncovered areas - #430
Merged
Conversation
- Add ObjectTranslatorTests: GetPacketHash with tracing on/off, null, type checks - Add RandomRetryPolicyTests: SignalR retry within/after 60s window, distribution - Add VersionModelTests: VersionInfo/VersionOSS/BaseResponseDTO JSON round-trip - Extend ProcessInfoTests: encoding variants, optional params, default ctor, blacklist - Refactor EventManagerTests: add IDisposable TearDown for singleton isolation - Refactor EventListenerTests/EventListenerBatchTests/EventManagerConcurrencyTests: same pattern All 674 tests pass (0 failures).
Contributor
There was a problem hiding this comment.
Pull request overview
Adds AAAT-style unit tests to increase coverage of previously uncovered areas in GeneralUpdate.Core, plus refactors several event-related tests to use consistent per-test teardown for singleton state.
Changes:
- Added new unit test suites for
RandomRetryPolicy,ObjectTranslator.GetPacketHash, and configuration DTO/model JSON behavior. - Expanded
ProcessInfotests to cover additional constructor scenarios (encodings, optional params, defaults, blacklist params). - Refactored multiple event tests to use
IDisposableteardown to clearEventManagersingleton state after each test.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/CoreTest/Hubs/RandomRetryPolicyTests.cs | New tests covering retry delay behavior and boundaries for RandomRetryPolicy. |
| tests/CoreTest/Configuration/ObjectTranslatorTests.cs | New tests covering ObjectTranslator.GetPacketHash behavior under tracing on/off and input variants. |
| tests/CoreTest/Configuration/VersionModelTests.cs | New tests covering JSON round-trips and defaults for version/config DTOs. |
| tests/CoreTest/Event/EventManagerTests.cs | Converted to AAAT style and added IDisposable teardown to clear singleton state. |
| tests/CoreTest/Event/EventManagerConcurrencyTests.cs | Added IDisposable teardown and simplified cleanup relying on Clear(). |
| tests/CoreTest/Event/EventListenerTests.cs | Added IDisposable teardown to clear singleton state for isolation. |
| tests/CoreTest/Event/EventListenerBatchTests.cs | Added AAAT structure and IDisposable teardown; simplified manual cleanup. |
| tests/CoreTest/Configuration/ProcessInfoTests.cs | Added additional constructor tests for encodings, defaults, nullable params, multi-version inputs, and blacklist lists. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+31
to
+35
| Assert.NotNull(delay); | ||
| Assert.True(delay >= TimeSpan.Zero, | ||
| $"Expected delay >= 0, but got {delay}"); | ||
| Assert.True(delay <= TimeSpan.FromSeconds(10), | ||
| $"Expected delay <= 10 seconds, but got {delay?.TotalSeconds}s"); |
Comment on lines
+53
to
+56
| Assert.NotNull(delay); | ||
| Assert.True(delay >= TimeSpan.Zero); | ||
| Assert.True(delay <= TimeSpan.FromSeconds(10)); | ||
| } |
Comment on lines
+72
to
+75
| // Assert | ||
| Assert.NotNull(delay); | ||
| Assert.True(delay <= TimeSpan.FromSeconds(10)); | ||
| } |
Comment on lines
+183
to
+186
| // Assert | ||
| Assert.NotNull(delay); | ||
| Assert.True(delay <= TimeSpan.FromSeconds(10)); | ||
| } |
Comment on lines
+13
to
+18
| [Fact] | ||
| public void GetPacketHash_ValidVersionInfo_ReturnsFormattedHash() | ||
| { | ||
| // Arrange | ||
| GeneralTracer.SetTracingEnabled(true); | ||
| var version = new VersionInfo { Hash = "abc123def" }; |
Comment on lines
106
to
110
| Task.WaitAll(tasks); | ||
|
|
||
| // Assert — no exceptions thrown during concurrent operations | ||
| Assert.True(true); | ||
| } |
Comment on lines
+270
to
+276
|
|
||
| /// <summary>TearDown: cleanup temp files if any were created.</summary> | ||
| private static void CleanupTempFile(string path) | ||
| { | ||
| try { if (File.Exists(path)) File.Delete(path); } | ||
| catch { /* best-effort */ } | ||
| } |
- RandomRetryPolicyTests: use delay!.Value instead of nullable comparison - ObjectTranslatorTests: add IDisposable to restore GeneralTracer global state - EventListenerBatchTests: replace Assert.True(true) with Record.Exception - ProcessInfoTests: remove unused CleanupTempFile helper
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.
Closes #429
Summary
Add comprehensive unit tests following the AAAT (Arrange-Act-Assert-TearDown) paradigm for previously uncovered areas in GeneralUpdate.Core.
New test files (3)
Modified test files (5)
Test Results
✅ 674/674 tests pass (0 failures, 0 errors)