From 6b2cb9f8284aaeee6a1acba2ad318fb9f3468530 Mon Sep 17 00:00:00 2001 From: Mike Clift Date: Sun, 7 Jul 2024 19:41:08 +0100 Subject: [PATCH] Test dot graph output for reentrant transition without parameterized trigger --- test/Stateless.Tests/DotGraphFixture.cs | 33 +++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/test/Stateless.Tests/DotGraphFixture.cs b/test/Stateless.Tests/DotGraphFixture.cs index 0d11eae5..70b65aa3 100644 --- a/test/Stateless.Tests/DotGraphFixture.cs +++ b/test/Stateless.Tests/DotGraphFixture.cs @@ -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.A); + + sm.Configure(State.A) + .Permit(Trigger.X, State.B); + + var list = new List(); + 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") @@ -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);