TestSignalRule<C extends Cell> class
A specialized TestRule implementation for validating Signal objects within a cellular architecture.
This rule provides signal-specific validation logic to determine whether a signal should be processed by a cell's receptor. It extends the base test rule functionality with signal-specific validation.
Key characteristics:
- Validates only Signal objects (throws ArgumentError for other types)
- Integrates with cell test infrastructure
- Supports user context for validation decisions
- Composable with other test rules
Example:
// Create a test that only allows even numbers
final evenTest = TestObject<Cell>.fromRules(rules: [
TestSignalRule<int>(rule: (signal) => signal.body?.isEven ?? false)
]);
// Apply test to a cell
final restrictedCell = Cell(test: evenTest);
See also:
- TestRule for the base rule interface
- TestObject for rule composition
- Receptor for how signals are processed
- Implemented types
Constructors
-
TestSignalRule.new({required TestSignalRuleType<
C> rule, dynamic user}) - Creates a signal validation rule with the given validation logic.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
Object? object, {C? cell, dynamic arguments, bool exception(TestRule< dynamic, Cell> rule, Exception e) = TestRuleTrue.passed}) → bool - Validates a potential signal object against this rule.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
signal(
Signal signal, {C? cell}) → bool - Core signal validation logic.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator +(
TestRule< dynamic, Cell> other) → TestObject<C> -
Combines this rule with another rule to create a composite validation.
inherited
-
operator ==(
Object other) → bool -
The equality operator.
inherited