Conversation
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/30a1e39c-5a31-4ad8-be5d-42701a4510eb Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/7192607d-2576-429f-ab7b-3f0ff07bc0cb Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
…e test to top Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/ba9d35c7-a7e7-49b3-917b-76df59dfd2e6 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
…range Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/b1f5a73d-a50d-4e17-bb50-0303cf16ef72 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
|
@copilot please fix build errors |
There was a problem hiding this comment.
Pull request overview
Adds an internal Cell<T> utility to represent an optionally-set value where null can still be a valid stored value (distinguishing “unset” vs “set to null”), plus unit tests validating the behavior.
Changes:
- Introduce
Cell<T>withStore,TryOpen, andOpenOrDefault. - Add tests for unset, set (non-null), set (
null), andOpenOrDefaultfallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| PowerKit/Cell.cs | Adds the Cell<T> container implementation with set/open APIs. |
| PowerKit.Tests/CellTests.cs | Adds unit tests covering the new Cell<T> behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| [Fact] | ||
| public void OpenOrDefault_Unset_Test() |
There was a problem hiding this comment.
There are two test methods with the same name/signature OpenOrDefault_Unset_Test in this file, which will cause a compile-time error. Rename the second one (the one that stores null) to a distinct name that reflects the scenario (e.g., OpenOrDefault_Null_Test).
| public void OpenOrDefault_Unset_Test() | |
| public void OpenOrDefault_Null_Test() |
…efault_Null_Test) Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/2eacd487-83e7-4da3-8f07-7cd178a593c9 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Ports
Box<T>from Gress asCell<T>— a generic container for a value that may or may not be set. UnlikeNullable<T>, it treatsnullas a valid stored value, distinguishing "no value" from "value is null".Changes
PowerKit/Cell.cs— internalCell<T>withStore(T value),TryOpen(out T value) → bool, andOpenOrDefault(T defaultValue = default!) → TPowerKit.Tests/CellTests.cs— covers unset, set non-null, set null, andOpenOrDefaultcases