Skip to content

Commit 65528d8

Browse files
committed
Translate files. Handle garbled code.
1 parent 14afd45 commit 65528d8

File tree

4 files changed

+37
-66
lines changed

4 files changed

+37
-66
lines changed

src/Senparc.CO2NET.APM.Tests/DataOperationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ public void ReadAndCleanDataItems_KeepTodayDataTest()
9595
Console.WriteLine("===============");
9696

9797
//Check if the current task has received the previous task
98-
var memoryData = dataOperation.GetDataItemListAsync("�ڴ�").Result;
98+
var memoryData = dataOperation.GetDataItemListAsync("Memory").Result;
9999
Assert.AreEqual(1, memoryData.Count);//Delete 1 element from the list
100100

101101
var cpuData = dataOperation.GetDataItemListAsync("CPU").Result;
102102
Assert.AreEqual(5, cpuData.Count);//Clear all elements in the list
103103

104-
var viewData = dataOperation.GetDataItemListAsync("������").Result;
104+
var viewData = dataOperation.GetDataItemListAsync("Visitor Volumn").Result;
105105
Assert.AreEqual(7, viewData.Count);//Clear all elements in the list
106106

107107
//Simulate current time

src/Senparc.CO2NET.Tests/Cache/ObjectCacheStrategy/CacheSerializeExtensionTest.cs

Lines changed: 32 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ public void CacheWrapperTest()
4040
[TestMethod]
4141
public void CacheWrapperEfficiencyTest()
4242
{
43-
Console.WriteLine("��ʼCacheWrapper�첽����");
43+
Console.WriteLine("Start CacheWrapper asynchronous test");
4444
var threadCount = 10;
4545
var finishCount = 0;
4646
List<Thread> threadList = new List<Thread>();
4747
for (int i = 0; i < threadCount; i++)
4848
{
4949
var thread = new Thread(() =>
5050
{
51-
5251
var testClass = new TestClass()
5352
{
5453
ID = Guid.NewGuid().ToString(),
@@ -58,31 +57,26 @@ public void CacheWrapperEfficiencyTest()
5857

5958
var dtx = SystemTime.Now.DateTime;
6059
var json = testClass.SerializeToCache();
61-
//Console.WriteLine(json);
62-
Console.WriteLine($"testClass.SerializeToCache ��ʱ��{SystemTime.DiffTotalMS(dtx)}ms");
63-
60+
//Console.WriteLine(json);
61+
Console.WriteLine($"testClass.SerializeToCache took: {SystemTime.DiffTotalMS(dtx)}ms");
6462

6563
dtx = SystemTime.Now.DateTime;
6664
var obj = json.DeserializeFromCache<TestClass>();
67-
Console.WriteLine($"json.DeserializeFromCache<TestClass> ��ʱ��{SystemTime.DiffTotalMS(dtx)}ms");
65+
Console.WriteLine($"json.DeserializeFromCache<TestClass> took: {SystemTime.DiffTotalMS(dtx)}ms");
6866
Assert.AreEqual(obj.ID, testClass.ID);
6967
Assert.AreEqual(obj.Star, testClass.Star);
7068
Assert.AreEqual(obj.AddTime, testClass.AddTime);
7169

7270
Console.WriteLine("");
73-
7471
finishCount++;
7572
});
7673
threadList.Add(thread);
7774
}
78-
7975
threadList.ForEach(z => z.Start());
80-
8176
while (finishCount < threadCount)
8277
{
83-
//Waiting
78+
//Wait
8479
}
85-
8680
}
8781

8882
[TestMethod]
@@ -101,19 +95,17 @@ public void CacheWapper_VS_BinaryTest()
10195

10296
var dtx = SystemTime.Now.DateTime;
10397
var json = testClass.SerializeToCache();
104-
//Console.WriteLine(json);
105-
//Console.WriteLine($"testClass.SerializeToCache took {SystemTime.DiffTotalMS(dtx)}ms");
106-
98+
//Console.WriteLine(json);
99+
//Console.WriteLine($"testClass.SerializeToCache took: {SystemTime.DiffTotalMS(dtx)}ms");
107100
dtx = SystemTime.Now.DateTime;
108101
var obj = json.DeserializeFromCache<TestClass>();
109-
//Console.WriteLine($"json.DeserializeFromCache<TestClass> took {SystemTime.DiffTotalMS(dtx)}ms");
102+
//Console.WriteLine($"json.DeserializeFromCache<TestClass> took: {SystemTime.DiffTotalMS(dtx)}ms");
110103
Assert.AreEqual(obj.ID, testClass.ID);
111104
Assert.AreEqual(obj.Star, testClass.Star);
112105
Assert.AreEqual(obj.AddTime, testClass.AddTime);
113-
114106
}
115107
var dt2 = SystemTime.Now.DateTime;
116-
Console.WriteLine($"CacheWrapper���л� {count} �Σ�ʱ�䣺{(dt2 - dt1).TotalMilliseconds}ms");
108+
Console.WriteLine($"CacheWrapper serialized {count} times, time: {(dt2 - dt1).TotalMilliseconds}ms");
117109

118110
dt1 = SystemTime.Now.DateTime;
119111
for (int i = 0; i < count; i++)
@@ -127,21 +119,16 @@ public void CacheWapper_VS_BinaryTest()
127119

128120
var dtx = SystemTime.Now.DateTime;
129121
var serializedObj = StackExchangeRedisExtensions.Serialize(testClass);
130-
//Note: This issue seems to be related to DateTimeOffset being converted to Object, which cannot be deserialized back to the original type
131-
132-
//Console.WriteLine($"StackExchangeRedisExtensions.Serialize took {SystemTime.DiffTotalMS(dtx)}ms");
133-
122+
//Note: This method seems to convert DateTimeOffset objects to Object, making it impossible to deserialize them into original objects.
123+
//Console.WriteLine($"StackExchangeRedisExtensions.Serialize took: {SystemTime.DiffTotalMS(dtx)}ms");
134124
dtx = SystemTime.Now.DateTime;
135-
var containerBag = StackExchangeRedisExtensions.Deserialize<TestClass>((RedisValue)serializedObj);//11ms
136-
//Console.WriteLine($"StackExchangeRedisExtensions.Deserialize took {SystemTime.DiffTotalMS(dtx)}ms");
137-
125+
var containerBag = StackExchangeRedisExtensions.Deserialize<TestClass>((RedisValue)serializedObj);//11ms
126+
//Console.WriteLine($"StackExchangeRedisExtensions.Deserialize took: {SystemTime.DiffTotalMS(dtx)}ms");
138127
Assert.AreEqual(containerBag.AddTime.Ticks, testClass.AddTime.Ticks);
139128
Assert.AreNotEqual(containerBag.GetHashCode(), testClass.GetHashCode());
140-
141129
}
142130
dt2 = SystemTime.Now.DateTime;
143-
Console.WriteLine($"StackExchangeRedisExtensions���л� {count} �Σ�ʱ�䣺{(dt2 - dt1).TotalMilliseconds}ms");
144-
131+
Console.WriteLine($"StackExchangeRedisExtensions serialized {count} times, time: {(dt2 - dt1).TotalMilliseconds}ms");
145132

146133
dt1 = SystemTime.Now.DateTime;
147134
for (int i = 0; i < count; i++)
@@ -153,24 +140,19 @@ public void CacheWapper_VS_BinaryTest()
153140
AddTime = SystemTime.Now.DateTime,
154141
};
155142

156-
//Simulating CacheWrapper Type issue to test performance; needs to ensure no performance degradation
157-
//testClass.Type = testClass.GetType();
158-
143+
//Simulate the additional workload of CacheWrapper's Type, compare efficiency, the main efficiency loss is in the reflection type
144+
//testClass.Type = testClass.GetType();
159145
var dtx = SystemTime.Now.DateTime;
160146
var serializedObj = Newtonsoft.Json.JsonConvert.SerializeObject(testClass);
161-
//Console.WriteLine($"StackExchangeRedisExtensions.Serialize took {SystemTime.DiffTotalMS(dtx)}ms");
162-
147+
//Console.WriteLine($"StackExchangeRedisExtensions.Serialize took: {SystemTime.DiffTotalMS(dtx)}ms");
163148
dtx = SystemTime.Now.DateTime;
164-
var containerBag = Newtonsoft.Json.JsonConvert.DeserializeObject<TestClass>(serializedObj);//11ms
165-
//Console.WriteLine($"StackExchangeRedisExtensions.Deserialize took {SystemTime.DiffTotalMS(dtx)}ms");
166-
149+
var containerBag = Newtonsoft.Json.JsonConvert.DeserializeObject<TestClass>(serializedObj);//11ms
150+
//Console.WriteLine($"StackExchangeRedisExtensions.Deserialize took: {SystemTime.DiffTotalMS(dtx)}ms");
167151
Assert.AreEqual(containerBag.AddTime.Ticks, testClass.AddTime.Ticks);
168152
Assert.AreNotEqual(containerBag.GetHashCode(), testClass.GetHashCode());
169-
170153
}
171154
dt2 = SystemTime.Now.DateTime;
172-
Console.WriteLine($"Newtonsoft ���л����޷��䣩 {count} �Σ�ʱ�䣺{(dt2 - dt1).TotalMilliseconds}ms");
173-
155+
Console.WriteLine($"Newtonsoft serialization (without reflection) {count} times, time: {(dt2 - dt1).TotalMilliseconds}ms");
174156

175157
dt1 = SystemTime.Now.DateTime;
176158
for (int i = 0; i < count; i++)
@@ -182,24 +164,19 @@ public void CacheWapper_VS_BinaryTest()
182164
AddTime = SystemTime.Now.DateTime,
183165
};
184166

185-
//Simulating CacheWrapper Type issue to test performance; needs to ensure no performance degradation
167+
//Simulate the additional workload of CacheWrapper's Type, compare efficiency, the main efficiency loss is in the reflection type
186168
testClass.Type = testClass.GetType();
187-
188169
var dtx = SystemTime.Now.DateTime;
189170
var serializedObj = Newtonsoft.Json.JsonConvert.SerializeObject(testClass);
190-
//Console.WriteLine($"StackExchangeRedisExtensions.Serialize took {SystemTime.DiffTotalMS(dtx)}ms");
191-
171+
//Console.WriteLine($"StackExchangeRedisExtensions.Serialize took: {SystemTime.DiffTotalMS(dtx)}ms");
192172
dtx = SystemTime.Now.DateTime;
193-
var containerBag = Newtonsoft.Json.JsonConvert.DeserializeObject<TestClass>(serializedObj);//11ms
194-
//Console.WriteLine($"StackExchangeRedisExtensions.Deserialize took {SystemTime.DiffTotalMS(dtx)}ms");
195-
173+
var containerBag = Newtonsoft.Json.JsonConvert.DeserializeObject<TestClass>(serializedObj);//11ms
174+
//Console.WriteLine($"StackExchangeRedisExtensions.Deserialize took: {SystemTime.DiffTotalMS(dtx)}ms");
196175
Assert.AreEqual(containerBag.AddTime.Ticks, testClass.AddTime.Ticks);
197176
Assert.AreNotEqual(containerBag.GetHashCode(), testClass.GetHashCode());
198-
199177
}
200178
dt2 = SystemTime.Now.DateTime;
201-
Console.WriteLine($"Newtonsoft ���л�+���� {count} �Σ�ʱ�䣺{(dt2 - dt1).TotalMilliseconds}ms");
202-
179+
Console.WriteLine($"Newtonsoft serialization + reflection {count} times, time: {(dt2 - dt1).TotalMilliseconds}ms");
203180

204181
dt1 = SystemTime.Now.DateTime;
205182
for (int i = 0; i < count; i++)
@@ -211,28 +188,22 @@ public void CacheWapper_VS_BinaryTest()
211188
AddTime = SystemTime.Now.DateTime,
212189
};
213190

214-
//Simulating CacheWrapper Type issue to test performance; needs to ensure no performance degradation
191+
//Simulate the additional workload of CacheWrapper's Type, compare efficiency, the main efficiency loss is in the reflection type
215192
Expression<Func<TestClass>> fun = () => testClass;
216-
//Console.WriteLine(fun.Body.Type);
217-
193+
//Console.WriteLine(fun.Body.Type);
218194
testClass.Type = fun.Body.Type;
219-
220195
var dtx = SystemTime.Now.DateTime;
221196
var serializedObj = Newtonsoft.Json.JsonConvert.SerializeObject(testClass);
222-
//Console.WriteLine($"StackExchangeRedisExtensions.Serialize took {SystemTime.DiffTotalMS(dtx)}ms");
223-
197+
//Console.WriteLine($"StackExchangeRedisExtensions.Serialize took: {SystemTime.DiffTotalMS(dtx)}ms");
224198
dtx = SystemTime.Now.DateTime;
225-
var containerBag = Newtonsoft.Json.JsonConvert.DeserializeObject<TestClass>(serializedObj);//11ms
226-
//Console.WriteLine($"StackExchangeRedisExtensions.Deserialize took {SystemTime.DiffTotalMS(dtx)}ms");
199+
var containerBag = Newtonsoft.Json.JsonConvert.DeserializeObject<TestClass>(serializedObj);//11ms
200+
//Console.WriteLine($"StackExchangeRedisExtensions.Deserialize took: {SystemTime.DiffTotalMS(dtx)}ms");
227201
Assert.AreEqual(typeof(TestClass), containerBag.Type);
228202
Assert.AreEqual(containerBag.AddTime.Ticks, testClass.AddTime.Ticks);
229203
Assert.AreNotEqual(containerBag.GetHashCode(), testClass.GetHashCode());
230-
231204
}
232205
dt2 = SystemTime.Now.DateTime;
233-
Console.WriteLine($"Newtonsoft ���л���Lambda�� {count} �Σ�ʱ�䣺{(dt2 - dt1).TotalMilliseconds}ms");
234-
206+
Console.WriteLine($"Newtonsoft serialization (Lambda) {count} times, time: {(dt2 - dt1).TotalMilliseconds}ms");
235207
}
236-
237208
}
238-
}
209+
}

src/Senparc.CO2NET.Tests/Helpers/Strings/EncryptHelperTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ public void AESEncryptTest()
9999
{
100100
//Encryption-CEB
101101
var encryptResult = EncryptHelper.AESEncrypt(encypStr, key);
102-
Console.WriteLine("CEB encrypt��" + encryptResult);
102+
Console.WriteLine("CEB encrypt: " + encryptResult);
103103
//Assert.AreEqual("raQCWEp5ngocSs5R8srxkg==", encryptResult);
104104
Assert.IsTrue(encryptResult.Length > 0);
105105

106106
//Encryption-CEB
107107
var cebResult = EncryptHelper.AESDecrypt(encryptResult, key);
108-
Console.WriteLine("CEB decrypt��" + cebResult);
108+
Console.WriteLine("CEB decrypt: " + cebResult);
109109
Assert.AreEqual(encypStr, cebResult);
110110
}
111111
}

src/Senparc.CO2NET.Tests/Trace/SenparcTraceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void BaseExceptionLogTest()
126126
//Wait for execution
127127
}
128128

129-
Assert.IsTrue(UnitTestHelper.CheckKeywordsExist(LogFilePath, "�����쳣", keyword));
129+
Assert.IsTrue(UnitTestHelper.CheckKeywordsExist(LogFilePath, "Test Exception", keyword));
130130
}
131131

132132
[TestMethod]

0 commit comments

Comments
 (0)