You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request significantly expands the unit test coverage for the FastBuffer and related classes, focusing on verifying the correct behavior of record boxing, caching, publishing, and event raising logic. The new tests ensure that internal optimizations (such as caching boxed interaction records) and event notification mechanisms are robust and not accidentally broken by future changes. Additionally, the tests pin correct behavior for consuming method buffers when empty, guarding against regressions.
The most important changes are:
Caching and Boxing Behavior Tests
Added tests to verify that AppendBoxed and AppendBoxedUnverified methods on event and method buffers correctly cache and reuse boxed interaction records, preventing unnecessary allocations. These tests cover both event subscription/unsubscription and method invocation buffers of various arities.
Added a test to ensure that AppendBoxedUnverified on an unsubscribe buffer boxes records as EventUnsubscription, not EventSubscription, pinning the correct conditional logic.
Event Publishing and Raising Tests
Introduced a reusable helper and new tests to verify that AppendWithAccess on all indexer getter/setter buffer types publishes the interaction and raises the InteractionAdded event as expected, ensuring coverage for all indexer arities.
Buffer Consumption Edge Cases
Added tests to verify that calling ConsumeAll on empty method buffers (for arities 1 through 4) returns zero and does not throw, pinning correct loop bounds and guarding against null reference exceptions.
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
coverageAdditional tests for edge cases or improvement of test coveragestate: releasedThe issue is released
1 participant
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.
This pull request significantly expands the unit test coverage for the
FastBufferand related classes, focusing on verifying the correct behavior of record boxing, caching, publishing, and event raising logic. The new tests ensure that internal optimizations (such as caching boxed interaction records) and event notification mechanisms are robust and not accidentally broken by future changes. Additionally, the tests pin correct behavior for consuming method buffers when empty, guarding against regressions.The most important changes are:
Caching and Boxing Behavior Tests
AppendBoxedandAppendBoxedUnverifiedmethods on event and method buffers correctly cache and reuse boxed interaction records, preventing unnecessary allocations. These tests cover both event subscription/unsubscription and method invocation buffers of various arities.AppendBoxedUnverifiedon an unsubscribe buffer boxes records asEventUnsubscription, notEventSubscription, pinning the correct conditional logic.Event Publishing and Raising Tests
AppendWithAccesson all indexer getter/setter buffer types publishes the interaction and raises theInteractionAddedevent as expected, ensuring coverage for all indexer arities.Buffer Consumption Edge Cases
ConsumeAllon empty method buffers (for arities 1 through 4) returns zero and does not throw, pinning correct loop bounds and guarding against null reference exceptions.