U:调整所有代码格式

This commit is contained in:
jimmy committed 2025-12-30 09:17:25 +08:00
1 parent d133bacf55
commit 155b67e831
342 files changed
+9431 -9868

No files matched your search

+35 -35
View File
@@ -30,7 +30,7 @@ public class JsonHelperTests
var json = JsonHelper.ToJson(person);
// Assert
Assert.IsTrue(json.Contains("\"name\": \"John Doe\"")); // camelCase
Assert.IsTrue(json.Contains("\"name\": \"John Doe\"")); // camelCase
Assert.IsTrue(json.Contains("\"age\": 30"));
Assert.IsTrue(json.Contains("\"email\": \"john@example.com\""));
}
@@ -54,7 +54,7 @@ public class JsonHelperTests
// Assert: 属性名应该是 camelCase
Assert.IsTrue(json.Contains("\"appName\""));
Assert.IsTrue(json.Contains("\"maxConnections\""));
Assert.IsFalse(json.Contains("\"AppName\"")); // 不应该是 PascalCase
Assert.IsFalse(json.Contains("\"AppName\"")); // 不应该是 PascalCase
}
/// <summary>
@@ -85,12 +85,12 @@ public class JsonHelperTests
{
// Arrange
var json = """
{
"name": "Alice",
"age": 28,
"email": "alice@example.com"
}
""";
{
"name": "Alice",
"age": 28,
"email": "alice@example.com"
}
""";
// Act
var person = JsonHelper.FromJson<Person>(json);
@@ -110,11 +110,11 @@ public class JsonHelperTests
{
// Arrange: JSON 使用 camelCase
var json = """
{
"appName": "TestApp",
"maxConnections": 50
}
""";
{
"appName": "TestApp",
"maxConnections": 50
}
""";
// Act
var config = JsonHelper.FromJson<AppConfig>(json);
@@ -148,7 +148,7 @@ public class JsonHelperTests
// Assert: 枚举应该序列化为字符串(camelCase)
Assert.IsTrue(json.Contains("\"active\""));
Assert.IsTrue(json.Contains("\"high\""));
Assert.IsFalse(json.Contains("0")); // 不应该是数字
Assert.IsFalse(json.Contains("0")); // 不应该是数字
Assert.IsFalse(json.Contains("1"));
}
@@ -160,11 +160,11 @@ public class JsonHelperTests
{
// Arrange
var json = """
{
"status": "active",
"priority": "low"
}
""";
{
"status": "active",
"priority": "low"
}
""";
// Act
var data = JsonHelper.FromJson<DataWithEnum>(json);
@@ -204,11 +204,11 @@ public class JsonHelperTests
{
// Arrange
var json = """
{
"serverIp": "192.168.1.1",
"clientIp": "10.0.0.5"
}
""";
{
"serverIp": "192.168.1.1",
"clientIp": "10.0.0.5"
}
""";
// Act
var networkInfo = JsonHelper.FromJson<NetworkInfo>(json);
@@ -374,16 +374,16 @@ public class JsonHelperTests
// 模拟 API 调用后收到响应
var responseJson = """
{
"success": true,
"data": {
"name": "New User",
"age": 25,
"email": "newuser@example.com"
},
"message": "User created successfully"
}
""";
{
"success": true,
"data": {
"name": "New User",
"age": 25,
"email": "newuser@example.com"
},
"message": "User created successfully"
}
""";
var response = JsonHelper.FromJson<ApiResponse<Person>>(responseJson);
@@ -507,4 +507,4 @@ public class JsonHelperTests
}
#endregion
}
}