Skip to content

Commit

Permalink
Test dot graph output for reentrant transition without parameterized …
Browse files Browse the repository at this point in the history
…trigger
  • Loading branch information
mclift committed Jul 7, 2024
1 parent 5483b5b commit 6b2cb9f
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions test/Stateless.Tests/DotGraphFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,36 @@ public void Initial_State_Not_Changed_After_Trigger_Fired()
}

[Fact]
public void Reentrant_Transition_Shows_Entry_Action_When_Trigger_Has_Parameters()
public void Reentrant_Transition_Shows_Entry_Action_When_Action_Is_Configured_With_OnEntryFrom()
{
var expected = Prefix(Style.UML)
+ Box(Style.UML, "A")
+ Box(Style.UML, "B")
+ Line("A", "B", "X / OnEntry")
+ Line("B", "B", "X / OnEntry")
+ suffix;

var sm = new StateMachine<State, Trigger>(State.A);

sm.Configure(State.A)
.Permit(Trigger.X, State.B);

var list = new List<string>();
sm.Configure(State.B)
.OnEntryFrom(Trigger.X, OnEntry, entryActionDescription: "OnEntry")
.PermitReentry(Trigger.X);

string dotGraph = UmlDotGraph.Format(sm.GetInfo());

#if WRITE_DOTS_TO_FOLDER
System.IO.File.WriteAllText(DestinationFolder + "Reentrant_Transition_Shows_Entry_Action_When_Action_Is_Configured_With_OnEntryFrom.dot", dotGraph);
#endif

Assert.Equal(expected, dotGraph);
}

[Fact]
public void Reentrant_Transition_Shows_Entry_Action_When_Action_Is_Configured_With_OnEntryFrom_And_Trigger_Has_Parameter()
{
var expected = Prefix(Style.UML)
+ Box(Style.UML, "A")
Expand All @@ -606,7 +635,7 @@ public void Reentrant_Transition_Shows_Entry_Action_When_Trigger_Has_Parameters(
string dotGraph = UmlDotGraph.Format(sm.GetInfo());

#if WRITE_DOTS_TO_FOLDER
System.IO.File.WriteAllText(DestinationFolder + "Reentrant_Transition_Shows_Entry_Action_When_Trigger_Has_Parameters.dot", dotGraph);
System.IO.File.WriteAllText(DestinationFolder + "Reentrant_Transition_Shows_Entry_Action_When_Action_Is_Configured_With_OnEntryFrom_And_Trigger_Has_Parameter.dot", dotGraph);
#endif

Assert.Equal(expected, dotGraph);
Expand Down

0 comments on commit 6b2cb9f

Please sign in to comment.