Repository navigation
fix(hottesting): give mocked view models a messenger (backport #3214) - #3233
Merged
Merged
Conversation
- Create passed default! for every constructor parameter, so a model calling messenger.Observe(...) in its constructor threw ArgumentNullException and got no mock - Pass a fresh WeakReferenceMessenger for a parameter typed CommunityToolkit.Mvvm.Messaging.IMessenger, matched by symbol; typed default otherwise - Nothing naming the toolkit is emitted when the compilation does not reference it - Fixture NoteModel observes a state on its messenger; the mocked input reaches a derived feed - Generator tests pin the emitted argument and a same-named IMessenger left null-injected Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 6f64983)
- rules.md (MOCK0001) and testing.md no longer say every parameter is null-injected - Spec 013 architecture notes the messenger argument; history gains a v18 entry Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 6c0fa99)
- a parameter typed IMessenger? also gets a fresh messenger, cast to IMessenger - the messenger test no longer claims a state input's own value is not swapped, which stops being true once state inputs are swapped where they are read Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 30273af)
- spec 013 architecture and history v18: Create passes typed defaults, and the R1 guard on CtorDependency(Eager=true) is still not built, so other eager parameters still throw - rules.md and testing.md: the messenger goes to a parameter typed IMessenger Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit df3d180)
- Run() references CommunityToolkit.Mvvm only when a test opts in, so the generator tests stand for a consumer without the toolkit again - a compilation without the toolkit, even with its own IMessenger, gets a mock that names nothing from it - the messenger tests opt in Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit cb09b09)
- spec 013 architecture and history v18: the messenger is a stopgap until R1, not a list of known types; R1 can make a fresh messenger the default of an IMessenger argument - the generator's CtorArgument says not to add other known types - rules.md and testing.md: every parameter typed CommunityToolkit.Mvvm.Messaging.IMessenger Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 12a633a)
2 of 4 tasks
rajamatt
approved these changes
Oct 14, 2026
rajamatt
enabled auto-merge
October 14, 2026 18:59
Author
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Closed
1 task done
Merged
1 task done
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.
GitHub Issue (If applicable): related to https://github.com/unoplatform/studio.live/issues/4074
PR Type
What is the current behavior?
{Vm}Mock.Createpasses a typeddefault!for every constructor parameter. The MVUX messaging pattern observes a messenger in the model's constructor (messenger.Observe(Items, x => x.Id)), so for such a modelCreatethrowsArgumentNullException(parametermessenger) fromIMessengerExtensions.Register, and the model gets no mock at all.What is the new behavior?
Createpasses a freshWeakReferenceMessengerfor a constructor parameter typedCommunityToolkit.Mvvm.Messaging.IMessenger, matched by symbol. Every other parameter keeps its typed default.WeakReferenceMessengeris what the messaging docs register;Observecreates is owned by the state, so it goes away with the view-model.Reviewer's guide
FeedsMockGenerator.CtorArgument.Given_GeneratedMock.When_ModelObservesAMessengerInItsCtor_Then_CreateSucceedsAndInputFlowsfails onmainwith theArgumentNullException;Given_FeedsMockGenerator.When_CtorTakesAMessenger_Then_CreatePassesAFreshOnepins the emitted argument;When_CtorTakesAnotherTypeNamedIMessenger_Then_CreateNullInjectsItguards the match by symbol, not by name.MockingAppfixture now references Messaging, andUno.HotTesting.Reactive.Testsreferences CommunityToolkit.Mvvm.rules.md,testing.md, and spec 013 (architecture, history v18).main, a mocked state input isn't swapped on the state itself. That is a separate fix.PR Checklist
Uno.Extensions.Reactive.Tests, 1470 pass, 19 skipped;Uno.HotTesting.Reactive.Tests, 36 pass).Other information
servicing/7.4, so the backport should be clean.ILogger<T>→NullLogger<T>.Instance.🤖 Generated with Claude Code
This is an automatic backport of pull request #3214 done by [Mergify](https://mergify.com).