Added deserialization unit tests to CodeDomComponentSerializationService - #14900
Open
Rabina4363sf wants to merge 2 commits into
Open
Added deserialization unit tests to CodeDomComponentSerializationService#14900Rabina4363sf wants to merge 2 commits into
Rabina4363sf wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds unit tests for CodeDomComponentSerializationService deserialization APIs.
Changes:
- Covers validation, empty stores, and object round trips.
- Exercises container, service-provider, and
DeserializeToscenarios. - Adds control property fidelity checks.
File summaries
| File | Description |
|---|---|
CodeDomComponentSerializationServiceTests.cs |
Adds deserialization-focused unit tests. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 6
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| ICollection deserializedCollection = service.Deserialize(store, container); | ||
| Assert.NotEmpty(deserializedCollection); | ||
| DataClass deserializedObject = Assert.IsType<DataClass>(Assert.Single(deserializedCollection.Cast<object>())); |
| ICollection deserializedCollection = service.Deserialize(store, container); | ||
| Assert.Equal(2, deserializedCollection.Count); | ||
|
|
||
| DataClass[] deserializedObjects = deserializedCollection.Cast<DataClass>().ToArray(); |
Comment on lines
+2047
to
+2055
| // Store the original values | ||
| int originalIntValue = targetObject.IntValue; | ||
| string originalStringValue = targetObject.StringValue; | ||
|
|
||
| // Deserialize to the existing object | ||
| service.DeserializeTo(store, targetContainer, false, false); | ||
|
|
||
| // The targetObject should have received the state from the serialized object | ||
| // Note: This depends on the internal implementation of DeserializeTo |
Comment on lines
+2105
to
+2106
| // Should apply default values when applyDefaults is true | ||
| service.DeserializeTo(store, container, validateRecycledTypes: false, applyDefaults: true); |
Comment on lines
+2130
to
+2131
| // Should not apply default values when applyDefaults is false | ||
| service.DeserializeTo(store, container, validateRecycledTypes: false, applyDefaults: false); |
Comment on lines
+2215
to
+2216
| // First serialize the object completely | ||
| service.Serialize(store, originalObject); |
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.
Fixes #10135
Proposed changes
CodeDomComponentSerializationService.Deserialize()methodDeserializeTo()method with various flag combinations (validateRecycledTypes,applyDefaults)IServiceProviderandIContainerCustomer Impact
Regression?
Risk
Test methodology
Accessibility testing
NA
Test environment(s)
Microsoft Reviewers: Open in CodeFlow