PostSharp.Testing.AspectTesting
2027.0.7-preview
Prefix Reserved
Requires NuGet 2.12 or higher.
dotnet add package PostSharp.Testing.AspectTesting --version 2027.0.7-preview
NuGet\Install-Package PostSharp.Testing.AspectTesting -Version 2027.0.7-preview
<PackageReference Include="PostSharp.Testing.AspectTesting" Version="2027.0.7-preview" />
<PackageVersion Include="PostSharp.Testing.AspectTesting" Version="2027.0.7-preview" />
<PackageReference Include="PostSharp.Testing.AspectTesting" />
paket add PostSharp.Testing.AspectTesting --version 2027.0.7-preview
#r "nuget: PostSharp.Testing.AspectTesting, 2027.0.7-preview"
#:package PostSharp.Testing.AspectTesting@2027.0.7-preview
#addin nuget:?package=PostSharp.Testing.AspectTesting&version=2027.0.7-preview&prerelease
#tool nuget:?package=PostSharp.Testing.AspectTesting&version=2027.0.7-preview&prerelease
A test framework for PostSharp aspects, based on xunit.v3. Each source file of the test project is a test: the framework
compiles it, weaves it with PostSharp, verifies the woven assembly, and runs its Main method. A test passes when the
weaving reports the expected messages and the program returns 0.
Create an xunit.v3 test project, reference this package, the xunit.v3 package and the packages of your aspects, and add
test files to it. The files are not compiled into the test project: the framework compiles each one separately.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit.v3" Version="4.0.1" />
<PackageReference Include="PostSharp.Testing.AspectTesting" Version="..." />
<PackageReference Include="MyAspects" Version="..." />
</ItemGroup>
</Project>
A test file configures its test with directives in comments. For example, // @ExpectedMessage(MY001) expects the
message MY001 that your aspect reports when it is misused, // @SkipRuntime weaves and verifies the test without
running it, and // @TestRun(Name) runs the test once more under that name. Run the tests as any xunit.v3 test project, with dotnet test or the test executable.
To compare the output of each program and the messages of its build with files next to the test, set
PostSharpTestOutputFileSuffix (such as .txt for Foo.txt) and PostSharpTestMessagesFileSuffix (such as .build.txt)
in the test project. A missing file stands for an empty result. When a result differs, the test fails and the actual result
is written next to the expected file (Foo.actual.txt). Run dotnet build -t:AcceptTestOutput on the test project to
copy the actual results over the expected files, or run the tests with dotnet test -p:PostSharpTestAcceptResults=True to
overwrite the expected files instead of comparing them.
To see what PostSharp wove, add // @CompareTransformedCode to a test file. The framework decompiles the woven assembly to
C# and compares it with Foo.t.cs next to the test, with the same rules and the same accept commands. Only the
declarations marked with a // <target> comment are shown, or every type of the file when none is marked.
To run the same tests twice in a report that merges tests of the same name, set PostSharpTestDisplayNameSuffix in one of
the runs, such as dotnet test -p:PostSharpTestDisplayNameSuffix=Release: the display name of each test then ends with
[Release].
| 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. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- ICSharpCode.Decompiler (>= 11.1.0.9782)
- Microsoft.CodeAnalysis.CSharp (>= 5.0.0)
- Microsoft.CodeAnalysis.VisualBasic (>= 5.0.0)
- Microsoft.ILVerification (>= 10.0.0)
- PostSharp (>= 2027.0.7-preview)
- System.Memory (>= 4.6.3)
- System.Text.Json (>= 8.0.5)
- xunit.v3.assert (>= 4.0.1)
- xunit.v3.extensibility.core (>= 4.0.1)
-
net10.0
- ICSharpCode.Decompiler (>= 11.1.0.9782)
- Microsoft.Build.Utilities.Core (>= 17.6.3)
- Microsoft.Diagnostics.NETCore.Client (>= 0.2.661903)
- Microsoft.ILVerification (>= 10.0.0)
- PostSharp (>= 2027.0.7-preview)
- System.Management (>= 8.0.0)
- xunit.v3.assert (>= 4.0.1)
- xunit.v3.extensibility.core (>= 4.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2027.0.7-preview | 46 | 10/27/2026 |
| 2027.0.5-preview | 63 | 10/16/2026 |