Neon.Roslyn.Xunit
4.0.8
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Neon.Roslyn.Xunit --version 4.0.8
NuGet\Install-Package Neon.Roslyn.Xunit -Version 4.0.8
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="Neon.Roslyn.Xunit" Version="4.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Neon.Roslyn.Xunit --version 4.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Neon.Roslyn.Xunit, 4.0.8"
#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.
// Install Neon.Roslyn.Xunit as a Cake Addin #addin nuget:?package=Neon.Roslyn.Xunit&version=4.0.8 // Install Neon.Roslyn.Xunit as a Cake Tool #tool nuget:?package=Neon.Roslyn.Xunit&version=4.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Neon.Roslyn.Xunit
This package provides some utilities to test Roslyn analyzers, code fix providers, and source generators using FluentAssertions.
Install
dotnet add package Neon.Roslyn.Xunit
Testing an analyzer
Verify generated source code
var inputSource = @"
namespace MyNamespace
{
public partial class MyClass
{
public void MyMethod()
{
Console.WriteLine(""Hello, World!"");
}
}
}";
var expectedSource = @"
namespace MyNamespace
{
public partial class MyClass
{
public void MyGeneratedMethod()
{
Console.WriteLine(""Hello, Roslyn!"");
}
}
}";
var testCompilation = new TestCompilationBuilder()
.AddSourceGenerator<MySourceGenerator>()
.AddSource(source)
.Build();
// verify that the expected source code was generated
testCompilation.Should().ContainSource(expectedSource);
// verify the number of generated source files
testCompilation.Sources.Should().HaveCount(1);
Verify diagnostics
var testCompilation = new TestCompilationBuilder()
.AddSourceGenerator<MySourceGenerator>()
.AddSource(mySource)
.Build();
// verify the number of diagnostics
testCompilation.Diagnostics.Should().HaveCount(2);
// verify the specific diagnostics using the diagnostic code
testCompilation.Should().HaveDiagnostics(["D1001", "D1002"]);
// verify the specific diagnostics using the diagnostic descriptor
testCompilation.Should().HaveDiagnostic(
diagnostic: Diagnostic.Create(
descriptor: MyDiagnosticDescriptor,
location: Location.None,
messageArgs: ["foo", 123]));
Adding assemblies to the compilation
var testCompilation = new TestCompilationBuilder()
.AddSourceGenerator<MySourceGenerator>()
.AddAssembly(typeof(MyType).Assembly)
.Build();
Adding MSBuild options to the compilation
var testCompilation = new TestCompilationBuilder()
.AddSourceGenerator<MySourceGenerator>()
.AddOption("build_property.TargetFramework", "net8.0")
.Build();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- FluentAssertions (>= 6.12.0)
- Neon.Common (>= 4.0.8)
- Neon.Roslyn (>= 4.0.8)
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 |
---|---|---|
4.0.13-preview.11 | 60 | 8/9/2024 |
4.0.13-preview.10 | 56 | 8/9/2024 |
4.0.13-preview.9 | 61 | 8/9/2024 |
4.0.13-preview.8 | 58 | 8/9/2024 |
4.0.13-preview.3 | 33 | 8/1/2024 |
4.0.12 | 73 | 7/30/2024 |
4.0.11-preview.6 | 46 | 7/30/2024 |
4.0.11-preview.4 | 52 | 7/3/2024 |
4.0.11-preview.3 | 53 | 6/15/2024 |
4.0.11-preview.2 | 54 | 6/7/2024 |
4.0.11-preview.1 | 57 | 6/6/2024 |
4.0.11-preview.0 | 51 | 6/3/2024 |
4.0.10 | 115 | 4/25/2024 |
4.0.10-preview.0 | 66 | 4/25/2024 |
4.0.9 | 120 | 4/25/2024 |
4.0.8 | 211 | 3/29/2024 |
4.0.7 | 116 | 3/22/2024 |
4.0.6 | 131 | 3/19/2024 |
4.0.5 | 117 | 3/17/2024 |
4.0.4 | 175 | 2/24/2024 |
4.0.4-rc.12 | 72 | 2/24/2024 |
4.0.4-rc.11 | 59 | 2/23/2024 |
4.0.4-rc.10 | 68 | 2/22/2024 |
4.0.4-rc.8 | 69 | 2/21/2024 |
4.0.4-rc.7 | 69 | 2/21/2024 |
4.0.4-rc.6 | 65 | 2/21/2024 |
4.0.4-rc.5 | 62 | 2/21/2024 |
4.0.4-rc.4 | 64 | 2/21/2024 |
4.0.4-rc.2 | 54 | 2/20/2024 |
4.0.4-rc.1 | 65 | 2/16/2024 |
4.0.3 | 137 | 2/15/2024 |
4.0.3-rc.2 | 57 | 2/15/2024 |
4.0.3-rc.1 | 61 | 2/15/2024 |
4.0.2 | 101 | 2/15/2024 |
4.0.1 | 134 | 2/14/2024 |