diff --git a/SVSim.EmulatedEntrypoint/Models/Dtos/UserMyPageInfo.cs b/SVSim.EmulatedEntrypoint/Models/Dtos/UserMyPageInfo.cs index 1656925..7bc178a 100644 --- a/SVSim.EmulatedEntrypoint/Models/Dtos/UserMyPageInfo.cs +++ b/SVSim.EmulatedEntrypoint/Models/Dtos/UserMyPageInfo.cs @@ -17,21 +17,22 @@ public class UserMyPageInfo } /// -/// Active mypage background selection. Shape from prod 2026-05-23. +/// Active mypage background selection. Shape from prod 2026-06-09 (capture line 12/56). +/// All three fields ship as strings on the wire even though the underlying ids are integers. /// [MessagePackObject] public class MyPageBgSetting { [JsonPropertyName("mypage_id")] [Key("mypage_id")] - public int MyPageId { get; set; } + public string MyPageId { get; set; } = "0"; - /// 0 = single selection (mypage_id), 1+ = random rotation across mypage_id_list. + /// BGType enum as decimal string: "0"=Deck, "1"=CustomBG, "2"=RandomBG. [JsonPropertyName("select_type")] [Key("select_type")] - public int SelectType { get; set; } + public string SelectType { get; set; } = "0"; [JsonPropertyName("mypage_id_list")] [Key("mypage_id_list")] - public List MyPageIdList { get; set; } = new(); + public List MyPageIdList { get; set; } = new(); } diff --git a/SVSim.UnitTests/Wire/UserMyPageWireShape.cs b/SVSim.UnitTests/Wire/UserMyPageWireShape.cs new file mode 100644 index 0000000..6e64018 --- /dev/null +++ b/SVSim.UnitTests/Wire/UserMyPageWireShape.cs @@ -0,0 +1,40 @@ +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 + { + "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)); + } +}