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();
        }
Ejemplo n.º 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)));
        }