├── logo.png
├── users.md
├── NState.2.0.5055.23670.nupkg
├── NState.2.0.5055.23670.symbols.nupkg
├── src
├── packages
│ ├── NUnit.Runners.2.6.0.12051
│ │ ├── Logo.ico
│ │ ├── tools
│ │ │ ├── runpnunit.bat
│ │ │ ├── agent.conf
│ │ │ ├── nunit.exe
│ │ │ ├── nunit-x86.exe
│ │ │ ├── lib
│ │ │ │ ├── log4net.dll
│ │ │ │ ├── nunit.core.dll
│ │ │ │ ├── nunit.util.dll
│ │ │ │ ├── nunit.uikit.dll
│ │ │ │ ├── nunit-gui-runner.dll
│ │ │ │ ├── nunit.uiexception.dll
│ │ │ │ ├── nunit-console-runner.dll
│ │ │ │ ├── nunit.core.interfaces.dll
│ │ │ │ └── Images
│ │ │ │ │ └── Tree
│ │ │ │ │ ├── Circles
│ │ │ │ │ ├── Failure.jpg
│ │ │ │ │ ├── Ignored.jpg
│ │ │ │ │ ├── Skipped.jpg
│ │ │ │ │ ├── Success.jpg
│ │ │ │ │ └── Inconclusive.jpg
│ │ │ │ │ ├── Classic
│ │ │ │ │ ├── Failure.jpg
│ │ │ │ │ ├── Ignored.jpg
│ │ │ │ │ ├── Skipped.jpg
│ │ │ │ │ ├── Success.jpg
│ │ │ │ │ └── Inconclusive.jpg
│ │ │ │ │ ├── Default
│ │ │ │ │ ├── Failure.png
│ │ │ │ │ ├── Ignored.png
│ │ │ │ │ ├── Skipped.png
│ │ │ │ │ ├── Success.png
│ │ │ │ │ └── Inconclusive.png
│ │ │ │ │ └── Visual Studio
│ │ │ │ │ ├── Failure.png
│ │ │ │ │ ├── Ignored.png
│ │ │ │ │ ├── Skipped.png
│ │ │ │ │ ├── Success.png
│ │ │ │ │ ├── Inconclusive.png
│ │ │ │ │ └── SeriousWarning.png
│ │ │ ├── nunit-agent.exe
│ │ │ ├── nunit-editor.exe
│ │ │ ├── pnunit-agent.exe
│ │ │ ├── pnunit.tests.dll
│ │ │ ├── nunit-console.exe
│ │ │ ├── nunit-agent-x86.exe
│ │ │ ├── nunit-console-x86.exe
│ │ │ ├── nunit.framework.dll
│ │ │ ├── pnunit-launcher.exe
│ │ │ ├── pnunit.framework.dll
│ │ │ ├── nunit-x86.exe.config
│ │ │ ├── nunit.exe.config
│ │ │ ├── nunit-console-x86.exe.config
│ │ │ ├── nunit-console.exe.config
│ │ │ ├── nunit-agent-x86.exe.config
│ │ │ ├── nunit-agent.exe.config
│ │ │ ├── test.conf
│ │ │ ├── pnunit-agent.exe.config
│ │ │ └── pnunit-launcher.exe.config
│ │ ├── license.txt
│ │ └── NUnit.Runners.2.6.0.12051.nupkg
│ ├── Newtonsoft.Json.4.5.11
│ │ ├── lib
│ │ │ ├── sl4
│ │ │ │ └── Newtonsoft.Json.dll
│ │ │ ├── net20
│ │ │ │ └── Newtonsoft.Json.dll
│ │ │ ├── net35
│ │ │ │ └── Newtonsoft.Json.dll
│ │ │ ├── net40
│ │ │ │ └── Newtonsoft.Json.dll
│ │ │ ├── sl3-wp
│ │ │ │ └── Newtonsoft.Json.dll
│ │ │ ├── winrt45
│ │ │ │ └── Newtonsoft.Json.dll
│ │ │ ├── sl4-windowsphone71
│ │ │ │ └── Newtonsoft.Json.dll
│ │ │ └── portable-net40+sl4+wp7+win8
│ │ │ │ └── Newtonsoft.Json.dll
│ │ ├── Newtonsoft.Json.4.5.11.nupkg
│ │ └── Newtonsoft.Json.4.5.11.nuspec
│ └── repositories.config
├── NState
│ ├── TransitionActionStatus.cs
│ ├── Exceptions
│ │ ├── TransitionActionException.cs
│ │ ├── SelfTransitionException.cs
│ │ ├── FinalStateTransitionException.cs
│ │ ├── ParentStateNotAvailableException.cs
│ │ └── InvalidStateTransitionException.cs
│ ├── packages.config
│ ├── NullStateMachine.cs
│ ├── NullTransitionAction.cs
│ ├── NState.nuspec
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── IStateTransition.cs
│ ├── StateTransition.cs
│ ├── IStateMachine.cs
│ ├── TransitionAction.cs
│ ├── State.cs
│ ├── IStateful.cs
│ ├── Stateful.cs
│ ├── StateMachine.cs
│ ├── StateMachineTransitionHelper.cs
│ ├── StateMachineSerializationHelper.cs
│ ├── StringTable.Designer.cs
│ ├── NState.csproj
│ └── StringTable.resx
├── NState.Test.Fast
│ ├── BugTrackerExample
│ │ ├── Bug.cs
│ │ ├── BugState.cs
│ │ ├── Transitions
│ │ │ ├── BugTransition.Open.cs
│ │ │ ├── BugTransition.Close.cs
│ │ │ ├── BugTransition.Resolve.cs
│ │ │ ├── BugTransition.Defer.cs
│ │ │ └── BugTransition.Assign.cs
│ │ ├── TransitionActions
│ │ │ ├── BugTransitionAction.Defer.cs
│ │ │ ├── BugTransitionAction.Resolve.cs
│ │ │ ├── BugTransitionAction.Assign.cs
│ │ │ └── BugTransitionAction.Close.cs
│ │ └── BugStateful.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── StateMachineSerializationTests.cs
│ ├── NState.Test.Fast.csproj
│ └── BugStatefulTests.cs
├── clean.bat
└── NState.sln
├── .gitignore
├── guide-nuget.md
├── COPYING.LESSER
├── readme.md
└── COPYING
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/logo.png
--------------------------------------------------------------------------------
/users.md:
--------------------------------------------------------------------------------
1 | ```
2 | Company Name | Application Description
3 |
4 | ```
5 |
--------------------------------------------------------------------------------
/NState.2.0.5055.23670.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/NState.2.0.5055.23670.nupkg
--------------------------------------------------------------------------------
/NState.2.0.5055.23670.symbols.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/NState.2.0.5055.23670.symbols.nupkg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/Logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/Logo.ico
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/runpnunit.bat:
--------------------------------------------------------------------------------
1 | start pnunit-agent 8080 .
2 | start pnunit-agent 8081 .
3 | pnunit-launcher test.conf
4 |
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/license.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/license.txt
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/agent.conf:
--------------------------------------------------------------------------------
1 |
2 | 8080
3 | .
4 |
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit.exe
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-x86.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-x86.exe
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/log4net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/log4net.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-agent.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-agent.exe
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-editor.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-editor.exe
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit-agent.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit-agent.exe
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit.tests.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit.tests.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.core.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.util.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.util.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-console.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-console.exe
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/lib/sl4/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.uikit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.uikit.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-agent-x86.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-agent-x86.exe
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-console-x86.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-console-x86.exe
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit.framework.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit-launcher.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit-launcher.exe
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit.framework.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit.framework.dll
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nupkg
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/lib/net20/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/lib/net35/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/lib/sl3-wp/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/lib/winrt45/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/NState/TransitionActionStatus.cs:
--------------------------------------------------------------------------------
1 | namespace NState
2 | {
3 | public enum TransitionActionStatus
4 | {
5 | NotRun = 0,
6 | Success,
7 | Failed,
8 | }
9 | }
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/NUnit.Runners.2.6.0.12051.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/NUnit.Runners.2.6.0.12051.nupkg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit-gui-runner.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit-gui-runner.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.uiexception.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.uiexception.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit-console-runner.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit-console-runner.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.core.interfaces.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/nunit.core.interfaces.dll
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/lib/sl4-windowsphone71/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Failure.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Failure.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Ignored.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Ignored.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Skipped.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Skipped.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Success.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Success.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Failure.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Failure.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Ignored.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Ignored.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Skipped.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Skipped.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Success.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Success.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Failure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Failure.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Ignored.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Ignored.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Skipped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Skipped.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Success.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Inconclusive.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Circles/Inconclusive.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Inconclusive.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Classic/Inconclusive.jpg
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Inconclusive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Default/Inconclusive.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Failure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Failure.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Ignored.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Ignored.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Skipped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Skipped.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Success.png
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/Newtonsoft.Json.4.5.11/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/src/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Inconclusive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/Inconclusive.png
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/SeriousWarning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benaston/NState/HEAD/src/packages/NUnit.Runners.2.6.0.12051/tools/lib/Images/Tree/Visual Studio/SeriousWarning.png
--------------------------------------------------------------------------------
/src/NState/Exceptions/TransitionActionException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Exceptions
4 | {
5 | public class TransitionActionException : Exception
6 | {
7 | public TransitionActionException(string message) : base(message) { }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/NState/Exceptions/SelfTransitionException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Exceptions
4 | {
5 | public class SelfTransitionException : Exception
6 | {
7 | public SelfTransitionException() : base(StringTable.SelfTransitionExceptionMessage) { }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/NState/Exceptions/FinalStateTransitionException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Exceptions
4 | {
5 | public class FinalStateTransitionException : Exception
6 | {
7 | public FinalStateTransitionException() : base(StringTable.FinalStateTransitionExceptionMessage) { }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/NState/Exceptions/ParentStateNotAvailableException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Exceptions
4 | {
5 | public class ParentStateNotAvailableException : Exception
6 | {
7 | public ParentStateNotAvailableException() : base(StringTable.ParentStateNotAvailableExceptionMessage) { }
8 | }
9 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # VS Bits
2 | [Oo]bj
3 | [bB]in
4 | *.suo
5 | Publish.xml
6 |
7 | # ReSharper
8 | _ReSharper.*
9 | *.user
10 |
11 | # Runtime/Misc Junk :)
12 | *.log*
13 | .sass-cache
14 | .orig
15 |
16 | # SASS-Generated Files
17 |
18 |
19 | # Project Build Output
20 |
21 | #Mac and vim files
22 | *.swp
23 | .DS_Store
24 | Thumbs.db
25 |
26 | #Misc
27 | TestResult.xml
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/Bug.cs:
--------------------------------------------------------------------------------
1 | namespace NState.Test.Fast.BugTrackerExample
2 | {
3 | public class Bug
4 | {
5 | public Bug(string title) { Title = title; }
6 |
7 | public string Title { get; set; }
8 |
9 | public string AssigneeEmail { get; set; }
10 |
11 | public string ClosedByName { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/NState/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/BugState.cs:
--------------------------------------------------------------------------------
1 | namespace NState.Test.Fast.BugTrackerExample
2 | {
3 | public abstract class BugState : State
4 | {
5 | public class Assigned : BugState {}
6 |
7 | public class Closed : BugState {}
8 |
9 | public class Deferred : BugState {}
10 |
11 | public class Open : BugState {}
12 |
13 | public class Resolved : BugState {}
14 | }
15 | }
--------------------------------------------------------------------------------
/guide-nuget.md:
--------------------------------------------------------------------------------
1 | To push a new version to NuGet:
2 |
3 | 1. Build the solution in debug mode (mnakes for easier debugging by users).
4 | 2. Pack the NuGet package. Run `build\build.bat`, then choose `npack` as the option and press return.
5 | 3. Open powershell and cd to the location of the NState source root folder on your machine.
6 | 4. Set your NuGet API key (login to NuGet.org to find this out). `./build/nuget.exe setApiKey `
7 | 5. .\build\Nuget.exe push .\NState..nupkg
--------------------------------------------------------------------------------
/src/clean.bat:
--------------------------------------------------------------------------------
1 | cd /d %0\..
2 | FOR /F "tokens=*" %%G IN ('DIR /B /AD /S bin') DO RMDIR /S /Q "%%G"
3 | FOR /F "tokens=*" %%G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%%G"
4 | FOR /F "tokens=*" %%G IN ('DIR /B /AD /S _ReSharper.*') DO RMDIR /S /Q "%%G"
5 | FOR /F "tokens=*" %%G IN ('DIR /B /S *.csproj.user') DO del "%%G"
6 | FOR /F "tokens=*" %%G IN ('DIR /B /A /S *.suo') DO del "%%G"
7 | FOR /F "tokens=*" %%G IN ('DIR /B /S *.ReSharper.user') DO del "%%G"
8 | FOR /F "tokens=*" %%G IN ('DIR /B /S TestResult.xml') DO del "%%G"
9 | FOR /F "tokens=*" %%G IN ('DIR /B /S *.sln.cache') DO del "%%G"
--------------------------------------------------------------------------------
/src/NState/NullStateMachine.cs:
--------------------------------------------------------------------------------
1 | namespace NState
2 | {
3 | public class NullStateMachine : StateMachine where TState : State
4 | {
5 | public override TTransitionActionStatus TriggerTransition(TState targetState,
6 | dynamic statefulObject,
7 | dynamic dto = null)
8 | {
9 | //do nothing, null object
10 | return default(TTransitionActionStatus);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("NState.Test.Fast")]
5 | [assembly: AssemblyDescription("Fast tests for NState.")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("Ben Aston")]
8 | [assembly: AssemblyProduct("NState")]
9 | [assembly: AssemblyCopyright("Copyright © Ben Aston")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 | [assembly: ComVisible(false)]
13 | [assembly: Guid("71fceceb-d34c-4824-958a-197b20c60645")]
14 | [assembly: AssemblyVersion("2.0.*")]
--------------------------------------------------------------------------------
/src/NState/Exceptions/InvalidStateTransitionException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Exceptions
4 | {
5 | public class InvalidStateTransitionException : Exception
6 | where TState : State
7 | {
8 | public InvalidStateTransitionException(TState initialState,
9 | TState endState,
10 | Exception innerException = default(Exception))
11 | : base(string.Format(StringTable.InvalidStateTransitionExceptionMessage, initialState.Name, endState.Name), innerException) { }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/Transitions/BugTransition.Open.cs:
--------------------------------------------------------------------------------
1 | namespace NState.Test.Fast.BugTrackerExample.Transitions
2 | {
3 | public partial class BugTransition
4 | {
5 | public class Open : StateTransition
6 | {
7 | public override BugState[] StartStates
8 | {
9 | get { return new[] { new BugState.Closed(), }; }
10 | }
11 |
12 | public override BugState[] EndStates
13 | {
14 | get { return new[] { new BugState.Open(), }; }
15 | }
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/NState/NullTransitionAction.cs:
--------------------------------------------------------------------------------
1 | namespace NState
2 | {
3 | public class NullTransitionAction : TransitionAction where TState : State
4 | {
5 | public override TTransitionActionStatus Run(TState targetState,
6 | IStateMachine stateMachine,
7 | dynamic statefulObject,
8 | dynamic dto = default (dynamic))
9 | {
10 | //do nothing
11 | return default(TTransitionActionStatus);
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/NState/NState.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $title$
7 | $author$
8 | $author$
9 | http://www.gnu.org/licenses/lgpl.txt
10 | https://github.com/benaston/NState
11 | https://raw.github.com/benaston/NState/master/logo.png
12 | false
13 | $description$
14 | Copyright 2013, Ben Aston
15 | state-machine,statemachine,state
16 |
17 |
--------------------------------------------------------------------------------
/src/NState/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("NState")]
5 | [assembly: AssemblyDescription("A simple state machine implementation. If you like NState, please add an entry to the users.md file in the GitHub repo and open a pull request. Let's share descriptions of the cool things we are using NState for.")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("Ben Aston")]
8 | [assembly: AssemblyProduct("NState")]
9 | [assembly: AssemblyCopyright("Copyright © Ben Aston")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 | [assembly: ComVisible(false)]
13 | [assembly: Guid("09b7aff0-16aa-480c-ab07-e4397aab5912")]
14 | [assembly: AssemblyVersion("2.0.*")]
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/Transitions/BugTransition.Close.cs:
--------------------------------------------------------------------------------
1 | using NState.Test.Fast.BugTrackerExample.TransitionActions;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample.Transitions
4 | {
5 | public partial class BugTransition
6 | {
7 | public class Close : StateTransition
8 | {
9 | public Close(BugTransitionAction.Close transitionAction)
10 | : base(transitionAction: transitionAction) { }
11 |
12 | public override BugState[] StartStates
13 | {
14 | get { return new BugState[] { new BugState.Resolved() }; }
15 | }
16 |
17 | public override BugState[] EndStates
18 | {
19 | get { return new[] { new BugState.Closed(), }; }
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/Transitions/BugTransition.Resolve.cs:
--------------------------------------------------------------------------------
1 | using NState.Test.Fast.BugTrackerExample.TransitionActions;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample.Transitions
4 | {
5 | public partial class BugTransition
6 | {
7 | public class Resolve : StateTransition
8 | {
9 | public Resolve(BugTransitionAction.Resolve transitionAction)
10 | : base(transitionAction: transitionAction) { }
11 |
12 | public override BugState[] StartStates
13 | {
14 | get { return new[] { new BugState.Assigned(), }; }
15 | }
16 |
17 | public override BugState[] EndStates
18 | {
19 | get { return new[] { new BugState.Resolved(), }; }
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/Transitions/BugTransition.Defer.cs:
--------------------------------------------------------------------------------
1 | using NState.Test.Fast.BugTrackerExample.TransitionActions;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample.Transitions
4 | {
5 | public partial class BugTransition
6 | {
7 | public class Defer : StateTransition
8 | {
9 | public Defer(BugTransitionAction.Defer transitionAction)
10 | : base(transitionAction: transitionAction) { }
11 |
12 | public override BugState[] StartStates
13 | {
14 | get { return new BugState[] { new BugState.Open(), new BugState.Assigned() }; }
15 | }
16 |
17 | public override BugState[] EndStates
18 | {
19 | get { return new[] { new BugState.Deferred(), }; }
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/Transitions/BugTransition.Assign.cs:
--------------------------------------------------------------------------------
1 | using NState.Test.Fast.BugTrackerExample.TransitionActions;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample.Transitions
4 | {
5 | public partial class BugTransition
6 | {
7 | public class Assign : StateTransition
8 | {
9 | public Assign(BugTransitionAction.Assign transitionAction)
10 | : base(transitionAction: transitionAction) { }
11 |
12 | public override BugState[] StartStates
13 | {
14 | get { return new BugState[] {new BugState.Open(), new BugState.Assigned(),}; }
15 | }
16 |
17 | public override BugState[] EndStates
18 | {
19 | get { return new[] {new BugState.Assigned(),}; }
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/TransitionActions/BugTransitionAction.Defer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample.TransitionActions
4 | {
5 | public partial class BugTransitionAction
6 | {
7 | public class Defer : TransitionAction
8 | {
9 | public override TransitionActionStatus Run(BugState targetState,
10 | IStateMachine stateMachine,
11 | dynamic statefulObject,
12 | dynamic dto = null)
13 | {
14 | statefulObject.Bug.AssigneeEmail = String.Empty;
15 |
16 | return TransitionActionStatus.Success;
17 | }
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/packages/Newtonsoft.Json.4.5.11/Newtonsoft.Json.4.5.11.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Newtonsoft.Json
5 | 4.5.11
6 | Json.NET
7 | James Newton-King
8 | James Newton-King
9 | http://json.codeplex.com/license
10 | http://james.newtonking.com/projects/json-net.aspx
11 | false
12 | Json.NET is a popular high-performance JSON framework for .NET
13 |
14 |
15 | en-US
16 | json
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/NState/IStateTransition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState
4 | {
5 | public interface IStateTransition where TState : State
6 | {
7 | TState[] StartStates { get; }
8 |
9 | TState[] EndStates { get; }
10 |
11 | ///
12 | /// Logic to be run when the transition occurs.
13 | ///
14 | TransitionAction TransitionAction { get; }
15 |
16 | ///
17 | /// A constraint which will permit the transition only
18 | /// when it evaluates to true.
19 | /// Arg1 is the state being transitioned to.
20 | /// Arg2 is the stateful object undergoing the transition.
21 | /// Arg3 is a DTO containing any additional data required to perform the transition.
22 | ///
23 | Func Condition { get; }
24 | }
25 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/TransitionActions/BugTransitionAction.Resolve.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample.TransitionActions
4 | {
5 | public partial class BugTransitionAction
6 | {
7 | public class Resolve : TransitionAction
8 | {
9 | public override TransitionActionStatus Run(BugState targetState,
10 | IStateMachine stateMachine,
12 | dynamic statefulObject,
13 | dynamic dto = null)
14 | {
15 | statefulObject.Bug.AssigneeEmail = String.Empty;
16 |
17 | return TransitionActionStatus.Success;
18 | }
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/NState/StateTransition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState
4 | {
5 | public abstract class StateTransition :
6 | IStateTransition
7 | where TState : State
8 | {
9 | protected StateTransition(Func condition = null,
10 | TransitionAction transitionAction = null)
11 | {
12 | Condition = condition ?? ((s, statefulObject, dto) => true);
13 | TransitionAction = transitionAction ?? new NullTransitionAction();
14 | }
15 |
16 | public abstract TState[] StartStates { get; }
17 |
18 | public abstract TState[] EndStates { get; }
19 |
20 | public TransitionAction TransitionAction { get; private set; }
21 |
22 | public Func Condition { get; private set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/NState/IStateMachine.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace NState
4 | {
5 | public interface IStateMachine where TState : State
6 | {
7 | string Name { get; set; }
8 |
9 | IStateTransition[] StateTransitions { get; }
10 |
11 | TState InitialState { get; set; }
12 |
13 | IStateMachine Parent { get; set; }
14 |
15 | ///
16 | /// Key is state machine name.
17 | ///
18 | Dictionary> Children { get; set; }
19 |
20 | TState CurrentState { get; set; }
21 |
22 | ///
23 | /// Kept as a method on the interface (rather than extension method) to permit easier extension.
24 | ///
25 | TTransitionActionStatus TriggerTransition(TState targetState, dynamic statefulObject, dynamic dto = default(dynamic));
26 | }
27 | }
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-x86.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/NState/TransitionAction.cs:
--------------------------------------------------------------------------------
1 | namespace NState
2 | {
3 | ///
4 | /// Base for types encapsulating logic
5 | /// to be run when a transition occurs.
6 | ///
7 | public abstract class TransitionAction where TState : State
8 | {
9 | /// The state being transitioned to.
10 | /// The statemachine governing the transition.
11 | /// The stateful object undergoing the transition.
12 | /// A DTO containing any additional data required by the transition.
13 | /// An indication of the status of the transition (success, failure, warning etc.).
14 | public abstract TTransitionActionStatus Run(TState targetState,
15 | IStateMachine stateMachine,
16 | dynamic statefulObject,
17 | dynamic dto = default(dynamic));
18 | }
19 | }
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-console-x86.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-console.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/TransitionActions/BugTransitionAction.Assign.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample.TransitionActions
4 | {
5 | public partial class BugTransitionAction
6 | {
7 | public class Assign : TransitionAction
8 | {
9 | public override TransitionActionStatus Run(BugState targetState,
10 | IStateMachine stateMachine,
11 | dynamic statefulObject,
12 | dynamic dto = null)
13 | {
14 | if (dto == null)
15 | {
16 | throw new ArgumentNullException("dto");
17 | }
18 |
19 | if (dto.AssigneeEmail == null)
20 | {
21 | throw new Exception("AssigneeEmail not supplied.");
22 | }
23 |
24 | statefulObject.Bug.AssigneeEmail = dto.AssigneeEmail;
25 |
26 | return TransitionActionStatus.Success;
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/TransitionActions/BugTransitionAction.Close.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample.TransitionActions
4 | {
5 | public partial class BugTransitionAction
6 | {
7 | public class Close : TransitionAction
8 | {
9 | public override TransitionActionStatus Run(BugState targetState,
10 | IStateMachine stateMachine,
12 | dynamic statefulObject,
13 | dynamic dto = null)
14 | {
15 | if (dto == null)
16 | {
17 | throw new ArgumentNullException("dto");
18 | }
19 |
20 | if (dto.ClosedByName == null)
21 | {
22 | throw new Exception("ClosedByName not supplied.");
23 | }
24 |
25 | statefulObject.StatefulObject.Bug.ClosedByName = dto.ClosedByName;
26 |
27 | return TransitionActionStatus.Success;
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-agent-x86.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/nunit-agent.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/NState/State.cs:
--------------------------------------------------------------------------------
1 | namespace NState
2 | {
3 | public abstract class State
4 | {
5 | private string _name;
6 |
7 | public string Name
8 | {
9 | get { return _name ?? GetType().AssemblyQualifiedName; //assembly qualified for (de)serialization
10 | }
11 |
12 | set { _name = value; }
13 | }
14 |
15 | public static bool operator ==(State a, State b) { return (a.Equals(b)); }
16 |
17 | public static bool operator !=(State a, State b) { return !(a.Equals(b)); }
18 |
19 | public override bool Equals(object obj)
20 | {
21 | if (ReferenceEquals(null, obj))
22 | {
23 | return false;
24 | }
25 | if (ReferenceEquals(this, obj))
26 | {
27 | return true;
28 | }
29 | if (obj.GetType() != typeof (State))
30 | {
31 | return false;
32 | }
33 |
34 | return Equals((State) obj);
35 | }
36 |
37 | public bool Equals(State other)
38 | {
39 | if (ReferenceEquals(null, other))
40 | {
41 | return false;
42 | }
43 | if (ReferenceEquals(this, other))
44 | {
45 | return true;
46 | }
47 |
48 | return Equals(other.Name, Name);
49 | }
50 |
51 | public override int GetHashCode()
52 | {
53 | unchecked
54 | {
55 | return ((Name != null ? Name.GetHashCode() : 0)*397);
56 | }
57 | }
58 |
59 | public virtual void EntryAction(dynamic dto) { }
60 |
61 | public virtual void ExitAction(dynamic dto) { }
62 | }
63 | }
--------------------------------------------------------------------------------
/src/NState.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NState", "NState\NState.csproj", "{CD3850FF-96DA-441D-804F-2F56E7A3104E}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NState.Test.Fast", "NState.Test.Fast\NState.Test.Fast.csproj", "{A9F4845F-A091-4B62-8209-00776C109845}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | Staging|Any CPU = Staging|Any CPU
13 | EndGlobalSection
14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
15 | {CD3850FF-96DA-441D-804F-2F56E7A3104E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16 | {CD3850FF-96DA-441D-804F-2F56E7A3104E}.Debug|Any CPU.Build.0 = Debug|Any CPU
17 | {CD3850FF-96DA-441D-804F-2F56E7A3104E}.Release|Any CPU.ActiveCfg = Release|Any CPU
18 | {CD3850FF-96DA-441D-804F-2F56E7A3104E}.Release|Any CPU.Build.0 = Release|Any CPU
19 | {CD3850FF-96DA-441D-804F-2F56E7A3104E}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
20 | {CD3850FF-96DA-441D-804F-2F56E7A3104E}.Staging|Any CPU.Build.0 = Staging|Any CPU
21 | {A9F4845F-A091-4B62-8209-00776C109845}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {A9F4845F-A091-4B62-8209-00776C109845}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {A9F4845F-A091-4B62-8209-00776C109845}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {A9F4845F-A091-4B62-8209-00776C109845}.Release|Any CPU.Build.0 = Release|Any CPU
25 | {A9F4845F-A091-4B62-8209-00776C109845}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
26 | {A9F4845F-A091-4B62-8209-00776C109845}.Staging|Any CPU.Build.0 = Staging|Any CPU
27 | EndGlobalSection
28 | GlobalSection(SolutionProperties) = preSolution
29 | HideSolutionNode = FALSE
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/NState/IStateful.cs:
--------------------------------------------------------------------------------
1 | using System.Dynamic;
2 |
3 | namespace NState
4 | {
5 | ///
6 | /// Implemented by types that have a
7 | /// corresponding StateMachine.
8 | ///
9 | internal interface IStateful where TState : State
10 | {
11 | ///
12 | /// The state machine governing transitions for this stateful object.
13 | ///
14 | IStateMachine StateMachine { get; set; }
15 |
16 | ///
17 | /// The current state of this stateful object.
18 | ///
19 | TState CurrentState { get; }
20 |
21 | ///
22 | /// Perform the specified transition against this stateful object.
23 | ///
24 | /// The type of the stateful object undergoing the transition.
25 | /// The stateful object undergoing the transition.
26 | /// The state being transitioned to.
27 | /// A reference to the status of any action associated with the transition.
28 | /// A DTO containing any additional data required to perform the transition.
29 | /// The object having undergone the transition attempt (success/failure indicated by transition action status).
30 | TStatefulObject TriggerTransition(TStatefulObject statefulObject,
31 | TState targetState,
32 | out TTransitionActionStatus transitionActionStatus,
33 | ExpandoObject dto);
34 | }
35 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/BugTrackerExample/BugStateful.cs:
--------------------------------------------------------------------------------
1 | using System.Dynamic;
2 |
3 | namespace NState.Test.Fast.BugTrackerExample
4 | {
5 | ///
6 | /// This wrapper type exposes the stateful functionality for Bugs.
7 | /// This functionality could be placed on the Bug type itself at the
8 | /// expense of some mixing of concerns.
9 | ///
10 | public class BugStateful : Stateful
11 | {
12 | public BugStateful(Bug bug, IStateMachine stateMachine = null)
13 | : base(stateMachine ?? new NullStateMachine()) { Bug = bug; }
14 |
15 | public Bug Bug { get; set; }
16 |
17 | public BugStateful Open(out TransitionActionStatus transitionActionStatus)
18 | {
19 | return TriggerTransition(this, new BugState.Open(), out transitionActionStatus);
20 | }
21 |
22 | public BugStateful Assign(string assigneeEmail, out TransitionActionStatus transitionActionStatus)
23 | {
24 | dynamic dto = new ExpandoObject();
25 | dto.AssigneeEmail = assigneeEmail;
26 |
27 | return TriggerTransition(this, new BugState.Assigned(), out transitionActionStatus, dto);
28 | }
29 |
30 | public BugStateful Defer(out TransitionActionStatus transitionActionStatus)
31 | {
32 | return TriggerTransition(this, new BugState.Deferred(), out transitionActionStatus);
33 | }
34 |
35 | public BugStateful Resolve(out TransitionActionStatus transitionActionStatus)
36 | {
37 | return TriggerTransition(this, new BugState.Resolved(), out transitionActionStatus);
38 | }
39 |
40 | public BugStateful Close(string closedByName, out TransitionActionStatus transitionActionStatus)
41 | {
42 | dynamic dto = new ExpandoObject();
43 | dto.ClosedByName = closedByName;
44 |
45 | return TriggerTransition(this, new BugState.Closed(), out transitionActionStatus, dto);
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/NState/Stateful.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Dynamic;
3 | using NState.Exceptions;
4 |
5 | namespace NState
6 | {
7 | ///
8 | /// Inherit from this if you want to make your type stateful.
9 | ///
10 | public abstract class Stateful : IStateful where TState : State
11 | {
12 | protected Stateful(IStateMachine stateMachine)
13 | {
14 | StateMachine = stateMachine;
15 | }
16 |
17 | public TState ParentState
18 | {
19 | get
20 | {
21 | if (StateMachine.Parent == null)
22 | {
23 | throw new ParentStateNotAvailableException();
24 | }
25 |
26 | return StateMachine.Parent.CurrentState;
27 | }
28 | }
29 |
30 | public IStateMachine StateMachine { get; set; }
31 |
32 | public TState CurrentState
33 | {
34 | get { return StateMachine.CurrentState; }
35 | }
36 |
37 | public TExpectedReturn TriggerTransition(TExpectedReturn statefulObject,
38 | TState targetState,
39 | out TTransitionActionStatus transitionActionStatus,
40 | ExpandoObject dto = default(ExpandoObject))
41 | {
42 | transitionActionStatus = default(TTransitionActionStatus); //ensures transitionActionStatus is reset before the transition
43 | if (!(statefulObject is ValueType) && statefulObject == null)
44 | {
45 | throw new ArgumentNullException("statefulObject");
46 | }
47 |
48 | if (targetState == null)
49 | {
50 | throw new ArgumentNullException("targetState");
51 | }
52 |
53 | dto = dto ?? new ExpandoObject();
54 | transitionActionStatus = StateMachine.TriggerTransition(targetState, statefulObject, dto);
55 |
56 | return statefulObject;
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/src/NState.Test.Fast/StateMachineSerializationTests.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable InconsistentNaming
2 |
3 | using System.Dynamic;
4 | using NState.Test.Fast.BugTrackerExample;
5 | using NState.Test.Fast.BugTrackerExample.TransitionActions;
6 | using NState.Test.Fast.BugTrackerExample.Transitions;
7 | using NUnit.Framework;
8 |
9 | namespace NState.Test.Fast
10 | {
11 | [TestFixture]
12 | public class StateMachineSerializationTests
13 | {
14 | private StateMachine _stateMachine;
15 | private IStateTransition[] _transitions;
16 |
17 | [SetUp]
18 | public void Setup()
19 | {
20 | _transitions = new IStateTransition[]
21 | {
22 | new BugTransition.Assign(new BugTransitionAction.Assign()),
23 | };
24 |
25 | _stateMachine = new StateMachine("example",
26 | _transitions,
27 | initialState: new BugState.Open());
28 | }
29 |
30 | [Test]
31 | public void InitializeFromJson_ValidJson_Succeeds()
32 | {
33 | //arrange
34 | dynamic statefulObject = new ExpandoObject();
35 | statefulObject.Bug = new Bug("foo");
36 | _stateMachine.TriggerTransition(new BugState.Assigned(), statefulObject, new { AssigneeEmail = "example@example.com" });
37 | var stateMachine2 = new StateMachine("example",
38 | _transitions,
39 | initialState: new BugState.Open());
40 |
41 | //assert
42 | Assert.That(_stateMachine.CurrentState == new BugState.Assigned());
43 | Assert.That(stateMachine2.CurrentState == new BugState.Open());
44 |
45 | //act
46 | string json = _stateMachine.ToJson();
47 | _stateMachine.InitializeFromJson(json);
48 |
49 | //assert
50 | Assert.That(_stateMachine.CurrentState, Is.TypeOf());
51 | }
52 | }
53 | }
54 |
55 | // ReSharper restore InconsistentNaming
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/test.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Testing
12 |
13 |
14 | Testing
15 | pnunit.tests.dll
16 | TestLibraries.Testing.EqualTo19
17 | $agent_host:8080
18 |
19 |
20 |
21 |
22 |
23 |
24 | Parallel_Tests
25 |
26 |
27 | ParallelTest_A_Test
28 | pnunit.tests.dll
29 | TestLibraries.ParallelExample.ParallelTest_A
30 | $agent_host:8080
31 |
32 |
33 | 2
34 |
35 |
36 |
37 | ParallelTest_B_Test
38 | pnunit.tests.dll
39 | TestLibraries.ParallelExample.ParallelTest_B
40 | $agent_host:8080
41 |
42 | 1
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | Parallel_Barriers
52 |
53 |
54 | Parallel_Barriers_TestA
55 | pnunit.tests.dll
56 | TestLibraries.ParallelExampleWithBarriers.ParallelTestWithBarriersA
57 | $agent_host:8080
58 |
59 |
60 |
61 | START_BARRIER
62 | WAIT_BARRIER
63 |
64 |
65 |
66 | Parallel_Barriers_TestB
67 | pnunit.tests.dll
68 | TestLibraries.ParallelExampleWithBarriers.ParallelTestWithBarriersB
69 | $agent_host:8081
70 |
71 |
72 |
73 | START_BARRIER
74 | WAIT_BARRIER
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit-agent.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
30 |
32 |
33 |
34 |
37 |
39 |
40 |
41 |
42 |
45 |
47 |
48 |
49 |
50 |
53 |
55 |
56 |
57 |
58 |
61 |
63 |
64 |
65 |
66 |
69 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/packages/NUnit.Runners.2.6.0.12051/tools/pnunit-launcher.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
30 |
32 |
33 |
34 |
37 |
39 |
40 |
41 |
42 |
45 |
47 |
48 |
49 |
50 |
53 |
55 |
56 |
57 |
58 |
61 |
63 |
64 |
65 |
66 |
69 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/NState/StateMachine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace NState
6 | {
7 | public class StateMachine : IStateMachine
8 | where TState : State
9 | {
10 | private Dictionary> _children =
11 | new Dictionary>();
12 |
13 | public StateMachine() { } //for deserialization
14 |
15 | public StateMachine(string name,
16 | IEnumerable> stateTransitions,
17 | TState initialState,
18 | TState finalState = null,
19 | IStateMachine parentStateMachine = null,
20 | bool permitSelfTransition = true,
21 | bool bypassTransitionBehaviorForSelfTransition = false) //if permitted
22 | {
23 | if (name == null) { throw new ArgumentNullException("name"); }
24 | if (stateTransitions == null) { throw new ArgumentNullException("stateTransitions"); }
25 | if (initialState == null) { throw new ArgumentNullException("initialState"); }
26 |
27 | Name = name;
28 | StateTransitions = stateTransitions.ToArray();
29 | InitialState = initialState;
30 | FinalState = finalState;
31 | Parent = parentStateMachine;
32 | PermitSelfTransition = permitSelfTransition;
33 | BypassTransitionBehaviorForSelfTransition = bypassTransitionBehaviorForSelfTransition;
34 |
35 | if (parentStateMachine != null)
36 | {
37 | Parent.Children.Add(Name, this);
38 | }
39 |
40 | CurrentState = initialState;
41 | }
42 |
43 | public string Name { get; set; }
44 |
45 | public IStateTransition[] StateTransitions { get; protected set; }
46 |
47 | public TState InitialState { get; set; }
48 |
49 | public TState FinalState { get; set; }
50 |
51 | public IStateMachine Parent { get; set; }
52 |
53 | public Dictionary> Children
54 | {
55 | get { return _children; }
56 | set { _children = value; }
57 | }
58 |
59 | public TState CurrentState { get; set; }
60 |
61 | public virtual TTransitionActionStatus TriggerTransition(TState targetState,
62 | dynamic statefulObject,
63 | dynamic args = default(dynamic))
64 | {
65 | return StateMachineTransitionHelper.TriggerTransition(this, targetState, statefulObject, args);
66 | }
67 |
68 | public bool PermitSelfTransition { get; set; }
69 |
70 | public bool BypassTransitionBehaviorForSelfTransition { get; set; }
71 | }
72 | }
--------------------------------------------------------------------------------
/src/NState/StateMachineTransitionHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using NState.Exceptions;
4 |
5 | namespace NState
6 | {
7 | ///
8 | /// NOTE 1: http://cs.hubfs.net/blogs/hell_is_other_languages/archive/2008/01/16/4565.aspx.
9 | /// NOTE 2: Transitions could be in-memory transactionalised using the
10 | /// memento pattern, or information could be sent to F# (see NOTE 1).
11 | ///
12 | public static class StateMachineTransitionHelper
13 | {
14 | public static TTransitionActionStatus
15 | TriggerTransition(StateMachine stateMachine,
16 | TState targetState,
17 | dynamic statefulObject,
18 | dynamic args = default(dynamic)) where TState : State
19 | {
20 | var result = default(TTransitionActionStatus);
21 | if (targetState == null)
22 | {
23 | throw new ArgumentNullException("targetState");
24 | }
25 |
26 | if (args == null)
27 | {
28 | throw new ArgumentNullException("args");
29 | }
30 |
31 | if (stateMachine.CurrentState == targetState && !stateMachine.PermitSelfTransition)
32 | {
33 | throw new SelfTransitionException();
34 | }
35 |
36 | if (stateMachine.CurrentState == stateMachine.FinalState)
37 | {
38 | throw new FinalStateTransitionException();
39 | }
40 |
41 | if ((stateMachine.CurrentState != targetState ||
42 | (stateMachine.CurrentState == targetState && !stateMachine.BypassTransitionBehaviorForSelfTransition)))
43 | {
44 | var matches = stateMachine.StateTransitions
45 | .Where(t => t.StartStates
46 | .Any(s => s == stateMachine.CurrentState) &&
47 | t.EndStates.Any(e => e == targetState)).ToList();
48 | var match = matches.Count > 0 ? matches[0] : null;
49 | if (match != null && match.Condition(targetState, statefulObject, args))
50 | {
51 | stateMachine.CurrentState.ExitAction(args);
52 | result = match.TransitionAction.Run(targetState, stateMachine, statefulObject, args);
53 | targetState.EntryAction(args);
54 | stateMachine.CurrentState = targetState;
55 | }
56 | else
57 | {
58 | if (stateMachine.Parent == null)
59 | {
60 | throw new InvalidStateTransitionException(stateMachine.CurrentState,
61 | targetState);
62 | }
63 |
64 | stateMachine.Parent.TriggerTransition(targetState, args);
65 | }
66 | }
67 |
68 | return result;
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/src/NState/StateMachineSerializationHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Dynamic;
4 | using System.Linq;
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 |
8 | namespace NState
9 | {
10 | public static class StateMachineSerializationHelper
11 | {
12 | public static string ToJson(this IStateMachine stateMachine) where TState : State
13 | {
14 | dynamic dto = SerializeToDto(stateMachine, new ExpandoObject());
15 | dynamic s = JsonConvert.SerializeObject(dto, Formatting.Indented,
16 | new JsonSerializerSettings
17 | {
18 | ObjectCreationHandling =
19 | ObjectCreationHandling.Replace
20 | });
21 |
22 | return s;
23 | }
24 |
25 | public static IStateMachine InitializeFromJson(this IStateMachine stateMachine, string json)
26 | where TState : State
27 | {
28 | return InitializeWithDto(stateMachine, JsonConvert.DeserializeObject(json));
29 | }
30 |
31 | ///
32 | /// State machine to be initlialized must match the serialized DTO.
33 | ///
34 | private static IStateMachine InitializeWithDto(
35 | IStateMachine stateMachine,
36 | dynamic dtoNode)
37 | where TState : State
38 | {
39 | if (stateMachine == null)
40 | {
41 | throw new ArgumentNullException("stateMachine");
42 | }
43 |
44 | if (dtoNode == null)
45 | {
46 | throw new ArgumentNullException("dtoNode");
47 | }
48 |
49 | if (stateMachine.Name != (string)dtoNode.Name)
50 | {
51 | throw new Exception("Mismatch between serialized object source and target in memory object. Ensure you are hydrating a state machine of the same type used to create the serialized object source.");
52 | }
53 |
54 | stateMachine.CurrentState =
55 | (TState) Activator.CreateInstance(Type.GetType((string) dtoNode.CurrentState.Name));
56 |
57 | if (dtoNode.Children != null && ((JEnumerable) dtoNode.Children).Any())
58 | {
59 | foreach (dynamic c in dtoNode.Children)
60 | {
61 | InitializeWithDto(stateMachine.Children[c.Name], c.Value);
62 | }
63 | }
64 |
65 | return stateMachine;
66 | }
67 |
68 | private static dynamic SerializeToDto(
69 | IStateMachine node, ExpandoObject dto)
70 | where TState : State
71 | {
72 | if (node == null)
73 | {
74 | throw new ArgumentNullException("node");
75 | }
76 |
77 | if (dto == null)
78 | {
79 | throw new ArgumentNullException("dto");
80 | }
81 |
82 | ((dynamic) dto).Name = node.Name;
83 | ((dynamic) dto).CurrentState = node.CurrentState;
84 |
85 | if (node.Children.Any())
86 | {
87 | var children = new List