public StatefulProcessTest(ITestOutputHelper output)
        {
            var converter = new Converter(output);
            Console.SetOut(converter);
            
            _world = World.StartWithDefaults("five-step-process-test");

            var queue = new AsyncMessageQueue(null);
            _exchange = new LocalExchange(queue);
            _dispatcher = new MockTextDispatcher();
            var stateStore = _world.ActorFor<IStateStore>(() => new InMemoryStateStoreActor<TextState>(new List<IDispatcher> {_dispatcher}));

            var statefulTypeRegistry = new StatefulTypeRegistry(_world);
            
            var stepCountStateInfo = new Vlingo.Xoom.Lattice.Model.Stateful.Info(stateStore, typeof(StepCountState), stateStore.GetType().Name);
            statefulTypeRegistry.Register(stepCountStateInfo);

            _exchangeReceivers = new ExchangeReceivers();
            _exchangeSender = new LocalExchangeSender(queue);

            var processTypeRegistry = new ProcessTypeRegistry(_world);
            processTypeRegistry.Register(new StatefulProcessInfo<FiveStepEmittingStatefulProcess, StepCountState>(nameof(FiveStepEmittingStatefulProcess), _exchange, statefulTypeRegistry));

            RegisterExchangeCoveys();
        }
Exemple #2
0
        public StatefulEntityTest(ITestOutputHelper output)
        {
            var converter = new Converter(output);

            Console.SetOut(converter);

            _world      = World.StartWithDefaults("stateful-entity");
            _dispatcher = new MockTextDispatcher();

            _stateAdapterProvider = new StateAdapterProvider(_world);
            _stateAdapterProvider.RegisterAdapter(new Entity1StateAdapter());
            new EntryAdapterProvider(_world);
            var registry = new StatefulTypeRegistry(_world);

            var store = _world.ActorFor <IStateStore>(() => new InMemoryStateStoreActor <TextState>(new List <IDispatcher> {
                _dispatcher
            }));

            registry.Register(new Info(store, typeof(Entity1State), nameof(Entity1State)));
        }
Exemple #3
0
 /// <summary>
 /// Construct my default state.
 /// </summary>
 /// <param name="processName">The name of the current process</param>
 /// <param name="exchange">The <see cref="IExchange"/></param>
 /// <param name="registry">The <see cref="StatefulTypeRegistry"/> used by the <see cref="StatefulProcess{T}"/></param>
 public StatefulProcessInfo(string processName, IExchange exchange, StatefulTypeRegistry registry) : base(typeof(TProcess), processName, exchange)
     => Registry = registry;