[Internal] DTS: Refactors JSON property names into shared constant and changes etag constant#5818
Conversation
…onstant Extract all JSON field name string literals from DistributedTransactionSerializer into `internal const string` constants at the top of the class Replace the literals in the serializer body with the new constants. Update all test files that previously hardcoded these same strings in `GetProperty`/`TryGetProperty` calls to reference `DistributedTransactionSerializer.<Constant>` instead — ensuring any future rename of a property automatically propagates to tests without a separate search-and-replace: - `DistributedTransactionOperationResult.cs` - `DistributedTransactionSerializerTests.cs` - `DistributedTransactionCommitterTests.cs` - `DistributedTransactionTests.cs` (emulator) No behavioral changes. All 58 unit tests pass. Additionally, updates the constant `etag` to `ifMatch` in the request body to align with the wire contract update.
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
kushagraThapar
left a comment
There was a problem hiding this comment.
I think the reason the issue I mentioned is not caught in the tests is because the tests are just checking with the constants that were introduced in this file.
How about updating the tests to actually check for our newly introduced constants with the values being returend from the actual response from the wire?
If we cannot do it yet, maybe checking the constants agains the values we were checking them before?
Synced up on this one, we are in process of adding new tests to our service and then we should be able to do end to end integration tests on these constants. |
kushagraThapar
left a comment
There was a problem hiding this comment.
LGTM, thanks @Meghana-Palaparthi
Pull Request Template
Description
Extract all JSON field name string literals from DistributedTransactionSerializer into
internal const stringconstants at the top of the classReplace the literals in the serializer body with the new constants.
Update all test files that previously hardcoded these same strings in
GetProperty/TryGetPropertycalls to referenceDistributedTransactionSerializer.<Constant>instead — ensuring any future rename of a property automatically propagates to tests without a separate search-and-replace:
DistributedTransactionOperationResult.csDistributedTransactionSerializerTests.csDistributedTransactionCommitterTests.csDistributedTransactionTests.cs(emulator)No behavioral changes. All 58 unit tests pass.
Additionally, updates the constant
etagtoifMatchin the request body to align with the wire contract update.Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber