-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from RoadieRich/Interface-instead-of-concrete
Interface instead of concrete
- Loading branch information
Showing
14 changed files
with
104 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using RoadieRichStateMachine; | ||
|
||
namespace UnitTests | ||
{ | ||
[TestClass] | ||
public class StateMachineUnitTests | ||
{ | ||
[TestMethod] | ||
public void StateMachineCanRun() | ||
{ | ||
using var sm = new StateMachine(); | ||
sm.Run(); | ||
} | ||
|
||
[TestMethod] | ||
public void VarsCanBePassedIn() | ||
{ | ||
Dictionary<string, dynamic> vars = new() | ||
{ | ||
["x"] = 0 | ||
}; | ||
|
||
using var sm = new StateMachine(); | ||
sm.Run(vars); | ||
} | ||
|
||
[TestMethod] | ||
public void VarsCanBeModified() | ||
{ | ||
Dictionary<string, dynamic> vars = new() | ||
{ | ||
["x"] = 0 | ||
}; | ||
|
||
var funcState = new FunctionState((vars) => vars["x"]++); | ||
funcState.AddTransitionTo(StateMachine.ExitState, null); | ||
|
||
using var sm = new StateMachine(); | ||
sm.InitialState = funcState; | ||
sm.Run(vars); | ||
|
||
Assert.AreEqual(expected: 1, actual: vars["x"]); | ||
} | ||
} | ||
} |