PGMS.CQSLight.UnitTestUtilities 5.0.0

dotnet add package PGMS.CQSLight.UnitTestUtilities --version 5.0.0
                    
NuGet\Install-Package PGMS.CQSLight.UnitTestUtilities -Version 5.0.0
                    
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="PGMS.CQSLight.UnitTestUtilities" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PGMS.CQSLight.UnitTestUtilities" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="PGMS.CQSLight.UnitTestUtilities" />
                    
Project file
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 PGMS.CQSLight.UnitTestUtilities --version 5.0.0
                    
#r "nuget: PGMS.CQSLight.UnitTestUtilities, 5.0.0"
                    
#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 PGMS.CQSLight.UnitTestUtilities@5.0.0
                    
#: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=PGMS.CQSLight.UnitTestUtilities&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=PGMS.CQSLight.UnitTestUtilities&version=5.0.0
                    
Install as a Cake Tool

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.CQSLight.UnitTestUtilities

Unit test utilities for PGMS.CQSLight - Fake implementations and in-memory repositories

This package provides essential testing utilities to facilitate unit testing of applications built with PGMS.CQSLight.

Key Features

  • Fake Implementations:

    • FakeBus: In-memory bus that tracks published events and commands for verification
    • FakeQueryProcessor: Stub query processor for testing
    • FakeDataService: Simple ID generator for testing
    • FakeUnitOfWork / FakeTransaction: No-op implementations for testing without database
  • In-Memory Repository: InMemoryEntityRepository - fully functional in-memory implementation of IEntityRepository

    • Supports all CRUD operations
    • LINQ query support with filtering, ordering, and pagination
    • No database required - perfect for fast unit tests
  • In-Memory Reporting Repository: InMemoryReportingRepository<TContext> - enhanced version with navigation property resolution

    • Automatically resolves entity relationships based on EF Core model metadata
    • Supports both one-to-many and many-to-one relationships
    • Perfect for testing queries with complex object graphs

Usage

These utilities enable fast, isolated unit tests without the need for a database connection. Use FakeBus to verify that commands publish the expected events, and InMemoryEntityRepository to test query handlers and event handlers with in-memory data.


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 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PGMS.CQSLight.UnitTestUtilities:

Package Downloads
PGMS.ScenarioTesting

Data Layer

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0 560 11/17/2025
5.0.0-RC2 203 11/14/2025
5.0.0-RC1 198 11/14/2025
4.2.12.8 8,768 10/14/2025
4.2.12.7 182 10/14/2025
4.2.12.6 2,577 9/26/2025
4.2.12.5 448 9/24/2025
4.2.12.4 290 9/13/2025
4.2.12.3 103 9/13/2025
4.2.12.2 196 9/6/2025
4.2.12.1 203 8/14/2025
4.2.11.5 27,108 5/1/2025
4.2.11.5-RC3 172 3/17/2025
4.2.11.5-RC2 165 3/17/2025
4.2.11.5-RC1 156 3/17/2025
4.2.11.4 9,228 1/7/2025
4.2.11.3 217 1/6/2025
4.2.11.2 624 12/20/2024
4.2.1.11 198 12/20/2024
4.2.0.11 1,661 11/25/2024
4.2.0.10 262 11/20/2024
4.2.0.9 185 11/11/2024
4.2.0.8 7,207 4/28/2024
4.2.0.8-preview2 996 2/5/2024
4.2.0.8-preview1 132 2/5/2024
3.2.0.7 2,256 12/23/2023
3.2.0.6 193 12/23/2023
3.2.0.5 7,541 5/26/2023
3.2.0.4 693 5/10/2023
3.2.0.3 225 5/5/2023
3.2.0.2 236 5/1/2023
3.2.0.1 1,976 11/25/2022
3.2.0-beta 357 11/10/2022
3.1.1.2 604 9/29/2022
3.1.1.1 684 9/16/2022
3.1.1 562 9/15/2022
3.1.0.7 521 9/11/2022
3.1.0 643 7/14/2022