public void ThrowExceptionWhenSecondRuleMissingThirdEndState() { //arrange var wf = new Floo(); wf.AddTransition() .From("State") .On("Command") .GoTo("State"); wf.AddTransition() .From("OnState") .On("SendMessage") .Do(ctx => FakeFunk(ref ctx)) .When(FakeCheck) .GoTo("SentState") .When(FakeCheck) .GoTo("ErrorState") .Otherwise() //.StayAt("OnState") ; //act Action act = () => wf.Check(); //assert Assert.Throws <FloomeenException>(act); }
public void ThrowExceptionForInvalidSimpleDeclaration() { //arrange var wf = new Floo(); wf.AddStateSetting("State"); //act Action act = () => wf.Check(); //assert Assert.Throws <FloomeenException>(act); }
public void ThrowExceptionForInvalidSettingToStateDeclaration() { //arrange var wf = new Floo(); wf.AddStateSetting("EndState").IsStartState(); wf.AddTransition().From("State").On("Command").GoTo("EndState"); //act Action act = () => wf.Check(); //assert Assert.Throws <FloomeenException>(act); }
public void ThrowExceptionWhenMissingEndStateButOnSpecified() { //arrange var wf = new Floo(); wf.AddTransition() .From("OnState") .On("SendMessage"); //act Action act = () => wf.Check(); //assert Assert.Throws <FloomeenException>(act); }
public void ThrowExceptionWhenMissingConditions() { //arrange var wf = new Floo(); wf.AddTransition() .From("OnState") .On("SendMessage") .Do(ctx => FakeFunk(ref ctx)); //act Action act = () => wf.Check(); //assert Assert.Throws <FloomeenException>(act); }
public void ThrowExceptionWhenSameCommandRepeated() { //arrange var wf = new Floo(); wf.AddTransition() .From("OnState").On("Command").GoTo("State"); wf.AddTransition() .From("OnState").On("Command").GoTo("State"); //act Action act = () => wf.Check(); //assert Assert.Throws <FloomeenException>(act); }