Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
close #1709 verify that FSMs with constructor agruments can be instan…
…tiated (#2451) Merged. some perf tests are failing. But only by a very small margin. And would attribute those to build server busyness.
- Loading branch information
1 parent
1963573
commit cd1a851
Showing
4 changed files
with
100 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="FsmActor.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com> | ||
// Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
using Akka.Actor; | ||
|
||
namespace Akka.TestKit.Tests.TestActorRefTests | ||
{ | ||
public enum TestFsmState | ||
{ | ||
First, | ||
Last | ||
} | ||
|
||
public class FsmActor : FSM<TestFsmState, string> | ||
{ | ||
private readonly IActorRef _replyActor; | ||
|
||
public FsmActor(IActorRef replyActor) | ||
{ | ||
_replyActor = replyActor; | ||
|
||
When(TestFsmState.First, e => | ||
{ | ||
if (e.FsmEvent.Equals("check")) | ||
{ | ||
_replyActor.Tell("first"); | ||
} | ||
else if (e.FsmEvent.Equals("next")) | ||
{ | ||
return GoTo(TestFsmState.Last); | ||
} | ||
return Stay(); | ||
}); | ||
|
||
When(TestFsmState.Last, e => | ||
{ | ||
if (e.FsmEvent.Equals("check")) | ||
{ | ||
_replyActor.Tell("last"); | ||
} | ||
else if (e.FsmEvent.Equals("next")) | ||
{ | ||
return GoTo(TestFsmState.First); | ||
} | ||
return Stay(); | ||
}); | ||
|
||
StartWith(TestFsmState.First, "foo"); | ||
} | ||
} | ||
} |
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