FluxFlow.Components.Expectations 3.0.1

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

FluxFlow.Components.Expectations

A standalone event-expectation node for FluxFlow.

What it is

EventExpectationNode is a self-contained TPL Dataflow processor built on the FluxFlow.Nodes kit. You give it options, post ProjectionEvents to its input, and it resolves exactly once into a single EventExpectationResult broadcast on its output (failures on the error port, diagnostics on the event port). It needs nothing else — no engine, registry, or runtime:

await using var node = new EventExpectationNode(new EventExpectationOptions
{
    Kind = EventExpectationNodeKind.Expect,
    Name = "order-completed",
    TimeoutMilliseconds = 5000,
    Filter = new EventFilter
    {
        Type = "operation.completed",
        Status = "ok",
        SubjectPrefix = "orders/"
    }
});

node.Output.LinkTo(asserter.Input);  // broadcast: link to as many consumers as you like

await node.Input.SendAsync(FlowMessage.Create(@event));

An Expect node is satisfied when a matching event arrives; a Guard node is satisfied when none arrives. The node resolves on the first of three triggers:

  • a matching event,
  • a configured timeout (armed over the injected TimeProvider),
  • input completion via CompleteWithResultAsync().

EventExpectationOptions validates at construction: non-positive TimeoutMilliseconds, negative MaxObservedEvents, negative MaxPreviewChars, or non-positive BoundedCapacity fails fast as an argument exception.

Ports

Port Block Purpose
Input BufferBlock<FlowMessage<ProjectionEvent>> bounded intake — SendAsync applies backpressure
Output BroadcastBlock<FlowMessage<EventExpectationResult>> the single result, fanned out to every linked consumer
Errors BroadcastBlock<FlowError> evaluation failures
Events BroadcastBlock<FlowEvent> event.expectation.matched / .timed-out / .completed diagnostics

The result carries the correlation id of the matching event (or, on timeout and completion, the last observed event's id) so correlation flows event → result via the FlowMessage<T> envelope.

Result

EventExpectationResult includes:

  • evaluated timestamp
  • expectation name
  • expectation kind
  • satisfied flag
  • matched flag
  • timeout flag
  • matched event summary when one exists
  • recent observed event summaries
  • filter copy
  • reason text

Filters

Expectations use the same neutral EventFilter contract as the Projections package (the shared ProjectionEvent / EventFilter / EventFilterMatcher contracts come from FluxFlow.Components.Projections). Filters support:

  • event type or type prefix
  • subject prefix
  • channel prefix
  • excluded subject prefix
  • excluded channel prefix
  • status
  • source
  • source node id
  • component id through an event attribute named componentId
  • attribute key/value pairs
  • event timestamp range

Filters use ordinal string comparison.

Timing

Pass a TimeProvider to the constructor for deterministic timeout and result timestamps in tests or hosts. The timeout is armed via TimeProvider.CreateTimer, so a FakeTimeProvider drives it by advancing the clock — no real-time wait.

var node = new EventExpectationNode(options, timeProvider);

Composition

Building a workflow — reading config, creating nodes, linking them — is a separate concern from the node. This package is just the standalone node.

Use FluxFlow.Components.Expectations.Composition when a FluxFlow.Composition host should register the optional event.expectation factory:

services
    .AddFluxFlowComposition(configuration)
    .RegisterNodes(registry => registry.RegisterEventExpectation());

The composition adapter binds EventExpectationOptions from node configuration and can resolve an optional keyed TimeProvider resource named clock.

The optional composition package also exposes ExpectationsComponentDesignMetadataProvider for neutral Designer metadata over the event.expectation composition node type. The standalone Expectations package remains free of Designer, Composition, and Engine dependencies.

CompleteWithResultAsync() remains a direct node lifecycle feature in v1. Composition runtime stop uses normal node completion. Use the direct node API when a completion-result flush is required until composition grows an explicit final-flush lifecycle hook.

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 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on FluxFlow.Components.Expectations:

Package Downloads
FluxFlow.Components.Expectations.Composition

Canonical projection-event expectation registration and Designer metadata over exact host-owned clock addresses.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.0.0-rc.1 86 9/5/2026
6.0.0 181 8/3/2026
3.0.2 120 7/3/2026
3.0.1 176 7/2/2026
3.0.0 123 6/19/2026
2.0.0 125 6/18/2026
1.2.0 117 6/12/2026
1.1.0 128 6/12/2026
1.0.0 127 6/4/2026
0.1.0-alpha.1 73 6/3/2026

Aligns constructor option validation with standalone node conventions: invalid timeoutMilliseconds, maxObservedEvents, maxPreviewChars, and boundedCapacity now report ArgumentOutOfRangeException with expectation option names. Runtime expectation behavior is unchanged.