PGMS.ScenarioTesting
5.0.0
dotnet add package PGMS.ScenarioTesting --version 5.0.0
NuGet\Install-Package PGMS.ScenarioTesting -Version 5.0.0
<PackageReference Include="PGMS.ScenarioTesting" Version="5.0.0" />
<PackageVersion Include="PGMS.ScenarioTesting" Version="5.0.0" />
<PackageReference Include="PGMS.ScenarioTesting" />
paket add PGMS.ScenarioTesting --version 5.0.0
#r "nuget: PGMS.ScenarioTesting, 5.0.0"
#:package PGMS.ScenarioTesting@5.0.0
#addin nuget:?package=PGMS.ScenarioTesting&version=5.0.0
#tool nuget:?package=PGMS.ScenarioTesting&version=5.0.0
Introduction
PGMS.CQSLight is a small, open-source library that provides a simple and easy-to-use interface for implementing the Command Query Separation (CQS) pattern in .NET Core applications. The library is designed to be lightweight, flexible, and easy to test.
The CQS pattern is a software design pattern that separates the responsibility of executing a command from the responsibility of querying data. The pattern is based on the idea that a method or function should either change the state of the system or retrieve data, but not both.
In PGMS.CQSLight, commands and queries are separated into different interfaces, and each command and query is handled by a specific handler. The library also provides a simple interface for dispatching commands and handling queries.
PGMS.CQSLight is built with SOLID principles, which makes the code maintainable, scalable, and testable. It's an easy to use library, and it's a good fit for small and medium-sized projects that need to implement the CQS pattern.
PGMS.ScenarioTesting
Scenario testing framework for integration and end-to-end testing
This package provides a structured approach to writing scenario-based integration tests using the Given-When-Then pattern with NUnit.
Key Features
Scenario Test Framework:
BaseScenarioTestbase class for organizing tests with Given/When/Then structureTest Actions:
ScenarioTestCommand<T>: Execute commands in test scenariosScenarioTestQuery<T, TResult>: Execute queries with result validationScenarioTestCommandWithValidationFailure<T>: Test expected validation failuresScenarioTestDataValidation: Validate data state using repositoryScenarioTestDataManipulation: Manipulate test data directly
Test Helpers:
IScenarioTestHelper: Abstraction for test executionScenarioTestHelperInMemoryImplementation<TContext>: In-memory testing with Autofac containerScenarioTestHelperIntegratedImplementation<TContext>: Integration testing against real database or API
API Testing:
ICqsApiHelperfor testing CQS operations through HTTP APIs with RestSharp
Usage
Scenario tests provide a clear, readable structure for integration tests:
- Givens: Set up initial state (run once before all tests)
- Actions: Execute commands and queries with validation
- Assertions: Verify expected outcomes
This approach makes tests self-documenting and easier to maintain, while supporting both in-memory and integrated testing strategies.
Getting Started
Have a look at our sample app based on PGMS.CQSLight: GitHub Repository
Version 5.X ⇒ DotNet 10.0
Version 4.X ⇒ DotNet 8.0
Version 3.X ⇒ DotNet 6.0
Version 2.X ⇒ DotNet 5.0
| 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. |
-
net10.0
- NUnit (>= 4.4.0)
- PGMS.CQSLight.UnitTestUtilities (>= 5.0.0)
- RestSharp (>= 112.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.