Пример #1
0
        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);
        }
Пример #2
0
        public void ThrowExceptionForInvalidSimpleDeclaration()
        {
            //arrange
            var wf = new Floo();

            wf.AddStateSetting("State");

            //act
            Action act = () => wf.Check();

            //assert
            Assert.Throws <FloomeenException>(act);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public void ThrowExceptionWhenMissingEndStateButOnSpecified()
        {
            //arrange
            var wf = new Floo();

            wf.AddTransition()
            .From("OnState")
            .On("SendMessage");

            //act
            Action act = () => wf.Check();

            //assert
            Assert.Throws <FloomeenException>(act);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }