Feature/24 fluent create observer pattern#54
Conversation
- PatternKit.Core.Behavioral.Observer.AsyncObserver<TEvent>: added comprehensive XML comments for delegates, members, and Builder, with remarks and exception tags to match Observer<TEvent> standard - PatternKit.Examples.ObserverDemo.EventHub<TEvent>: documented constructor, factory, subscribe methods, and Publish; documented UserEvent record parameters - PatternKit.Examples.ObserverDemo.ReactivePrimitives: documented PropertyChangedHub, ObservableVar<T>, and ObservableList<T> public APIs - PatternKit.Examples.ObserverDemo.ReactiveTransaction: documented enums, LineItem record, ReactiveTransaction and ProfileViewModel public APIs Build and tests verified locally: solution builds successfully; all tests pass. This ensures DocFX picks up consistent API docs across Observer classes and demos.
There was a problem hiding this comment.
Pull Request Overview
This PR adds a fluent observer pattern implementation with both synchronous and asynchronous variants. The implementation provides a typed, thread-safe event hub for publishing events to multiple subscribers with configurable error handling policies.
- Adds
Observer<TEvent>for synchronous event publishing with predicate-based filtering - Adds
AsyncObserver<TEvent>for asynchronous event handling withValueTask-based delegates - Implements reactive primitives (
ObservableVar,ObservableList,PropertyChangedHub) for building reactive applications
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/PatternKit.Tests/Behavioral/Observer/ObserverTests.cs | Test coverage for synchronous Observer pattern with various error handling scenarios |
| test/PatternKit.Tests/Behavioral/Observer/AsyncObserverTests.cs | Test coverage for asynchronous Observer pattern with async delegates |
| test/PatternKit.Examples.Tests/ObserverDemo/ReactiveViewModelTests.cs | Tests for reactive ViewModel example showing dependent properties |
| test/PatternKit.Examples.Tests/ObserverDemo/ReactiveTransactionTests.cs | Tests for reactive transaction example with complex discount calculations |
| src/PatternKit.Generators/packages.lock.json | Package lock file updates for build dependencies |
| src/PatternKit.Examples/ObserverDemo/SimpleEventHub.cs | Example event hub wrapper around Observer pattern |
| src/PatternKit.Examples/ObserverDemo/ReactiveTransaction.cs | Complex reactive transaction example with dependent properties |
| src/PatternKit.Examples/ObserverDemo/ReactivePrimitives.cs | Basic reactive primitives built on Observer pattern |
| src/PatternKit.Core/Behavioral/Observer/Observer.cs | Core synchronous Observer implementation with fluent builder |
| src/PatternKit.Core/Behavioral/Observer/AsyncObserver.cs | Core asynchronous Observer implementation |
| docs/patterns/toc.yml | Documentation table of contents updates |
| docs/patterns/behavioral/observer/observer.md | Documentation for synchronous Observer pattern |
| docs/patterns/behavioral/observer/asyncobserver.md | Documentation for asynchronous Observer pattern |
| docs/index.md | Main documentation index updates |
| docs/examples/toc.yml | Examples table of contents updates |
| docs/examples/reactive-viewmodel.md | Reactive ViewModel example documentation |
| docs/examples/reactive-transaction.md | Reactive transaction example documentation |
| docs/examples/observer-demo.md | Observer demo example documentation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Code Coverage |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #54 +/- ##
==========================================
+ Coverage 76.98% 84.52% +7.54%
==========================================
Files 55 60 +5
Lines 4206 4472 +266
Branches 636 678 +42
==========================================
+ Hits 3238 3780 +542
+ Misses 737 692 -45
+ Partials 231 0 -231
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.