-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(66900): Adding test for confirm bug fix. #87167
fix(66900): Adding test for confirm bug fix. #87167
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsCurrent PR simply adding test for confirm that my previous PR also make fixes for #66900
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
|
||
instanceOfSecondClassWithSameName = new Class2(); | ||
|
||
Assert.NotEmpty(JsonSerializer.Serialize(instanceOfSecondClassWithSameName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you
- Update the assertion to validate the content of the output.
- Validate that it deserializes back to the expected value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by amend: 2d20edd
c2fbafa
to
2d20edd
Compare
@@ -91,6 +92,24 @@ public static void AppendCharacterWhenSerializingField() | |||
Assert.Equal(originalObj.TestProperty, deserialized.TestProperty); | |||
} | |||
|
|||
[Fact] | |||
public static void CorrectlyIgnorePropertyWithNewModifier() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I had left this feedback earlier, but I don't see it now. I don't believe this is the appropriate test suite for this type of test. Could you please move it to PropertyVisibilityTests.cs? Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved by amend: a9ca71c
2d20edd
to
a9ca71c
Compare
namespace System.Text.Json.Serialization.Tests | ||
{ | ||
public sealed partial class PropertyVisibilityTestsDynamic : PropertyVisibilityTests | ||
{ | ||
public PropertyVisibilityTestsDynamic() : base(JsonSerializerWrapper.StringSerializer) { } | ||
|
||
[Fact] | ||
public void CorrectlyIgnorePropertyWithNewModifier() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should run the same for both reflection and the source generator. Would it be possible to move the test to the base PropertyVisibilityTests
class? Note that this would additionally require the following two changes:
- Replace any direct calls to
JsonSerializer.Serialize
/Deserialize
with theSerializer.SerializeWrapper
test abstraction. - For the case of the source generator, add the test classes to the relevant JsonSerializerContext declaration.
Thanks!
fd54759
to
c49cef7
Compare
....Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyVisibilityTests.cs
Show resolved
Hide resolved
6e3f009
to
68a426e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Test failures are due to #87680 and unrelated to this change. |
Current PR simply adding test for confirm that my previous PR also make fixes for #66900