ferroui_reactive_testing
module · ferroui-reactive-testing · v0.5.0
module ferroui_reactive_testing
ferroui-reactive-testing
A port of Microsoft.Reactive.Testing (https://github.com/dotnet/reactive) for
ferroui-reactive: the virtual-time TestScheduler, recorded notifications (Recorded) and
subscriptions (Subscription), hot and cold test observables, the observer that records what
it receives, the factories of ReactiveTest and the assertions of ReactiveAssert.
A test in the style of upstream:
use ferroui_reactive::ObservableExt;
use ferroui_reactive_testing::{assert_messages, assert_subscriptions, ReactiveTest as RT, TestScheduler};
let scheduler = TestScheduler::new();
let xs = scheduler.create_hot_observable(vec![RT::on_next(150, 1), RT::on_next(210, 2), RT::on_completed(250)]);
let source = xs.as_observable();
let res = scheduler.start(move || source.clone());
assert_messages!(res.messages(), RT::on_next(210, 2), RT::on_completed::<i32>(250));
// A hot observable subscribed directly keeps the subscription until it is disposed.
assert_subscriptions!(xs.subscriptions(), RT::subscribe(200, 1000));
Contents
TestTime— structduration_to_ticks— functionticks_to_duration— functionticks_to_time— functionTestScheduler— structRecorded— structSubscription— structTestError— structTestException— type aliasTestException— functionnew_error— functionExpected— enumReactiveTest— structassert_recorded_eq— functionassert_throws— functionMockObserver— structHotObservable— structColdObservable— structassert_messages— macroassert_subscriptions— macro
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.