/// <summary> /// Tries to activate the fault. /// </summary> /// <remarks> /// This method is internal to simplify the public API of the class. The method is publically exposed via /// <see cref="FaultHelper.Activate" /> for use by the S# compiler. /// </remarks> internal void TryActivate() { if (!_activationIsUnknown) { _canUndoActivation = false; } else { switch (CheckActivation()) { case Activation.Forced: IsActivated = true; _canUndoActivation = false; break; case Activation.Suppressed: IsActivated = false; _canUndoActivation = false; break; case Activation.Nondeterministic: IsActivated = _choice.Choose(false, true); _choiceIndex = _choice.Resolver.LastChoiceIndex; _canUndoActivation = true; break; default: throw new InvalidOperationException("Unsupported fault activation."); } _activationIsUnknown = false; } }
/// <summary> /// Nondeterministically chooses an initial state. /// </summary> void IInitializable.Initialize() { State = Choice.Choose(_initialStates); }
protected T Choose <T>(T value1, T value2) { return(_defaultChoice.Choose(value1, value2)); }