Skip to content

Commit

Permalink
Merged from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mclift committed Apr 22, 2024
1 parent 750c895 commit 1cf007c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions example/AlarmExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static void Main(string[] args)
{
Console.Write("> ");

input = Console.ReadLine();
input = Console.ReadLine()!;

if (!string.IsNullOrWhiteSpace(input))
switch (input.Split(" ")[0])
Expand Down Expand Up @@ -101,7 +101,7 @@ static void WriteFire(string input)
Console.WriteLine($"{input.Split(" ")[1]} is not a valid AlarmCommand.");
}
}
catch (InvalidOperationException ex)
catch (InvalidOperationException)
{
Console.WriteLine($"{input.Split(" ")[1]} is not a valid AlarmCommand to the current state.");
}
Expand Down
4 changes: 2 additions & 2 deletions src/Stateless/StateMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
namespace Stateless
{
/// <summary>
/// Enum for the different modes used when Fire-ing a trigger
/// Enum for the different modes used when <c>Fire</c>ing a trigger
/// </summary>
public enum FiringMode
{
/// <summary> Use immediate mode when the queuing of trigger events are not needed. Care must be taken when using this mode, as there is no run-to-completion guaranteed.</summary>
Immediate,
/// <summary> Use the queued Fire-ing mode when run-to-completion is required. This is the recommended mode.</summary>
/// <summary> Use the queued <c>Fire</c>ing mode when run-to-completion is required. This is the recommended mode.</summary>
Queued
}

Expand Down
9 changes: 4 additions & 5 deletions test/Stateless.Tests/AsyncActionsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public async Task OnEntryFromAsync_WhenEnteringByAnotherTrigger_InvokesAction()
[Fact]
public async Task FireAsyncTriggerWithParametersArray()
{
const string expectedParam = "42-Stateless-True-420.69-Y";
const string expectedParam = "42-Stateless-True-123.45-Y";
string actualParam = null;

var sm = new StateMachine<State, Trigger>(State.A);
Expand All @@ -560,16 +560,15 @@ public async Task FireAsyncTriggerWithParametersArray()
return Task.CompletedTask;
});

await sm.FireAsync(Trigger.X, 42, "Stateless", true, 420.69, Trigger.Y);
await sm.FireAsync(Trigger.X, 42, "Stateless", true, 123.45, Trigger.Y);

Assert.Equal(expectedParam, actualParam);
}

[Fact]
public async Task FireAsync_TriggerWithMoreThanThreeParameters()
{
var decimalSeparator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
string expectedParam = $"42-Stateless-True-420{decimalSeparator}69-Y";
const string expectedParam = "42-Stateless-True-123.45-Y";
string actualParam = null;

var sm = new StateMachine<State, Trigger>(State.A);
Expand All @@ -586,7 +585,7 @@ public async Task FireAsync_TriggerWithMoreThanThreeParameters()

var parameterizedX = sm.SetTriggerParameters(Trigger.X, typeof(int), typeof(string), typeof(bool), typeof(double), typeof(Trigger));

await sm.FireAsync(parameterizedX, 42, "Stateless", true, 420.69, Trigger.Y);
await sm.FireAsync(parameterizedX, 42, "Stateless", true, 123.45, Trigger.Y);

Assert.Equal(expectedParam, actualParam);
}
Expand Down

0 comments on commit 1cf007c

Please sign in to comment.