diff --git a/.github/workflows/BuildAndTestOnPullRequests.yml b/.github/workflows/BuildAndTestOnPullRequests.yml
index d052937a..429166a9 100644
--- a/.github/workflows/BuildAndTestOnPullRequests.yml
+++ b/.github/workflows/BuildAndTestOnPullRequests.yml
@@ -1,6 +1,6 @@
name: CI for Pull Requests
-
-on:
+on:
+ workflow_dispatch:
push:
branches: [ dev, master ]
pull_request:
@@ -25,14 +25,14 @@ jobs:
- name: Pack alpha version
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
- run: dotnet pack src/stateless/stateless.csproj --version-suffix dev-${{github.run_id}} --configuration Release
+ run: dotnet pack src/Stateless/Stateless.csproj --version-suffix dev-${{github.run_id}} --configuration Release
- name: Publish alpha version
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
- run: dotnet nuget push src\stateless\bin\Release\*.nupkg -s nuget.org --api-key ${{ secrets.NUGETAPIKEY }}
+ run: dotnet nuget push src\Stateless\bin\Release\*.nupkg -s nuget.org --api-key ${{ secrets.NUGETAPIKEY }}
- name: Pack Release version
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
- run: dotnet pack src/stateless/stateless.csproj --configuration Release
+ run: dotnet pack src/Stateless/Stateless.csproj --configuration Release
- name: Publish Release version
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
- run: dotnet nuget push src\stateless\bin\Release\*.nupkg -s nuget.org --api-key ${{ secrets.NUGETAPIKEY }}
+ run: dotnet nuget push src\Stateless\bin\Release\*.nupkg -s nuget.org --api-key ${{ secrets.NUGETAPIKEY }}
diff --git a/src/Stateless/StateMachine.cs b/src/Stateless/StateMachine.cs
index 803ed7ba..87b0e9ba 100644
--- a/src/Stateless/StateMachine.cs
+++ b/src/Stateless/StateMachine.cs
@@ -549,6 +549,18 @@ public bool CanFire(TTrigger trigger)
{
return CurrentRepresentation.CanHandle(trigger);
}
+ ///
+ /// Returns true if can be fired
+ /// in the current state.
+ ///
+ /// The trigger to fire.
+ /// A variable-length parameters list containing arguments.
+ /// True if the trigger can be fired, false otherwise.
+ ///
+ public bool CanFire(TriggerWithParameters trigger, params object[] args) {
+ if (trigger == null) throw new ArgumentNullException(nameof(trigger));
+ return CurrentRepresentation.CanHandle(trigger.Trigger, args);
+ }
///
/// Returns true if can be fired
diff --git a/src/Stateless/Stateless.csproj b/src/Stateless/Stateless.csproj
index 5edb08c1..4f848d03 100644
--- a/src/Stateless/Stateless.csproj
+++ b/src/Stateless/Stateless.csproj
@@ -15,9 +15,10 @@
true
true
Stateless.png
- https://github.com/dotnet-state-machine/stateless
+ https://github.com/josellm/stateless
http://www.apache.org/licenses/LICENSE-2.0
false
+ Stateless.josellm
diff --git a/test/Stateless.Tests/StateMachineFixture.cs b/test/Stateless.Tests/StateMachineFixture.cs
index e5f93e36..29d9b18f 100644
--- a/test/Stateless.Tests/StateMachineFixture.cs
+++ b/test/Stateless.Tests/StateMachineFixture.cs
@@ -961,6 +961,15 @@ public void WhenConfigureConditionallyPermittedTransitionOnTriggerWithParameters
Assert.True(sm.CanFire(trigger));
}
+ [Fact]
+ public void WhenParameterizedGuardTrue_ThenStateMachineCanFireTrigger() {
+ var sm = new StateMachine(State.A);
+ var x = sm.SetTriggerParameters(Trigger.X);
+ sm.Configure(State.A).PermitIf(x, State.B, i => i == 2);
+ Assert.False(sm.CanFire(x, 1));
+ Assert.True(sm.CanFire(x, 2));
+ }
+
[Fact]
public void WhenConfigureConditionallyPermittedTransitionOnTriggerWithParameters_ThenStateMachineCanEnumeratePermittedTriggers()
{