System.Reactive
dotnet add package Nullean.Entities.Reactive
dotnet add package Nullean.Entities.CsCheck.Reactive
- rules on a live IObservable<T>
- tests only: generated scripts on a virtual Rx clock
The core package and the default CsCheck package do not depend on System.Reactive. A service that records timestamped events is tested without it (see Time and events). Add these packages when the service is built on observables.
Nullean.Entities.Reactiveattaches a set of named rules to anIObservable<TEvent>and gives a verdict per rule,Pending,HoldsorViolated, as events arrive: "wasShippedever emitted afterCancelled?", "did every placed order ship within an hour?". It is trim and NativeAOT clean.C# var spec = ReactiveConstraintSet.From(("never-shipped-after-cancellation", Never<OrderEvent.Cancelled, OrderEvent.Shipped>((c, s) => c.OrderId == s.OrderId))); MonitoredConstraintSet<OrderEvent> monitored = spec.Attach(events);- monitored.AnyViolated, monitored.Violations
Nullean.Entities.CsCheck.Reactiveruns a generatedScript<TSut>against the service on aHistoricalSchedulerthat the generated delays advance, then checks the rules against the events it emitted. A 48-hour deadline is tested without waiting, and a failure comes back as the shortest call sequence with a seed:C# script.SampleWith(scheduler => new Shipments(scheduler), s => s.Events, shipsWithinAMinute);
The terminals and their options are in Rx scripts.