Initial commit: Client Doc docs Server Tools
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System.Text.Json;
|
||||
using Xunit;
|
||||
using XWorld.PublishTool;
|
||||
|
||||
namespace XWorld.PublishTool.Tests
|
||||
{
|
||||
public class GameJsonWriterTests
|
||||
{
|
||||
private static readonly GameSpec Spec = new GameSpec
|
||||
{
|
||||
GameId = "rps", Version = 2, MinFrameworkVersion = 1, PlayerCount = 2, TickRateHz = 10,
|
||||
ServerAssembly = "RPS.Server.dll", ServerEntryType = "RPS.Server.RpsServerRoom",
|
||||
CoreDll = "RPS.Core.dll", ClientDll = "RPS.Client.dll", ClientEntryType = "RPS.Client.RpsGameClient",
|
||||
CodeAb = "code.unity3d",
|
||||
Assets = new System.Collections.Generic.List<string> { "res.unity3d" }
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Server_Json_HasRequiredFields()
|
||||
{
|
||||
using var doc = JsonDocument.Parse(GameJsonWriter.WriteServer(Spec));
|
||||
var r = doc.RootElement;
|
||||
Assert.Equal("rps", r.GetProperty("gameId").GetString());
|
||||
Assert.Equal(2, r.GetProperty("version").GetInt32());
|
||||
Assert.Equal("RPS.Server.dll", r.GetProperty("serverAssembly").GetString());
|
||||
Assert.Equal("RPS.Server.RpsServerRoom", r.GetProperty("serverEntryType").GetString());
|
||||
Assert.Equal(2, r.GetProperty("playerCount").GetInt32());
|
||||
Assert.Equal(10, r.GetProperty("tickRateHz").GetInt32());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Client_Json_HasRequiredFields()
|
||||
{
|
||||
using var doc = JsonDocument.Parse(GameJsonWriter.WriteClient(Spec));
|
||||
var r = doc.RootElement;
|
||||
Assert.Equal("rps", r.GetProperty("gameId").GetString());
|
||||
Assert.Equal("RPS.Client.RpsGameClient", r.GetProperty("clientEntryType").GetString());
|
||||
Assert.Equal("RPS.Core.dll", r.GetProperty("coreDll").GetString());
|
||||
Assert.Equal("RPS.Client.dll", r.GetProperty("clientDll").GetString());
|
||||
Assert.Equal("code.unity3d", r.GetProperty("codeAb").GetString());
|
||||
Assert.Equal("res.unity3d", r.GetProperty("assets")[0].GetString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user