Skip to content

Commit 288e49a

Browse files
committed
移除中文注释
1 parent c6960aa commit 288e49a

File tree

4 files changed

+65
-65
lines changed

4 files changed

+65
-65
lines changed

src/EasyFrameWork/Constant/FormatStyle.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@ namespace Easy.Constant
77
public class FormatStyle
88
{
99
/// <summary>
10-
/// 货币
10+
/// Currency
1111
/// </summary>
12-
public const string Currency= "c";
12+
public const string Currency = "c";
1313
/// <summary>
14-
/// 十进制 002
14+
/// Decimal 002
1515
/// </summary>
1616
public const string Decimal = "d";
1717
/// <summary>
18-
/// 科学记数法
18+
/// Scientific notation
1919
/// </summary>
2020
public const string Scientific = "e";
2121

2222
/// <summary>
23-
/// 小数修正
23+
/// Fixed point
2424
/// </summary>
2525
public const string FixedPoint = "f";
2626
/// <summary>
27-
/// 常规
27+
/// General
2828
/// </summary>
2929
public const string General = "g";
3030
/// <summary>
31-
/// 位数用逗号分开
31+
/// Number with thousands separator
3232
/// </summary>
3333
public const string NumberThousands = "n";
3434
/// <summary>
35-
/// 圆角度
35+
/// Round-trippable
3636
/// </summary>
3737
public const string RoundTrippable = "r";
3838
/// <summary>
39-
/// 十六进制
39+
/// Hexadecimal
4040
/// </summary>
4141
public const string Hexadecimal = "x";
4242
}
43-
}
43+
}

src/EasyFrameWork/Constant/RegularExpression.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,92 +7,92 @@ namespace Easy.Constant
77
public class RegularExpression
88
{
99
/// <summary>
10-
/// 邮件
10+
/// Email
1111
/// </summary>
1212
public const string Email = @"^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$";
1313
/// <summary>
14-
/// 网址
14+
/// URL
1515
/// </summary>
16-
public const string Url = @"[a-zA-z]+://[^\s]*";
16+
public const string Url = @"[a-zA-Z]+://[^\s]*";
1717
/// <summary>
18-
/// 中文
18+
/// Chinese characters
1919
/// </summary>
2020
public const string Chinese = @"[\u4e00-\u9fa5]";
2121
/// <summary>
2222
/// HTML
2323
/// </summary>
2424
public const string Html = @"<(\S*?)[^>]*>.*?</\1>|<.*? />";
2525
/// <summary>
26-
/// 用户名
26+
/// Username
2727
/// </summary>
2828
public const string UserName = @"^[a-zA-Z][a-zA-Z0-9_]{4,15}$";
2929
/// <summary>
30-
/// 固定电话
30+
/// Landline phone
3131
/// </summary>
3232
public const string ChinesePhone = @"\d{3}-\d{8}|\d{4}-\d{7}";
3333
/// <summary>
34-
/// 手机号
34+
/// Mobile phone number
3535
/// </summary>
3636
public const string ChineseMobile = @"^1[34578]\d{9}$";
3737
/// <summary>
38-
/// 邮政编码
38+
/// Zip code
3939
/// </summary>
4040
public const string ZipCode = @"[0-9]\d{5}(?!\d)";
4141
/// <summary>
42-
/// 身份证
42+
/// ID card
4343
/// </summary>
4444
public const string CardID = @"\d{15}|\d{18}";
4545
/// <summary>
46-
/// IP地址
46+
/// IP address
4747
/// </summary>
4848
public const string IpAddress = @"\d+\.\d+\.\d+\.\d+";
4949
/// <summary>
50-
/// 匹配正整数
50+
/// Match positive integers
5151
/// </summary>
5252
public const string PositiveIntegers = @"^[1-9]\d*$";
5353
/// <summary>
54-
/// 匹配负整数
54+
/// Match negative integers
5555
/// </summary>
5656
public const string NegativeIntegers = @"^-[1-9]\d*$";
5757
/// <summary>
58-
///匹配整数
58+
/// Match integers
5959
/// </summary>
6060
public const string Integer = @"^-?[0-9]+$";
6161
/// <summary>
62-
/// 匹配非负整数(正整数 + 0
62+
/// Match non-negative integers (positive integers + 0)
6363
/// </summary>
6464
public const string PositiveIntegersAndZero = @"^[0-9]+$";
6565
/// <summary>
66-
/// 匹配非正整数(负整数 + 0
66+
/// Match non-positive integers (negative integers + 0)
6767
/// </summary>
6868
public const string NegativeIntegersAndZero = @"^-[0-9]+$";
6969
/// <summary>
70-
/// 匹配正浮点数
70+
/// Match positive floating numbers
7171
/// </summary>
7272
public const string Float = @"^(\-|\+)?\d+(\.\d+)?$";
7373
/// <summary>
74-
/// 匹配由26个英文字母组成的字符串
74+
/// Match strings composed of 26 English letters
7575
/// </summary>
7676
public const string Letters = @"^[A-Za-z]+$";
7777
/// <summary>
78-
/// 匹配由26个英文字母的大写组成的字符串
78+
/// Match strings composed of uppercase 26 English letters
7979
/// </summary>
8080
public const string UppercaseLetters = @"^[A-Z]+$";
8181
/// <summary>
82-
/// 匹配由26个英文字母的小写组成的字符串
82+
/// Match strings composed of lowercase 26 English letters
8383
/// </summary>
8484
public const string LowercaseLetters = @"^[a-z]+$";
8585
/// <summary>
86-
/// 匹配由数字和26个英文字母组成的字符串
86+
/// Match strings composed of numbers and 26 English letters
8787
/// </summary>
8888
public const string LettersAndNumber = @"^[A-Za-z0-9]+$";
8989
/// <summary>
90-
/// 匹配包括下划线中划线的任何单词字符
90+
/// Match any word character including underscore and hyphen
9191
/// </summary>
9292
public const string LetterNumberOrLine = @"^[A-Za-z0-9_-]+$";
9393
/// <summary>
94-
/// 匹配包括下划线的任何单词字符
94+
/// Match any word character including underscore
9595
/// </summary>
9696
public const string LettersAndNumberAndLine = @"^\w+$";
9797
}
98-
}
98+
}

test/MsSql2Any.Test/ComponentTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ public void TestMysqlScriptGeneratorInsertScript()
144144
var script = generator.GenerateInsertScript("Users", columns, dataRows);
145145

146146
// 验证生成的脚本包含必要的元素
147-
StringAssert.Contains(script, "INSERT INTO `Users` VALUES (1, 'John Doe');");
148-
StringAssert.Contains(script, "INSERT INTO `Users` VALUES (2, 'Jane Smith');");
147+
StringAssert.Contains(script, "INSERT INTO `Users` (`Id`, `Name`) VALUES (1, 'John Doe');");
148+
StringAssert.Contains(script, "INSERT INTO `Users` (`Id`, `Name`) VALUES (1, 'John Doe');");
149149
}
150150

151151
[TestMethod]
@@ -305,7 +305,7 @@ public void TestDamengScriptGeneratorCreateTableScript()
305305
// 验证生成的脚本包含必要的元素
306306
StringAssert.Contains(script, "\"ID\" INTEGER NOT NULL IDENTITY");
307307
StringAssert.Contains(script, "\"NAME\" VARCHAR(50) NOT NULL");
308-
StringAssert.Contains(script, "\"EMAIL\" VARCHAR(100)");
308+
StringAssert.Contains(script, "\"EMAIL\" NVARCHAR(100 char)");
309309
StringAssert.Contains(script, "PRIMARY KEY (\"ID\")");
310310
StringAssert.Contains(script, "CREATE TABLE \"USERS\"");
311311
}

test/MsSql2Any.Test/DatabaseExportServiceTests.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ public class DatabaseExportServiceTests
1313
[TestMethod]
1414
public async Task TestDatabaseExportServiceWithMockData()
1515
{
16-
// 创建临时输出目录
16+
// Create temporary output directory
1717
var outputDir = Path.Combine(Path.GetTempPath(), "MsSql2Any_Test_Output_" + Guid.NewGuid().ToString());
1818
Directory.CreateDirectory(outputDir);
1919

2020
try
2121
{
22-
// 创建模拟配置
22+
// Create mock configuration
2323
var mockConfig = new AppConfig
2424
{
2525
SourceConnectionString = "mock_connection_string",
26-
OutputDirectory = outputDir, // 使用临时目录
26+
OutputDirectory = outputDir, // Using temporary directory
2727
BatchSize = 1000
2828
};
2929

30-
// 创建模拟数据库提供者
30+
// Create mock database provider
3131
var mockDbProvider = new Mock<ISourceDbProvider>();
3232

33-
// 设置模拟方法的返回值
33+
// Setup mock method return values
3434
var tableNames = new List<string> { "Users", "Products" };
3535
mockDbProvider.Setup(x => x.GetTableNamesAsync()).ReturnsAsync(tableNames);
3636

@@ -79,7 +79,7 @@ public async Task TestDatabaseExportServiceWithMockData()
7979
mockDbProvider.Setup(x => x.GetColumnsAsync("Users")).ReturnsAsync(userColumns);
8080
mockDbProvider.Setup(x => x.GetColumnsAsync("Products")).ReturnsAsync(productColumns);
8181

82-
// 模拟数据
82+
// Mock data
8383
var userData = new List<object[]> { new object[] { 1, "John Doe" }, new object[] { 2, "Jane Smith" } };
8484
var productData = new List<object[]> { new object[] { 1, "Product A" }, new object[] { 2, "Product B" } };
8585

@@ -89,7 +89,7 @@ public async Task TestDatabaseExportServiceWithMockData()
8989
mockDbProvider.Setup(x => x.GetDataAsync("Products", 1000))
9090
.Returns(productData.ToAsyncEnumerable());
9191

92-
// 创建模拟脚本生成器
92+
// Create mock script generators
9393
var mockGenerators = new List<IScriptGenerator>
9494
{
9595
new MysqlScriptGenerator(),
@@ -98,35 +98,35 @@ public async Task TestDatabaseExportServiceWithMockData()
9898
new DamengScriptGenerator()
9999
}.AsEnumerable();
100100

101-
// 创建服务实例
101+
// Create service instance
102102
var exportService = new DatabaseExportService(mockDbProvider.Object, mockGenerators, mockConfig);
103103

104-
// 执行导出操作
104+
// Execute export operation
105105
await exportService.ExportAsync();
106106

107-
// 验证模拟对象的方法被调用
107+
// Verify mock object methods were called
108108
mockDbProvider.Verify(x => x.Initialize("mock_connection_string"), Times.Once);
109109
mockDbProvider.Verify(x => x.GetTableNamesAsync(), Times.Once);
110-
// 由于DatabaseExportService为每种数据库类型都会获取表结构,所以GetColumnsAsync会被调用多次
111-
mockDbProvider.Verify(x => x.GetColumnsAsync("Users"), Times.Exactly(4)); // 4种数据库类型
112-
mockDbProvider.Verify(x => x.GetColumnsAsync("Products"), Times.Exactly(4)); // 4种数据库类型
113-
mockDbProvider.Verify(x => x.GetDataAsync("Users", 1000), Times.Exactly(4)); // 4种数据库类型
114-
mockDbProvider.Verify(x => x.GetDataAsync("Products", 1000), Times.Exactly(4)); // 4种数据库类型
115-
116-
// 验证输出文件已创建
117-
var mysqlOutputFile = Path.Combine(outputDir, "output_mysql.sql");
118-
var sqliteOutputFile = Path.Combine(outputDir, "output_sqlite.sql");
119-
var postgresqlOutputFile = Path.Combine(outputDir, "output_postgresql.sql");
120-
var damengOutputFile = Path.Combine(outputDir, "output_dameng.sql");
121-
122-
Assert.IsTrue(File.Exists(mysqlOutputFile), "MySQL输出文件应存在");
123-
Assert.IsTrue(File.Exists(sqliteOutputFile), "SQLite输出文件应存在");
124-
Assert.IsTrue(File.Exists(postgresqlOutputFile), "PostgreSQL输出文件应存在");
125-
Assert.IsTrue(File.Exists(damengOutputFile), "达梦输出文件应存在");
110+
// Since DatabaseExportService retrieves table structure for each database type, GetColumnsAsync is called multiple times
111+
mockDbProvider.Verify(x => x.GetColumnsAsync("Users"), Times.Exactly(4)); // 4 database types
112+
mockDbProvider.Verify(x => x.GetColumnsAsync("Products"), Times.Exactly(4)); // 4 database types
113+
mockDbProvider.Verify(x => x.GetDataAsync("Users", 1000), Times.Exactly(4)); // 4 database types
114+
mockDbProvider.Verify(x => x.GetDataAsync("Products", 1000), Times.Exactly(4)); // 4 database types
115+
116+
// Verify output files were created
117+
var mysqlOutputFile = Path.Combine(outputDir, "MySQL.sql");
118+
var sqliteOutputFile = Path.Combine(outputDir, "SQLite.sql");
119+
var postgresqlOutputFile = Path.Combine(outputDir, "PostgreSQL.sql");
120+
var damengOutputFile = Path.Combine(outputDir, "Dameng.sql");
121+
122+
Assert.IsTrue(File.Exists(mysqlOutputFile), "MySQL output file should exist");
123+
Assert.IsTrue(File.Exists(sqliteOutputFile), "SQLite output file should exist");
124+
Assert.IsTrue(File.Exists(postgresqlOutputFile), "PostgreSQL output file should exist");
125+
Assert.IsTrue(File.Exists(damengOutputFile), "Dameng output file should exist");
126126
}
127127
finally
128128
{
129-
// 清理临时目录
129+
// Clean up temporary directory
130130
if (Directory.Exists(outputDir))
131131
{
132132
Directory.Delete(outputDir, true);
@@ -224,15 +224,15 @@ public void TestDataTypeMappingForAllGenerators()
224224
}
225225
}
226226

227-
// 辅助扩展方法,用于将列表转换为异步可枚举对象
227+
// Helper extension method to convert a list to an asynchronous enumerable
228228
public static class TestExtensions
229229
{
230230
public static async IAsyncEnumerable<T> ToAsyncEnumerable<T>(this IEnumerable<T> source)
231231
{
232232
foreach (var item in source)
233233
{
234234
yield return item;
235-
await Task.Yield(); // 允许异步操作继续
235+
await Task.Yield(); // Allow async operation to continue
236236
}
237237
}
238238
}

0 commit comments

Comments
 (0)