Files
SVSimServer/SVSim.UnitTests/Wire/UserMyPageWireShape.cs
gamer147 b447f5032d fix(mypage): wire mypage_id/select_type/mypage_id_list as strings
Prod capture (traffic_prod_misc_clicking.ndjson) shows all three
MyPageBgSetting fields arrive as decimal strings, not ints.  Update the
DTO from int/int/List<int> to string/string/List<string> with "0"/empty
defaults, and add a literal wire-shape round-trip test pinning the
exact JSON against the capture.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 16:40:38 -04:00

41 lines
1.4 KiB
C#

using System.Text.Json;
using SVSim.EmulatedEntrypoint.Models.Dtos;
namespace SVSim.UnitTests.Wire;
public class UserMyPageWireShape
{
[Test]
public void MyPageBgSetting_serialization_emits_strings_matching_prod_capture()
{
var setting = new MyPageBgSetting
{
MyPageId = "1213410310",
SelectType = "1",
MyPageIdList = new List<string>
{
"1211410310", "1212410310", "1213410310", "1214410310",
"1215410310", "1216410310", "1217410310", "1218410310",
},
};
var options = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
};
var json = JsonSerializer.Serialize(setting, options);
// Prod capture line 12 / line 56 of traffic_prod_misc_clicking.ndjson, user_mypage_info.user_mypage_setting:
var expected =
"{\"mypage_id\":\"1213410310\"," +
"\"select_type\":\"1\"," +
"\"mypage_id_list\":[" +
"\"1211410310\",\"1212410310\",\"1213410310\",\"1214410310\"," +
"\"1215410310\",\"1216410310\",\"1217410310\",\"1218410310\"" +
"]}";
Assert.That(json, Is.EqualTo(expected));
}
}