feat(guild): controller scaffolding + /guild/info baseline
- 5 common DTOs under Models/Dtos/Common/Guild/ (GuildDetailDto, GuildUserBaseDto, GuildMemberInfoDto, ChatUserDto, ChatMessageDto) - 28 per-endpoint request/response DTOs under Models/Dtos/Guild/ and Models/Dtos/GuildChat/ with full [MessagePackObject]/[Key]/ [JsonPropertyName] attribute mirrors on every property - GuildController (22 actions): /guild/info returns prod-shape with config-backed max_member_num/max_sub_leader_num/usable_stamp_list; 21 stubs return empty/default DTOs - GuildChatController (7 stubs), /guild_chat/messages stub returns wait_interval=10 per config - 29 new routing smoke test cases (100 total, all pass) - GuildWireShape literal-JSON test for GuildInfoResponse (1/1 pass) - GameConfigurationJsonbTests updated for 17th GuildConfig section - Total: 1422 tests pass, 0 errors Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,14 +25,15 @@ public class GameConfigurationJsonbTests
|
||||
var rows = await db.GameConfigs.AsNoTracking().ToListAsync();
|
||||
var byName = rows.ToDictionary(r => r.SectionName);
|
||||
|
||||
// One row per [ConfigSection]-marked POCO (16 sections today: Player, DefaultGrants,
|
||||
// One row per [ConfigSection]-marked POCO (17 sections today: Player, DefaultGrants,
|
||||
// DefaultLoadout, Challenge, Rotation, PackRates, MyRotationSchedule, Story, ResourceConfig,
|
||||
// Freeplay, ArenaTwoPick, Matching, CardMasterConfig, ColosseumSeason, ColosseumRounds, LoginBonus).
|
||||
// Freeplay, ArenaTwoPick, Matching, CardMasterConfig, ColosseumSeason, ColosseumRounds,
|
||||
// LoginBonus, Guild).
|
||||
Assert.That(byName.Keys, Is.EquivalentTo(new[]
|
||||
{
|
||||
"Player", "DefaultGrants", "DefaultLoadout", "Challenge", "Rotation", "PackRates",
|
||||
"MyRotationSchedule", "Story", "ResourceConfig", "Freeplay", "ArenaTwoPick", "Matching",
|
||||
"CardMasterConfig", "ColosseumSeason", "ColosseumRounds", "LoginBonus",
|
||||
"CardMasterConfig", "ColosseumSeason", "ColosseumRounds", "LoginBonus", "Guild",
|
||||
}));
|
||||
|
||||
var resources = JsonSerializer.Deserialize<ResourceConfig>(byName["ResourceConfig"].ValueJson)!;
|
||||
|
||||
@@ -146,6 +146,38 @@ public class RoutingSmokeTests
|
||||
[TestCase("/rotation_free_battle/finish")]
|
||||
[TestCase("/unlimited_free_battle/finish")]
|
||||
[TestCase("/free_battle/force_finish")]
|
||||
// Guild endpoints (Task 5)
|
||||
[TestCase("/guild/info")]
|
||||
[TestCase("/guild/create")]
|
||||
[TestCase("/guild/breakup")]
|
||||
[TestCase("/guild/update")]
|
||||
[TestCase("/guild/update_description")]
|
||||
[TestCase("/guild/update_emblem")]
|
||||
[TestCase("/guild/search_guild")]
|
||||
[TestCase("/guild/emblem_list")]
|
||||
[TestCase("/guild/others_info")]
|
||||
[TestCase("/guild/friend_list")]
|
||||
[TestCase("/guild/invite_user_list")]
|
||||
[TestCase("/guild/invited_guild_list")]
|
||||
[TestCase("/guild/invite")]
|
||||
[TestCase("/guild/cancel_invite")]
|
||||
[TestCase("/guild/reject_invite")]
|
||||
[TestCase("/guild/join")]
|
||||
[TestCase("/guild/cancel_join_request")]
|
||||
[TestCase("/guild/join_request_list")]
|
||||
[TestCase("/guild/join_request_accept")]
|
||||
[TestCase("/guild/reject_join_request")]
|
||||
[TestCase("/guild/leave")]
|
||||
[TestCase("/guild/remove")]
|
||||
[TestCase("/guild/change_role")]
|
||||
// GuildChat endpoints (Task 5)
|
||||
[TestCase("/guild_chat/messages")]
|
||||
[TestCase("/guild_chat/post")]
|
||||
[TestCase("/guild_chat/add_deck")]
|
||||
[TestCase("/guild_chat/delete_deck")]
|
||||
[TestCase("/guild_chat/add_replay")]
|
||||
[TestCase("/guild_chat/replay_detail")]
|
||||
[TestCase("/guild_chat/deck_log")]
|
||||
public async Task Authenticated_route_resolves(string path)
|
||||
{
|
||||
using var factory = new TestFactory();
|
||||
|
||||
40
SVSim.UnitTests/Wire/GuildWireShape.cs
Normal file
40
SVSim.UnitTests/Wire/GuildWireShape.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using NUnit.Framework;
|
||||
using System.Text.Json;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Guild;
|
||||
|
||||
namespace SVSim.UnitTests.Wire;
|
||||
|
||||
[TestFixture]
|
||||
public class GuildWireShape
|
||||
{
|
||||
private static readonly JsonSerializerOptions Opts = new()
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void GuildInfo_non_joined_serializes_to_prod_shape()
|
||||
{
|
||||
var resp = new GuildInfoResponse
|
||||
{
|
||||
MaxMemberNum = 30,
|
||||
MaxSubLeaderNum = 2,
|
||||
GuildStatus = 0,
|
||||
UsableStampList = Enumerable.Range(100001, 20).Select(i => i.ToString()).ToList(),
|
||||
};
|
||||
var json = JsonSerializer.Serialize(resp, Opts);
|
||||
using var doc = JsonDocument.Parse(json);
|
||||
var root = doc.RootElement;
|
||||
|
||||
Assert.That(root.GetProperty("max_member_num").GetString(), Is.EqualTo("30"));
|
||||
Assert.That(root.GetProperty("max_sub_leader_num").GetString(), Is.EqualTo("2"));
|
||||
Assert.That(root.GetProperty("guild_status").GetString(), Is.EqualTo("0"));
|
||||
Assert.That(root.GetProperty("usable_stamp_list").EnumerateArray().Select(e => e.GetString()).First(), Is.EqualTo("100001"));
|
||||
|
||||
// The four nullable fields MUST NOT appear when null:
|
||||
Assert.That(root.TryGetProperty("guild", out _), Is.False);
|
||||
Assert.That(root.TryGetProperty("join_request_count", out _), Is.False);
|
||||
Assert.That(root.TryGetProperty("invite_count", out _), Is.False);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user