XiHan.Framework.Testing
5.0.0-preview.2
Prefix Reserved
This is a prerelease version of XiHan.Framework.Testing.
dotnet add package XiHan.Framework.Testing --version 5.0.0-preview.2
NuGet\Install-Package XiHan.Framework.Testing -Version 5.0.0-preview.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XiHan.Framework.Testing" Version="5.0.0-preview.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Framework.Testing" Version="5.0.0-preview.2" />
<PackageReference Include="XiHan.Framework.Testing" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XiHan.Framework.Testing --version 5.0.0-preview.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XiHan.Framework.Testing, 5.0.0-preview.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XiHan.Framework.Testing@5.0.0-preview.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XiHan.Framework.Testing&version=5.0.0-preview.2&prerelease
#tool nuget:?package=XiHan.Framework.Testing&version=5.0.0-preview.2&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
XiHan.Framework.Testing
关于
XiHan.Framework.Testing 是测试基座:没有 HTTP 的内存测试宿主、可注入行为的特性桩、按能力 ID 文本构造清单与独立调用上下文的工具。供框架、提供程序与应用的测试项目引用,也是各一致性套件装配宿主的基础。
主要特性
TestHost在内存里装配并启动应用,调用直接走完整管道StubFeature注入配置、启动、停止行为并记录事件- 不依赖宿主就能构造调用上下文
如何使用
安装
dotnet add package XiHan.Framework.Testing --prerelease
使用
在测试里装配特性、读配置、走一次管道:
var feature = new StubFeature(TestManifests.Create("xihan.test.stub", requires: ["kernel.hosting@1"]));
await using var host = await TestHost.StartAsync(
b => b.UseFeature(feature),
configuration: [new KeyValuePair<string, string?>("XiHan:Kernel:StartTimeoutSeconds", "5")]);
var result = await host.InvokeAsync(static context =>
{
context.SetOutcome(Result.Success());
return ValueTask.CompletedTask;
});
主要类型
此库提供的主要类型:
TestHost:内存测试宿主StubFeature:可注入行为并记录事件的特性桩TestManifests:用能力 ID 文本构造清单TestInvocationContext:不依赖宿主的调用上下文
更多文档
反馈与贡献
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Configuration (>= 10.0.14)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Diagnostics.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options (>= 10.0.14)
- System.Threading.RateLimiting (>= 10.0.14)
- XiHan.Framework.Kernel (>= 5.0.0-preview.2)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on XiHan.Framework.Testing:
| Package | Downloads |
|---|---|
|
XiHan.Framework.Persistence.Conformance
曦寒框架持久化一致性测试套件 |
|
|
XiHan.Framework.Localization.Conformance
曦寒框架本地化一致性测试套件 |
|
|
XiHan.Framework.Messaging.Conformance
曦寒框架消息一致性测试套件 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0-preview.2 | 0 | 11/6/2026 |
| 5.0.0-preview.1 | 44 | 11/4/2026 |