Exemplo n.º 1
0
        public static StateMachineBuilder <TTrig, TName> .StateBuilder CreateTestState <TTrig, TName>(
            this StateMachineBuilder <TTrig, TName> builder,
            TName stateName, bool testExit = false)
        {
            var b = builder.CreateState(stateName)
                    .Enter(t => TestOnEntry(t.Trigger, stateName));

            if (testExit)
            {
                b.Exit(t => TestOnExit(t.Trigger, stateName));
            }

            return(b);
        }
Exemplo n.º 2
0
        public static StateMachineBuilder <TTrig, TName> .StateBuilder CreateTestAsyncState <TTrig, TName>(
            this StateMachineBuilder <TTrig, TName> builder,
            TName stateName, bool testExit = false)
        {
            var b = builder.CreateState(stateName)
                    .EnterAsync((t) =>
            {
                TestOnEntry(t.Trigger, stateName);
                return(Task.CompletedTask);
            });

            if (testExit)
            {
                b.ExitAsync(t =>
                {
                    TestOnExit(t.Trigger, stateName);
                    return(Task.CompletedTask);
                });
            }

            return(b);
        }