public void ShouldBeNotFulfilled_WithNotFulfilledDefault_AndOneFulfilledCondiiton() { var conditionsValidator = new ConditionsValidator() .WithCondition(ConditionRelation.Or, new NotFulfilledTestCondition()) .WithCondition(ConditionRelation.Or, new FulfilledTestCondition()) .WithDefaultState(ConditionState.NotFulfilled); conditionsValidator.Validate().ShouldBeEquivalentTo(ConditionState.Fulfilled); }
private bool GetTurnOffConditionsAreFulfilled() { if (_turnOffConditionsValidator.Conditions.Any() && _turnOffConditionsValidator.Validate() == ConditionState.Fulfilled) { return(false); } return(true); }
private bool GetConditionsAreFulfilled() { if (_disablingConditionsValidator.Conditions.Any() && _disablingConditionsValidator.Validate() == ConditionState.Fulfilled) { return(false); } if (_enablingConditionsValidator.Conditions.Any() && _enablingConditionsValidator.Validate() == ConditionState.NotFulfilled) { return(false); } return(true); }
public void Trigger() { if (_conditionsValidator.Validate() == ConditionState.Fulfilled) { foreach (var action in ActionsIfFulfilled) { action(); } } else { foreach (var action in ActionsIfNotFulfilled) { action(); } } }
private bool CanTurnOffLamp() => _turnOffConditionsValidator.Validate() != ConditionState.NotFulfilled;