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
make TaskKeyConverter public; update wiki docs for object keys and testing
- TaskKeyConverter.ToKey is now public so consumers can resolve keys in tests
- wiki/Testing.md: fix manual mock examples (string -> object), add TaskKeyConverter.ToKey section for store-level assertions, add object key example
- wiki/Migrating-to-v2.md: note TaskKeyConverter.ToKey is public
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: wiki/Migrating-to-v2.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,3 +52,4 @@ If you were calling these extension methods they will need updating to call the
52
52
53
53
-**Object task keys** — pass any type as a task key. Strings are unchanged; primitives, enums, `Guid`, `DateTime`, and other value types use `ToString()` prefixed with the type name; complex objects are JSON-serialised and SHA-256 hashed.
54
54
- Keys are always human-readable in the database (type name prefix makes them identifiable).
55
+
-**`TaskKeyConverter.ToKey(object key)`** is public — use it in tests to resolve the expected store key when asserting against `ITaskStateStore`.
Pass `taskKey` to make the setup match only that key. Any other key falls through to the Moq / NSubstitute default. This is useful when the thing you're testing is *which* key gets passed:
### Resolving object keys in store-level assertions
80
+
81
+
When asserting on `ITaskStateStore` calls directly (e.g., in custom store tests), you need the resolved string key. Use `TaskKeyConverter.ToKey` to compute it:
82
+
83
+
```csharp
84
+
usingTaskTurnstile;
85
+
86
+
varkey=newJobKey { TenantId=42 };
87
+
varstoreKey=TaskKeyConverter.ToKey(key); // e.g. "MyApp.JobKey:a3f9..."
0 commit comments