QaaS.Mocker 2.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package QaaS.Mocker --version 2.0.3
                    
NuGet\Install-Package QaaS.Mocker -Version 2.0.3
                    
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="QaaS.Mocker" Version="2.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="QaaS.Mocker" Version="2.0.3" />
                    
Directory.Packages.props
<PackageReference Include="QaaS.Mocker" />
                    
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 QaaS.Mocker --version 2.0.3
                    
#r "nuget: QaaS.Mocker, 2.0.3"
                    
#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 QaaS.Mocker@2.0.3
                    
#: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=QaaS.Mocker&version=2.0.3
                    
Install as a Cake Addin
#tool nuget:?package=QaaS.Mocker&version=2.0.3
                    
Install as a Cake Tool

QaaS.Mocker

Configurable mock runtime for QaaS protocol workloads.

CI Line Coverage Branch Coverage Docs .NET

Contents

Overview

This repository contains one solution: QaaS.Mocker.sln.

QaaS.Mocker is published as a single NuGet package and composes internal runtime modules for stubs, protocol servers, and optional Redis controller operations.

Packages

Package Latest Version Total Downloads
QaaS.Mocker NuGet Downloads

Functionalities

QaaS.Mocker

  • Parses CLI options and loads YAML configuration with overwrite files/arguments and optional environment resolution.
  • Builds and validates execution context, data sources, stubs, one or more server runtimes, and optional controller runtime.
  • Supports execution modes: Run, Lint, and Template.

QaaS.Mocker.Stubs

  • Builds transaction stubs from configured processors and data source bindings.
  • Executes request/response transformation through configurable serializer/deserializer pairs.
  • Includes default status-code stubs for not-found and internal-error flows.

QaaS.Mocker.Servers

  • Hosts protocol runtimes for HTTP/HTTPS, gRPC/gRPCs, and Socket.
  • Routes actions/RPC methods to transaction stubs through state objects.
  • Caches input/output payloads for controller consume operations.

QaaS.Mocker.Controller

  • Initializes optional Redis-backed runtime controller when configured.
  • Handles Ping and Command channels.
  • Supports runtime commands such as action-to-stub switch, trigger, and consume.

QaaS.Mocker.Example

  • Provides runnable multi-server and transport-specific mocker configurations, sample processors, protobuf schema, and sample data assets.

Protocol Support

Supported protocol/runtime families in QaaS.Mocker:

Family Implementations
HTTP / RPC HTTP, HTTPS, gRPC, gRPCs
Streaming / Socket Socket (broadcast and collect modes)
Runtime Control Redis-backed controller channels (ping and command)

Quick Start

Install package:

dotnet add package QaaS.Mocker

Upgrade package:

dotnet add package QaaS.Mocker --version <target-version>
dotnet restore

Run the Example

The example uses relative paths for certificates, sample data, and socket payloads, so run it from QaaS.Mocker.Example. The example entry point also disables environment-variable overrides by default so IDE terminal variables do not rewrite the sample configuration.

  1. Open a terminal in the example directory.
Set-Location .\QaaS.Mocker.Example
  1. Create the development certificate expected by the sample HTTPS and gRPC configs.
dotnet dev-certs https -ep .\Certificates\devcert.pfx -p qaas-dev-cert
  1. Start the combined example. It boots HTTPS, gRPC with TLS, and a TCP socket collect endpoint from the same process.
dotnet run -- run mocker.qaas.yaml
  1. In a second terminal, call the HTTPS health endpoint.
curl.exe -k https://127.0.0.1:8443/health
  1. Call the gRPC endpoint from Git Bash, WSL, or another POSIX-style shell if you have grpcurl installed.
grpcurl -insecure -import-path Protos -proto echo.proto -d '{"message":"hello"}' 127.0.0.1:50051 qaas.mocker.example.EchoService/Echo
  1. Send a payload to the socket collect endpoint. The socket endpoint does not reply; success is a clean connect and write plus a collect log entry in the server terminal.
$client = [System.Net.Sockets.TcpClient]::new()
$client.Connect('127.0.0.1', 7001)
$stream = $client.GetStream()
$payload = [System.Text.Encoding]::UTF8.GetBytes('socket-check')
$stream.Write($payload, 0, $payload.Length)
$stream.Flush()
$stream.Dispose()
$client.Dispose()
  1. Generate the effective combined configuration without using --mode.
dotnet run -- template mocker.qaas.yaml
  1. If you still want the dedicated gRPC-only sample, it remains available.
dotnet run -- run mocker.grpc.qaas.yaml

Runner Integration Overlay

The example now includes mocker.runner.qaas.yaml, an overwrite file that appends only the runner-integration pieces missing from mocker.qaas.yaml:

  • Redis controller configuration for runner mocker commands
  • Alternate stubs for ChangeActionStub checks on HTTP, gRPC, and socket
  • A socket broadcast endpoint on port 6000 for TriggerAction

The overlay uses explicit numeric indexes for list sections so it can be appended with --overwrite-files without editing the base sample.

Use it together with the base file instead of editing the base sample:

  1. Start local Redis:
docker run -d --name qaas-redis -p 6379:6379 redis:7-alpine
  1. Ensure the sample certificate exists:
Set-Location .\QaaS.Mocker.Example
dotnet dev-certs https -ep .\Certificates\devcert.pfx -p qaas-dev-cert
  1. Run the sample plus the overlay:
dotnet run -- run mocker.qaas.yaml --overwrite-files mocker.runner.qaas.yaml

The combined runtime exposes:

  • HTTPS health endpoint on https://127.0.0.1:8443/health
  • TLS gRPC endpoint on 127.0.0.1:50051
  • TCP socket collect endpoint on 127.0.0.1:7001
  • TCP socket broadcast endpoint on 127.0.0.1:6000
  • Redis controller under server name RunnerMockerExample

The broadcast endpoint is disabled by default and becomes active only when the runner sends TriggerAction for SocketBroadcastAction.

Build and Test

dotnet restore QaaS.Mocker.sln
dotnet build QaaS.Mocker.sln -c Release --no-restore
dotnet test QaaS.Mocker.sln -c Release --no-build

Documentation

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

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
2.1.1 103 3/28/2026
2.1.0 69 3/25/2026
2.0.6 99 3/23/2026
2.0.6-alpha.1 35 3/22/2026
2.0.5 130 3/21/2026
2.0.5-alpha.4 33 3/22/2026
2.0.5-alpha.3 36 3/21/2026
2.0.5-alpha.1 37 3/21/2026
2.0.4 85 3/21/2026
2.0.3 80 3/17/2026
2.0.2 74 3/17/2026
2.0.1 85 3/16/2026
2.0.0 82 3/16/2026
2.0.0-alpha.12 40 3/15/2026
2.0.0-alpha.11 39 3/15/2026
2.0.0-alpha.7 45 3/11/2026
2.0.0-alpha.6 37 3/6/2026
2.0.0-alpha.5 36 3/5/2026
2.0.0-alpha.4 36 3/5/2026
2.0.0-alpha.3 35 3/5/2026
Loading failed