Conjecture.Interactions 0.29.0

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

Conjecture.Interactions

Transport-agnostic interaction abstractions for Conjecture. Provides the building blocks (IInteraction, IInteractionTarget, InteractionStateMachine<TState>) that satellite packages — Conjecture.Http, Conjecture.Grpc, Conjecture.Messaging, Conjecture.EFCore — implement, so a single property test can drive HTTP + DB + queue side effects through one model.

Install

dotnet add package Conjecture.Core
dotnet add package Conjecture.Interactions

You usually depend on this package transitively via one of the satellite packages. Use it directly when modeling a custom transport.

Usage

using Conjecture.Core;
using Conjecture.Interactions;

public sealed record CounterState(int Value);

public sealed record IncrementInteraction(int By) : IInteraction;

public sealed class Counter : IInteractionTarget
{
    public int Value;

    public Task<object?> ExecuteAsync(IInteraction interaction, CancellationToken ct)
    {
        if (interaction is IncrementInteraction inc)
        {
            this.Value += inc.By;
        }
        return Task.FromResult<object?>(this.Value);
    }
}

public sealed class CounterMachine : InteractionStateMachine<CounterState>
{
    public override CounterState InitialState() => new(0);

    public override IEnumerable<Strategy<IInteraction>> Commands(CounterState state)
    {
        yield return Strategy.Integers<int>(1, 10).Select(by => (IInteraction)new IncrementInteraction(by));
    }

    public override CounterState RunCommand(CounterState state, IInteraction interaction, IInteractionTarget target, CancellationToken ct)
    {
        IncrementInteraction inc = (IncrementInteraction)interaction;
        return state with { Value = state.Value + inc.By };
    }

    public override void Invariant(CounterState state)
    {
        if (state.Value < 0) { throw new InvalidOperationException("counter went negative"); }
    }
}

Then run with:

await Property.ForAll(new Counter(), new CounterMachine());

Types

Type Role
IInteraction Marker interface for interaction messages.
IAddressedInteraction Interaction tied to a named resource.
IInteractionTarget Executes an interaction and returns an optional result.
CompositeInteractionTarget Routes interactions to multiple named targets.
InteractionStateMachine<TState> Stateful test model with Commands, RunCommand, Invariant.
Property.ForAll(...) Runs a property or a state machine with shrinking.
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
0.29.0 104 5/9/2026
0.28.0 100 5/9/2026
0.27.1 251 4/28/2026
0.26.0 184 4/27/2026
0.25.0 173 4/27/2026
0.24.0 158 4/26/2026
0.23.0 158 4/26/2026
0.22.0 138 4/26/2026
0.21.0 128 4/26/2026
0.20.0 111 4/25/2026
0.19.0 108 4/25/2026