public ContextFactory(IStorage storage, IUserServiceFactory userServiceFactory, IStateFactory stateFactory, IServiceFactory serviceFactory) { this.storage = storage ?? throw new ArgumentNullException(nameof(storage)); this.serviceFactory = serviceFactory ?? throw new ArgumentNullException(nameof(serviceFactory)); this.stateFactory = stateFactory ?? throw new ArgumentNullException(nameof(stateFactory)); this.userService = (IInitUserService)userServiceFactory.CreateUserService(new InitState()); }
public AuthStateProvider( IAuthService authService, ISessionResolver sessionResolver, IStateFactory stateFactory) : this(null, authService, sessionResolver, stateFactory) { }
public SimulatorDouble( IStateFactory stateFactory, IEvaluator evaluator, IBoardGenerator generator) { this.stateFactory = stateFactory; this.evaluator = evaluator; this.generator = generator; }
public MeetMeDbContext(IStateFactory stateFactory) : base("MeetMeDB") { Guard.WhenArgument(stateFactory, "StateFactory").IsNull().Throw(); this.stateFactory = stateFactory; }
public MessageEventResult ProcessMessage(MessageEvent messageEvent) { IStateFactory stateFactory = StateFactory; if (!_stateStorage.TryGetValue(messageEvent.Id, out IState currentState)) { currentState = stateFactory.GetInitialState(); SetState(messageEvent.Id, currentState); } MessageEventResult result; try { result = currentState.HandleEvent(messageEvent); if (!FinalStateReached(messageEvent.Id)) { IState nextState = stateFactory.GetNextState(currentState); SetState(messageEvent.Id, nextState); } else { SetState(messageEvent.Id, stateFactory.GetInitialState()); } } catch (PreviousStateUserAnswerException prevStateAnswerEx) { result = new MessageEventResult(prevStateAnswerEx.Message); } return(result); }
public AggregateHandler(IStateFactory stateFactory, IServiceProvider serviceProvider) { Guard.NotNull(stateFactory, nameof(stateFactory)); Guard.NotNull(serviceProvider, nameof(serviceProvider)); this.stateFactory = stateFactory; this.serviceProvider = serviceProvider; }
/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> /// <param name="inputProvider">The input provider.</param> /// <param name="outputProvider">The output provider.</param> /// <param name="stateFactory">The factory that creates the game states.</param> public Game(IInputProvider inputProvider, IOutputProvider outputProvider, IStateFactory stateFactory) { this.InputProvider = inputProvider; this.OutputProvider = outputProvider; this.StateFactory = stateFactory; this.State = stateFactory.GetStartMenuState(this); }
public static IMutableState <T> NewMutable <T>( this IStateFactory factory, Option <Result <T> > initialOutput = default) { var options = new MutableState <T> .Options(); return(factory.NewMutable(options, initialOutput)); }
public ConnectionServiceBase(IStateFactory stateFactory, ILogger logger) { _stateFactory = stateFactory; _logger = logger; _currentState = stateFactory.Create(ConnectionState.Disconnected); _continue = true; }
public static IComputedState <T> NewComputed <T>( this IStateFactory factory, Func <IComputedState <T>, CancellationToken, Task <T> > computer) { var options = new ComputedState <T> .Options(); return(factory.NewComputed(options, computer)); }
virtual public void Initialize(IStateFactory factory) { //TODO: Verify if factory is null case yes throw some error m_factory = factory; m_engine = AFEngine.Instance; AddTransition(new AFDefaultStateTransition()); }
public void TestInitialize() { stubStateResolver = MockRepository.GenerateStub <IStateResolver>(); stubOperationsFactory = MockRepository.GenerateStub <IOperationsFactory>(); stubStateFactory = MockRepository.GenerateStub <IStateFactory>(); stubCurrentState = MockRepository.GenerateStub <IState>(); stubStateFactory.Stub(x => x.GetStartState()).Return(stubCurrentState); }
public IssueController(IIssueStore store, IStateFactory<Issue, IssueState> stateFactory, IssueLinkFactory linkFactory) { _store = store; _stateFactory = stateFactory; _linkFactory = linkFactory; }
public RandomStateService( IAppSettings appSettings, IViewService viewService, IStateFactory stateFactory, ILogService logService) : base(appSettings, viewService, stateFactory, logService) { }
public ParseEngine(IGrammar grammar, ParseEngineOptions options) { _dottedRuleRegistry = new GrammarSeededDottedRuleRegistry(grammar); StateFactory = new StateFactory(_dottedRuleRegistry); Options = options; _nodeSet = new ForestNodeSet(); Grammar = grammar; Initialize(); }
public static ILiveState <T> NewLive <T>( this IStateFactory factory, Func <ILiveState <T>, CancellationToken, Task <T> > computer, object?argument = null) { var options = new LiveState <T> .Options(); return(factory.NewLive(options, computer, argument)); }
// With default options public static IMutableState <T> NewMutable <T>( this IStateFactory factory, Result <T> initialOutput, object?argument = null) { var options = new MutableState <T> .Options(); return(factory.NewMutable(options, initialOutput, argument)); }
public Migration02_AddPatterns( InitialPatterns initialPatterns, IStateFactory stateFactory, IAppRepository appRepository) { this.initialPatterns = initialPatterns; this.appRepository = appRepository; this.stateFactory = stateFactory; }
public EventConsumerGrainManager(IEnumerable <IEventConsumer> consumers, IPubSub pubSub, IStateFactory factory) { Guard.NotNull(pubSub, nameof(pubSub)); Guard.NotNull(factory, nameof(factory)); Guard.NotNull(consumers, nameof(consumers)); this.pubSub = pubSub; this.factory = factory; this.consumers = consumers.ToList(); }
public void AsFactory(IStateFactory stateFactory) { if (stateFactory == null) { throw new ArgumentNullException(nameof(stateFactory)); } Factory = true; StateFactory = stateFactory; }
public StateControllerInitializationParams(ISession session, ISceneController sceneController, IStateFactory stateFactory, IStateInitializationParams stateInitializationParams) { Session = session; SceneController = sceneController; StateFactory = stateFactory; StateInitializationParams = stateInitializationParams; }
public ConnectionService(IStateFactory stateFactory, ILogger logger, IEventAggregatorService eventAggregatorService) : base(stateFactory, logger) { _eventAggregatorService = eventAggregatorService; // Subscribe to the event aggregator for state transition events _eventAggregatorService.Subscribe <StateTransitionEventArgs>(OnStateTransitionRequest); }
// With builder public static IMutableState <T> NewMutable <T>( this IStateFactory factory, Action <MutableState <T> .Options> optionsBuilder, Result <T> initialOutput) { var options = new MutableState <T> .Options(); optionsBuilder.Invoke(options); return(factory.NewMutable(options, initialOutput)); }
public static IMutableState <T> NewMutable <T>( this IStateFactory factory, Result <T> initialOutput) { var options = new MutableState <T> .Options() { InitialOutput = initialOutput, }; return(factory.NewMutable(options)); }
public static IMutableState <T> NewMutable <T>( this IStateFactory factory, Action <MutableState <T> .Options> optionsBuilder, Option <Result <T> > initialOutput = default, object?argument = null) { var options = new MutableState <T> .Options(); optionsBuilder.Invoke(options); return(factory.NewMutable(options, initialOutput, argument)); }
public static IComputedState <T> NewComputed <T>( this IStateFactory factory, Action <ComputedState <T> .Options> optionsBuilder, Func <IComputedState <T>, CancellationToken, Task <T> > computer, object?argument = null) { var options = new ComputedState <T> .Options(); optionsBuilder.Invoke(options); return(factory.NewComputed(options, computer, argument)); }
protected BaseStateService( IAppSettings appSettings, IViewService viewService, IStateFactory stateFactory, ILogService logService) { _appSettings = appSettings; _viewService = viewService; _stateFactory = stateFactory; _logService = logService; }
public Migration01_FromCqrs( FieldRegistry fieldRegistry, IEventDataFormatter eventDataFormatter, IEventStore eventStore, IStateFactory stateFactory) { this.fieldRegistry = fieldRegistry; this.eventDataFormatter = eventDataFormatter; this.eventStore = eventStore; this.stateFactory = stateFactory; }
public ControllerStateManager(IStateController <TStateType> stateController, IStateMachine <TState> stateMachine, IStateFactory <TStateType, TState> stateFactory, IStateValidator <TStateType> validator = null) : base(stateMachine, stateFactory, validator) { _stateController = stateController; ObservableExtensions.Subscribe <TStateType>(_stateController.StateObservable. Skip(1), ExecuteState).AddTo(_disposables); }
public StateManager( IStateMachine <TState> stateMachine, IStateFactory <TStateType, TState> stateFactory, IStateValidator <TStateType> validator = null) { _disposables = new List <IDisposable>(); _stateMachine = stateMachine; _stateFactory = stateFactory; _validator = validator; }
// NewMutable public static IMutableState <T> NewMutable <T>( this IStateFactory factory, T initialValue = default !) { var options = new MutableState <T> .Options() { InitialValue = initialValue, }; return(factory.NewMutable(options)); }
public Map(Coordinate x, Coordinate y, IEnumerable<Cell> aliveCells) { X = x.Value(); Y = y.Value(); Factory = new StateFactory(); Cells = new List<Cell>((X+1) * (Y+1)); for (var i = 0; i < X+1; i++) for (var j = 0; j < Y+1; j++) { var coordinateX = new Coordinate(i); var coordinateY = new Coordinate(j); var cell = new Cell(coordinateX, coordinateY); cell.State = (aliveCells.Contains(cell)) ? (State) new Alive(cell) : new Dead(cell); Cells.Add(cell); } }
public void Setup() { _stateFactory = new StateFactory(); _persister = new StatePersister(); }
public void SetUp() { planet = new Planet(50, Enumerable.Empty<Point>()); pointAtZeroZero = new Point { X = 0, Y = 0 }; stateFactory = new StateFactory(); }
public static void AddFactory(GameStates gameStates, IStateFactory stateFactory) { GetInstance().factories.Add(gameStates, stateFactory); }
public Machine(IStateFactory stateFactory, IStatePersister persister) { _stateFactory = stateFactory; _persister = persister; }
public MarsRover(Planet planet, String initialPosition, Char initialDirection, IStateFactory stateFactory) { rover = new Rover(new Point(initialPosition), initialDirection, stateFactory, planet); }
public void SetUp() { factory = new StateFactory(); planet = new Planet(100, new Point[] {}); rover = new Rover(new Point { X = 0, Y = 0 }, 'N', factory, planet); }
public void SetUp() { planet = new Planet(100, new Point[] { }); stateFactory = new StateFactory(); }
public Rover(Point point, Char direction, IStateFactory stateFactory, Planet planet) { currentPoint = point; state = stateFactory.BuildState(this, direction, planet); }