XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.XUnit

【DLL】提供方便快捷的测试,无需编写Main方法,可直接添加特性在类或方法上进行测试

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.XUnit

添加项目文件。

5594e7a
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

4 个文件 +113 -0
Added XFE各类拓展.NetCore.XUnit.Analyzer/XFE各类拓展.NetCore.XUnit.Analyzer.csproj +19 -0
@@ -0,0 +1,19 @@
1 <Project Sdk="Microsoft.NET.Sdk">
2
3 <PropertyGroup>
4 <TargetFramework>netstandard2.0</TargetFramework>
5 </PropertyGroup>
6
7 <PropertyGroup>
8 <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
9 <!-- Generates a package at build -->
10 <IncludeBuildOutput>false</IncludeBuildOutput>
11 <!-- Do not include the generator as a lib dependency -->
12 </PropertyGroup>
13
14 <ItemGroup>
15 <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
16 <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all" />
17 </ItemGroup>
18
19 </Project>
Added XFE各类拓展.NetCore.XUnit.Analyzer/XUnitCodeGenerator.cs +37 -0
@@ -0,0 +1,37 @@
1 using Microsoft.CodeAnalysis;
2
3 namespace XFE各类拓展.NetCore.XUnit
4 {
5 [Generator]
6 public class XUnitCodeGenerator : ISourceGenerator
7 {
8 public void Initialize(GeneratorInitializationContext context)
9 {
10 }
11
12 public void Execute(GeneratorExecutionContext context)
13 {
14 // find the main method
15 var mainMethod = context.Compilation.GetEntryPoint(context.CancellationToken);
16
17 // build up the source code
18 string source = $@"
19 using XFE各类拓展.NetCore.XUnit;
20
21 namespace {mainMethod.ContainingNamespace.Name}
22 {{
23 public static class XUnitCode
24 {{
25 public async static Task Main(string[] args)
26 {{
27 await XFECode.RunTest();
28 }}
29 }}
30 }}
31 ";
32 //var typeName = mainMethod.ContainingType.Name;
33 // add the source code to the compilation
34 context.AddSource($"XUnitCode.g.cs", source);
35 }
36 }
37 }
Added XFE各类拓展.NetCore.XUnit.sln +34 -0
@@ -0,0 +1,34 @@
1 
2 Microsoft Visual Studio Solution File, Format Version 12.00
3 # Visual Studio Version 17
4 VisualStudioVersion = 17.8.34525.116
5 MinimumVisualStudioVersion = 10.0.40219.1
6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFE各类拓展.NetCore.XUnit", "XFE各类拓展.NetCore.XUnit\XFE各类拓展.NetCore.XUnit.csproj", "{024C8A43-C965-48EC-A6B8-A06765698D4D}"
7 ProjectSection(ProjectDependencies) = postProject
8 {4E353122-756D-4DBF-A97B-F364DDB2BF5F} = {4E353122-756D-4DBF-A97B-F364DDB2BF5F}
9 EndProjectSection
10 EndProject
11 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFE各类拓展.NetCore.XUnit.Analyzer", "XFE各类拓展.NetCore.XUnit.Analyzer\XFE各类拓展.NetCore.XUnit.Analyzer.csproj", "{4E353122-756D-4DBF-A97B-F364DDB2BF5F}"
12 EndProject
13 Global
14 GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 Debug|Any CPU = Debug|Any CPU
16 Release|Any CPU = Release|Any CPU
17 EndGlobalSection
18 GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 {024C8A43-C965-48EC-A6B8-A06765698D4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 {024C8A43-C965-48EC-A6B8-A06765698D4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 {024C8A43-C965-48EC-A6B8-A06765698D4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 {024C8A43-C965-48EC-A6B8-A06765698D4D}.Release|Any CPU.Build.0 = Release|Any CPU
23 {4E353122-756D-4DBF-A97B-F364DDB2BF5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 {4E353122-756D-4DBF-A97B-F364DDB2BF5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 {4E353122-756D-4DBF-A97B-F364DDB2BF5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 {4E353122-756D-4DBF-A97B-F364DDB2BF5F}.Release|Any CPU.Build.0 = Release|Any CPU
27 EndGlobalSection
28 GlobalSection(SolutionProperties) = preSolution
29 HideSolutionNode = FALSE
30 EndGlobalSection
31 GlobalSection(ExtensibilityGlobals) = postSolution
32 SolutionGuid = {F064F711-9DBD-46B1-AC1E-43E853A6B916}
33 EndGlobalSection
34 EndGlobal
Added XFE各类拓展.NetCore.XUnit/XFE各类拓展.NetCore.XUnit.csproj +23 -0
@@ -0,0 +1,23 @@
1 <Project Sdk="Microsoft.NET.Sdk">
2
3 <PropertyGroup>
4 <TargetFramework>net8.0</TargetFramework>
5 <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
6 <PackageReleaseNotes>XUnit测试框架</PackageReleaseNotes>
7 <Title>XUnit</Title>
8 <Authors>XFEstudio</Authors>
9 <Company>寰宇朽力网络科技有限公司</Company>
10 <Description>提供方便快捷的测试,无需编写Main方法,可直接添加特性在类或方法上进行测试</Description>
11 <Copyright>寰宇朽力网络科技有限公司版权所有</Copyright>
12 </PropertyGroup>
13
14 <ItemGroup>
15 <!-- Package the generator in the analyzer directory of the nuget package -->
16 <None Include="C:\Users\XFEstudio\Desktop\work\C#\OtherProject\CodeAnalyzerTest\CodeAnalyzerTest.Anaylyzer\bin\Debug\netstandard2.0\CodeAnalyzerTest.Anaylyzer.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
17 </ItemGroup>
18
19 <ItemGroup>
20 <PackageReference Include="XFE各类拓展.NetCore" Version="1.5.0" />
21 </ItemGroup>
22
23 </Project>