JoanComas.ScenarioUnitTesting
1.2.6
dotnet add package JoanComas.ScenarioUnitTesting --version 1.2.6
NuGet\Install-Package JoanComas.ScenarioUnitTesting -Version 1.2.6
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="JoanComas.ScenarioUnitTesting" Version="1.2.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JoanComas.ScenarioUnitTesting --version 1.2.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: JoanComas.ScenarioUnitTesting, 1.2.6"
#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 JoanComas.ScenarioUnitTesting as a Cake Addin #addin nuget:?package=JoanComas.ScenarioUnitTesting&version=1.2.6 // Install JoanComas.ScenarioUnitTesting as a Cake Tool #tool nuget:?package=JoanComas.ScenarioUnitTesting&version=1.2.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
.NET Scenario Unit Testing
A very easy way to write Unit Tests in xUnit, leveraging NSubstitute and AutoFixture, complemented with FluentAssertions.
Usage
- Decorate your test with
[Theory, AutoData]
. - Add a
Scenario<MyClass>
parameter to the test method. - Use the
Dependency<T>
method to get a Mock, then configure it or assert it. - Use the
When()
method to get the instance of the System Under Test.
Example:
[Theory, AutoData]
public void ExampleTest(Scenario<MyClass> scenario)
{
scenario.Dependency<IMyInterface>().GetSomething(true).Returns(123);
scenario.When().DoSomething();
scenario.Dependency<IMyInterface>()
.Received()
.GetSomething(true);
}
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
- AutoFixture (>= 4.18.1)
- AutoFixture.AutoNSubstitute (>= 4.18.1)
- AutoFixture.Xunit2 (>= 4.18.1)
- FluentAssertions (>= 6.12.0)
- Newtonsoft.Json (>= 13.0.3)
- NSubstitute (>= 5.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on JoanComas.ScenarioUnitTesting:
Package | Downloads |
---|---|
JoanComas.ScenarioUnitTesting.AspNetCore
Simplify your controller unit tests with a Scenario<T> class as a single point to access the class under test and its dependencies, leveraging xUnit, AutoFixture and NSubstitute. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Upgraded to .NET 8.