ProtoTest.Devices 1.1.2

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

ProtoTest.Devices

Preview: the surface can change before 1.2.

Talk to devices - simulators or hardware - from the same test context, lifecycle and trace. A suite declares a named device client once and gets typed device instances per test by id.

dotnet add package ProtoTest.Devices
dotnet add package ProtoTest.Devices.WebSocket              # ws:// and wss:// endpoints
dotnet add package ProtoTest.Devices.WebSocket.AspNetCore   # in-process endpoints, no socket
dotnet add package ProtoTest.Devices.Mqtt                   # MQTT publish/subscribe
dotnet add package ProtoTest.Devices.Mqtt.Testcontainers  # a Mosquitto broker owned by the run
dotnet add package ProtoTest.Devices.Tcp                    # raw TCP, connecting out or listening
dotnet add package ProtoTest.Devices.Serial                 # COM ports and /dev/tty lines

Includes

  • Named device clients declared once, mirroring the REST and GraphQL builders: devices.AddWebSocketClient("Chargers", path: "/ocpp/{deviceId}").AddDevice<AcCharger>() or devices.AddMqttClient("Meters", "meters/{deviceId}/out", "meters/{deviceId}/in").AddDevice<FlowMeter>().
  • Typed device classes: derive from ProtoDevice, add domain methods, and compose the protected ConnectAsync, SendAsync, ReceiveAsync and ExpectAsync primitives.
  • Per-test instances through Proto.Context.Devices("Chargers").For<AcCharger>("CP-001"), released with the test.
  • Addresses resolve per test: an explicit template ({deviceId} filled in), a resolver, or the application's address when the client is registered inside AddApplication.
  • Per-client transport settings through WithSetting, filled per device ({deviceId} included) and read by the transport through DeviceEndpoint.Setting; a credential belongs here, not in the traced address.
  • Trace operations (device.connect/send/receive/command) and a device entity with client, type, transport, address and connection state; the release path disconnects the device and records it.
  • Assertion-level coverage: a matched expectation records its message kind, and the client's protocol catalog reports kinds no test asserted as gaps.
  • Stream framing for TCP, serial and custom stream transports: DeviceFramers.Lines, Delimited, Enveloped, LengthPrefixed and FixedLength, set per client with WithFramer, and StreamDeviceConnection for a stream of your own.
  • Device messages as records: text (DeviceMessage.Format/Parse, prefix, separator or fixed widths) or binary ([DeviceBinaryMessage], ToBytes/FromBytes), with [DeviceChecksum<T>] (NMEA, CRC-16/Modbus, XOR, sum) and [DeviceFormat<T>] field formatters (DeviceFormatters: scaled, hex, Unix time, BCD). SendMessageAsync/ExpectMessageAsync on the device, and DeviceMessageProtocol for coverage per message type.
  • ListenAsync for transports the system under test connects to, such as AddTcpListener.
  • [RequiresDevice<TDevice>] skips tests the environment cannot run.

Limits

  • One instance per (client, type, id) per test; devices are not shared across tests.
  • One conversation per device instance: connect is single-flight, sends are serialized, one receive is in flight at a time, and a send racing a disconnect fails with a device error naming the device.
  • An in-process endpoint needs ProtoTest.Devices.WebSocket.AspNetCore; the socket transport reaches published addresses. A client is only routed through its own application's in-process transport.
  • ExpectAsync consumes frames; the bounded exchange log is for failure messages.

Learn more

Product 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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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 (5)

Showing the top 5 NuGet packages that depend on ProtoTest.Devices:

Package Downloads
ProtoTest.Devices.WebSocket

WebSocket transport for ProtoTest.Devices: talk to devices over ws:// or wss://.

ProtoTest.Devices.Serial

Serial transport for ProtoTest.Devices: talk to devices on a COM port or /dev/tty line with the same framing as the TCP transport.

ProtoTest.Devices.Tcp

TCP transport for ProtoTest.Devices: talk to devices over a raw socket, connecting out or listening, with framing for line, delimited and length-prefixed protocols.

ProtoTest.Devices.WebSocket.AspNetCore

In-process WebSocket device connections for ProtoTest: reach an application's endpoint through its TestServer, no socket.

ProtoTest.Devices.Mqtt

MQTT transport for ProtoTest.Devices: talk to devices over publish/subscribe against a real broker.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.6 54 10/4/2026
1.1.5 66 10/3/2026
1.1.4 50 10/3/2026
1.1.3 59 10/3/2026
1.1.2 68 10/3/2026
1.1.1 56 10/2/2026
1.1.0 68 10/2/2026