Пример #1
0
        public void Specifying_an_event_activity()
        {
            _claim   = new ClaimAdjustmentInstance();
            _machine = AutomatonymousStateMachine <ClaimAdjustmentInstance>
                       .New(builder => builder
                            .State("Running", out Running)
                            .Event("Create", out Create)
                            .InstanceState(x => x.CurrentState)
                            .During(builder.Initial)
                            .When(Create, b => b
                                  .Execute(context => new CalculateValueActivity(new LocalCalculator()))
                                  .Execute(context => new ActionActivity <ClaimAdjustmentInstance>(x => { }))
                                  .TransitionTo(Running)
                                  )
                            );

            var data = new CreateClaim
            {
                X = 56,
                Y = 23,
            };

            _machine.RaiseEvent(_claim, Create, data)
            .Wait();
        }
        public void Specifying_an_event_activity()
        {
            _claim   = new ClaimAdjustmentInstance();
            _machine = new InstanceStateMachine();

            var data = new CreateClaim
            {
                X = 56,
                Y = 23,
            };

            _machine.RaiseEvent(_claim, _machine.Create, data);
        }