XFEExtension
【DLL】XFE各类拓展是一个C#的DLL库,旨在优化C#代码中常用语句的使用,并提供更简洁的访问方式,同时提供Xunit测试框架,快速搭建服务器/客户端,免费ChatGPTAPI接口,免费通讯服务器,XFE下载器,新增格式等
关注
0
Fork
0
Star
0
返回提交历史
Modified
README.md
+7
-20
Modified
README.zh-CN.md
+6
-19
Modified
XFEExtension.NetCore.Analyzer.Test/Program.cs
+2
-4
Modified
XFEExtension.NetCore.Analyzer.Test/XFEExtension.NetCore.Analyzer.Test.csproj
+0
-4
Modified
XFEExtension.NetCore/XFEExtension.NetCore.csproj
+2
-2
Deleted
XFEExtension.NetCore/XUnit/Attributes/CNTestAttribute.cs
+0
-23
Deleted
XFEExtension.NetCore/XUnit/Attributes/CTestAttribute.cs
+0
-21
Deleted
XFEExtension.NetCore/XUnit/Attributes/MNRTestAttribute.cs
+0
-28
Deleted
XFEExtension.NetCore/XUnit/Attributes/MNTestAttribute.cs
+0
-35
Deleted
XFEExtension.NetCore/XUnit/Attributes/MRTestAttribute.cs
+0
-26
Deleted
XFEExtension.NetCore/XUnit/Attributes/MTestAttribute.cs
+0
-21
Deleted
XFEExtension.NetCore/XUnit/Attributes/MethodAndCounter.cs
+0
-10
Deleted
XFEExtension.NetCore/XUnit/Attributes/SMNRTestAttribute.cs
+0
-28
Deleted
XFEExtension.NetCore/XUnit/Attributes/SMNTestAttribute.cs
+0
-30
Deleted
XFEExtension.NetCore/XUnit/Attributes/SMRTestAttribute.cs
+0
-26
Deleted
XFEExtension.NetCore/XUnit/Attributes/SMTestAttribute.cs
+0
-21
Deleted
XFEExtension.NetCore/XUnit/Attributes/TSetUpAttribute.cs
+0
-17
Deleted
XFEExtension.NetCore/XUnit/Attributes/TestThemeAttribute.cs
+0
-54
Deleted
XFEExtension.NetCore/XUnit/Attributes/XFETestAttributeBase.cs
+0
-13
Deleted
XFEExtension.NetCore/XUnit/XFECode.cs
+0
-860
XFEstudio/XFEExtension
移除测试框架相关特性并迁移至独立包
将所有 XUnit 测试特性及实现从主项目中彻底移除,主包自 5.0.0 起不再包含测试相关类型和功能。更新 README 文档,说明测试框架已迁移至 XFEExtension.NetCore.XUnit 独立包,用户需单独引用。调整示例代码和项目依赖,删除所有测试特性类,实现主包与测试框架的完全解耦。
c82b9fc
代码差异
20 个文件
+17
-1262
@@ -238,26 +238,13 @@ string str = testObject.GetAttribute<string>();
238
238
239
239
---
240
240
241
## Using the XUnit testing framework
241
## Testing framework moved to its own package
242
242
243
```csharp
244
[CTest]
245
class TestClass : XFECode
246
{
247
[MTest]
248
void Test()
249
{
250
Assert(true, "assertion content");
251
}
252
}
253
public class Program : XFECode
254
{
255
public static void Main(string[] args)
256
{
257
Pause();
258
}
259
}
260
```
243
Starting with XFEExtension.NetCore 5.0, the testing framework is provided by the
244
`XFEExtension.NetCore.XUnit` 4.0 package. The base extension package no longer
245
defines `XFECode`, `CTest`, `MTest`, or `SMTest`.
246
247
Use `[Test]`, `[TestCase]`, `[Benchmark]`, and `Assert` from the dedicated package.
261
248
262
249
---
263
250
@@ -376,4 +363,4 @@ xFEDownloader.BufferDownloaded += (sender, e) =>
376
363
Console.WriteLine($"Progress: {e.DownloadedBufferSize.FileSize()}/{e.TotalBufferSize?.FileSize()}");
377
364
};
378
365
await xFEDownloader.Download();
379
```
366
```
@@ -238,26 +238,13 @@ string str = testObject.GetAttribute<string>();
238
238
239
239
---
240
240
241
## 使用XUnit测试框架
241
## XUnit 测试框架已迁移
242
242
243
```csharp
244
[CTest]
245
class TestClass : XFECode
246
{
247
[MTest]
248
void Test()
249
{
250
Assert(true, "断言内容");
251
}
252
}
253
public class Program : XFECode
254
{
255
public static void Main(string[] args)
256
{
257
Pause();
258
}
259
}
260
```
243
从 XFEExtension.NetCore 5.0 开始,测试框架由独立的
244
`XFEExtension.NetCore.XUnit` 4.0 包提供。基础扩展包不再定义
245
`XFECode`、`CTest`、`MTest` 或 `SMTest`。
246
247
请改用独立包中的 `[Test]`、`[TestCase]`、`[Benchmark]` 与 `Assert`。
261
248
262
249
---
263
250
@@ -1,14 +1,12 @@
1
1
using XFEExtension.NetCore.XFETransform.ObjectInfoAnalyzer;
2
2
using XFEExtension.NetCore.XFETransform;
3
3
using XFEExtension.NetCore.XFETransform.StringConverter;
4
using XFEExtension.NetCore.XUnit.Attributes;
5
4
6
5
namespace XFEExtension.NetCore.Analyzer.Test;
7
6
8
7
internal class Program
9
8
{
10
[SMTest]
11
public static async void TestNamedPipeAsync()
9
public static void Main()
12
10
{
13
11
var testClass = new TestClass("测试类", "测试描述:我上早八", 56)
14
12
{
@@ -34,4 +32,4 @@ enum MyMultiEnum
34
32
Set = 2,
35
33
Post = 4,
36
34
Pull = 8
37
}
35
}
@@ -11,10 +11,6 @@
11
11
<AutoProfile>false</AutoProfile>
12
12
</PropertyGroup>
13
13
14
<ItemGroup>
15
<PackageReference Include="XFEExtension.NetCore.XUnit" Version="2.0.3" />
16
</ItemGroup>
17
18
14
<ItemGroup>
19
15
<ProjectReference Include="..\XFEExtension.NetCore.Analyzer\XFEExtension.NetCore.Analyzer.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
20
16
<ProjectReference Include="..\XFEExtension.NetCore\XFEExtension.NetCore.csproj" />
@@ -5,7 +5,7 @@
5
5
<ImplicitUsings>enable</ImplicitUsings>
6
6
<Nullable>enable</Nullable>
7
7
<GenerateDocumentationFile>True</GenerateDocumentationFile>
8
<Version>4.2.4</Version>
8
<Version>5.0.0</Version>
9
9
<Title>XFEExtension</Title>
10
10
<RepositoryUrl>https://github.com/XFEstudio/XFEExtension</RepositoryUrl>
11
11
<AnalysisLevel>latest</AnalysisLevel>
@@ -20,7 +20,7 @@
20
20
<PackageReleaseNotes>
21
21
## 调整
22
22
23
提升异常堆栈输出可读性并升级版本号
23
将测试框架迁移到独立的 XFEExtension.NetCore.XUnit 4.0 包,移除基础包中的重复 XUnit 类型。
24
24
25
25
## 新增
26
26
@@ -1,23 +0,0 @@
1
namespace XFEExtension.NetCore.XUnit.Attributes;
2
3
/// <summary>
4
/// 类测试
5
/// </summary>
6
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
7
public sealed class CNTestAttribute : CTestAttribute
8
{
9
/// <summary>
10
/// 类别名
11
/// </summary>
12
public string ClassOtherName { get; set; }
13
/// <summary>
14
/// 类测试
15
/// </summary>
16
/// <param name="values">创建类时构造方法的传参</param>
17
/// <param name="classOtherName">类别名</param>
18
public CNTestAttribute(string classOtherName, params object[] values)
19
{
20
Params = values;
21
ClassOtherName = classOtherName;
22
}
23
}
@@ -1,21 +0,0 @@
1
namespace XFEExtension.NetCore.XUnit.Attributes;
2
3
/// <summary>
4
/// 类测试
5
/// </summary>
6
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
7
public class CTestAttribute : XFETestAttributeBase
8
{
9
/// <summary>
10
/// 类测试
11
/// </summary>
12
/// <param name="values">创建类时构造方法的传参</param>
13
public CTestAttribute(params object[] values)
14
{
15
Params = values;
16
}
17
/// <summary>
18
/// 类测试
19
/// </summary>
20
public CTestAttribute() { }
21
}
@@ -1,28 +0,0 @@
1
namespace XFEExtension.NetCore.XUnit.Attributes;
2
3
/// <summary>
4
/// 方法测试,可自定义名称和返回值
5
/// </summary>
6
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
7
public sealed class MNRTestAttribute : MRTestAttribute
8
{
9
/// <summary>
10
/// 方法别名
11
/// </summary>
12
public string? MethodOtherName { get; set; }
13
/// <summary>
14
/// 方法测试
15
/// </summary>
16
/// <param name="methodOtherName">方法别名</param>
17
/// <param name="valuesAndResult">传参</param>
18
public MNRTestAttribute(string methodOtherName, params object[] valuesAndResult)
19
{
20
MethodOtherName = methodOtherName;
21
ReturnValue = valuesAndResult[^1];
22
Params = valuesAndResult.Take(valuesAndResult.Length - 1).ToArray();
23
}
24
/// <summary>
25
/// 方法测试
26
/// </summary>
27
public MNRTestAttribute() { }
28
}
@@ -1,35 +0,0 @@
1
namespace XFEExtension.NetCore.XUnit.Attributes;
2
3
/// <summary>
4
/// 方法测试,可自定义名称
5
/// </summary>
6
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
7
public sealed class MNTestAttribute : MTestAttribute
8
{
9
/// <summary>
10
/// 方法别名
11
/// </summary>
12
public string? MethodOtherName { get; set; }
13
/// <summary>
14
/// 方法测试
15
/// </summary>
16
/// <param name="methodOtherName">方法别名</param>
17
/// <param name="values">传参</param>
18
public MNTestAttribute(string methodOtherName, params object[] values)
19
{
20
MethodOtherName = methodOtherName;
21
Params = values;
22
}
23
/// <summary>
24
/// 方法测试
25
/// </summary>
26
/// <param name="methodOtherName">方法别名</param>
27
public MNTestAttribute(string methodOtherName)
28
{
29
MethodOtherName = methodOtherName;
30
}
31
/// <summary>
32
/// 方法测试
33
/// </summary>
34
public MNTestAttribute() { }
35
}
@@ -1,26 +0,0 @@
1
namespace XFEExtension.NetCore.XUnit.Attributes;
2
3
/// <summary>
4
/// 方法测试,可自定义返回值
5
/// </summary>
6
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
7
public class MRTestAttribute : MTestAttribute
8
{
9
/// <summary>
10
/// 返回值
11
/// </summary>
12
public object? ReturnValue { get; set; }
13
/// <summary>
14
/// 方法测试
15
/// </summary>
16
/// <param name="valuesAndResult">传参</param>
17
public MRTestAttribute(params object[] valuesAndResult)
18
{
19
ReturnValue = valuesAndResult[^1];
20
Params = valuesAndResult.Take(valuesAndResult.Length - 1).ToArray();
21
}
22
/// <summary>
23
/// 方法测试
24
/// </summary>
25
public MRTestAttribute() { }
26
}
@@ -1,21 +0,0 @@
1
namespace XFEExtension.NetCore.XUnit.Attributes;
2
3
/// <summary>
4
/// 方法测试
5
/// </summary>
6
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
7
public class MTestAttribute : XFETestAttributeBase
8
{
9
/// <summary>
10
/// 方法测试
11
/// </summary>
12
/// <param name="values">传参</param>
13
public MTestAttribute(params object[] values)
14
{
15
Params = values;
16
}
17
/// <summary>
18
/// 方法测试
19
/// </summary>
20
public MTestAttribute() { }
21
}
@@ -1,10 +0,0 @@
1
using System.Reflection;
2
3
namespace XFEExtension.NetCore.XUnit.Attributes;
4
5
class MethodAndCounter(MethodInfo method, int counter, string failMessage)
6
{
7
public MethodInfo Method { get; set; } = method;
8
public int Counter { get; set; } = counter;
9
public string FailMessage { get; set; } = failMessage;
10
}