Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger a state that doesn't exist, CanFire API is allowed? #486

Open
BAI-HANK opened this issue Sep 30, 2022 · 0 comments
Open

Trigger a state that doesn't exist, CanFire API is allowed? #486

BAI-HANK opened this issue Sep 30, 2022 · 0 comments

Comments

@BAI-HANK
Copy link

Trigger a state that doesn't exist, CanFire API is allowed, FireAsync API doesn't throw an exception I think it's a little illogical,
after _machine. PermittedTriggers , obtaining target state available Triggers,then an exception is throwning, why not CanFire should be told that not allowed, then In FireAsync API throw an exception

   // "null"  is not exist state
   _machine.Configure(State.A.ToString()) .Permit(Trigger.EB.ToString(), "null");

  if (_machine.CanFire(Trigger.EB.ToString())) {
          await bar._machine.FireAsync(Trigger.EB.ToString());
          if (_machine.PermittedTriggers == null) continue;
          foreach (var machinePermittedTrigger in ._machine.PermittedTriggers) {
            Console.WriteLine("can trigger:" + machinePermittedTrigger);
          }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant